Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
Pradeep Kilambi wrote: Coe, Colin C. (Unix Engineer) wrote: Ahem... From: spacewalk-devel-boun...@redhat.com [spacewalk-devel-boun...@redhat.com] On Behalf Of Miroslav Suchý [msu...@redhat.com] Sent: Thursday, 12 February 2009 7:31 PM To: spacewalk-devel@redhat.com; Coe, Colin C. (Unix Engineer) Subject: Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files Coe, Colin C. (Unix Engineer) wrote: This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an --exclude parameter to 'rhncfg-client get'. This allows you to get all files for this system except that one. Example: rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf Please credit this to Ian. As always, Thanks Colin/Ian :) I'll add this the list of patches I'm suppose to review and apply this week. Thanks Again. ~ Prad Patch applied. One suggestion, your patch does'nt include the new exclude option in the man page. If you wish to include that feel free to send me a patch. If not I can update that as well. Thanks for your contribution. ~ Prad Hmm, did you intend to actually attach the patch to your email? :)) -- Miroslav Suchy RHN Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments. ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel -- -- Pradeep Kilambi RHN Satellite Engineering pkila...@redhat.com Phone: +1 919 754 4285 RHCE # 805008680430554 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
Coe, Colin C. (Unix Engineer) wrote: Ahem... From: spacewalk-devel-boun...@redhat.com [spacewalk-devel-boun...@redhat.com] On Behalf Of Miroslav Suchý [msu...@redhat.com] Sent: Thursday, 12 February 2009 7:31 PM To: spacewalk-devel@redhat.com; Coe, Colin C. (Unix Engineer) Subject: Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files Coe, Colin C. (Unix Engineer) wrote: This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an --exclude parameter to 'rhncfg-client get'. This allows you to get all files for this system except that one. Example: rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf Please credit this to Ian. As always, Thanks Colin/Ian :) I'll add this the list of patches I'm suppose to review and apply this week. Thanks Again. ~ Prad Hmm, did you intend to actually attach the patch to your email? :)) -- Miroslav Suchy RHN Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments. ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel -- -- Pradeep Kilambi RHN Satellite Engineering pkila...@redhat.com Phone: +1 919 754 4285 RHCE # 805008680430554 ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
Coe, Colin C. (Unix Engineer) wrote: From: spacewalk-devel-boun...@redhat.com [spacewalk-devel-boun...@redhat.com] On Behalf Of Miroslav Suchý [msu...@redhat.com] Sent: Thursday, 12 February 2009 7:31 PM To: spacewalk-devel@redhat.com; Coe, Colin C. (Unix Engineer) Subject: Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files Coe, Colin C. (Unix Engineer) wrote: This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an --exclude parameter to 'rhncfg-client get'. This allows you to get all files for this system except that one. Example: rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf Please credit this to Ian. I will leave the merging and testing for others who knows this part of code better. But from quick look, the patch should include change in man file for consistency as well: client/tools/rhncfg/config_client/rhncfg-client.sgml -- Miroslav Suchy RHN Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
RE: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
Ahem... From: spacewalk-devel-boun...@redhat.com [spacewalk-devel-boun...@redhat.com] On Behalf Of Miroslav Suchý [msu...@redhat.com] Sent: Thursday, 12 February 2009 7:31 PM To: spacewalk-devel@redhat.com; Coe, Colin C. (Unix Engineer) Subject: Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files Coe, Colin C. (Unix Engineer) wrote: > This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an > --exclude parameter to 'rhncfg-client get'. This allows you to get all files > for this system except that one. > > Example: > rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf > > Please credit this to Ian. Hmm, did you intend to actually attach the patch to your email? :)) -- Miroslav Suchy RHN Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments. From 114364d3c9a14fc5ef49d7f4b80141d399640ab1 Mon Sep 17 00:00:00 2001 From: Colin Coe Date: Thu, 12 Feb 2009 19:09:07 +0900 Subject: [PATCH] Allow for rhncfg-client get to --exclude files --- client/tools/rhncfg/config_client/handler_base.py |6 +++- client/tools/rhncfg/config_client/rhncfgcli_get.py | 39 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/client/tools/rhncfg/config_client/handler_base.py b/client/tools/rhncfg/config_client/handler_base.py index 729e93c..270a5ad 100644 --- a/client/tools/rhncfg/config_client/handler_base.py +++ b/client/tools/rhncfg/config_client/handler_base.py @@ -50,7 +50,7 @@ class HandlerBase(handler_base.HandlerBase): files.append(file) files.sort() return files - + # Main function to be run def run(self): log_debug(2) @@ -76,6 +76,10 @@ class TopdirHandlerBase(HandlerBase): '--topdir', action="store", help="Make all file operations relative to this directory.", ), +HandlerBase._option_class( +'--exclude',action="append", +help="Excludes a file from being deployed with 'get'. May be used multiple times.", +), ] def get_dest_file(self, file): diff --git a/client/tools/rhncfg/config_client/rhncfgcli_get.py b/client/tools/rhncfg/config_client/rhncfgcli_get.py index d361949..b808b7f 100644 --- a/client/tools/rhncfg/config_client/rhncfgcli_get.py +++ b/client/tools/rhncfg/config_client/rhncfgcli_get.py @@ -24,7 +24,7 @@ import handler_base def deploying_mesg_callback(path): print "Deploying %s" % path - + class Handler(handler_base.TopdirHandlerBase): _usage_options = handler_base.HandlerBase._usage_options + " [ files ... ]" def run(self): @@ -32,14 +32,20 @@ class Handler(handler_base.TopdirHandlerBase): dep_trans = DeployTransaction(transaction_root=topdir) dep_trans.deploy_callback(deploying_mesg_callback) - + +# Setup the excludes hash +excludes = {} +if self.options.exclude is not None: +for exclude in enumerate(self.options.exclude): +excludes[exclude[1]] = None + for path in self.get_valid_files(): (directory, filename) = os.path.split(path) - directory = os.path.normpath("%s%s%s" % (topdir, os.sep, directory)) +directory = os.path.normpath("%s%s%s" % (topdir, os.sep, directory)) try: -finfo = self.repository.get_file_info(path, auto_delete=0, dest_directory=directory) +finfo = self.repository.get_file_info(path, auto_delete=0, dest_directory=directory) except cfg_exceptions.DirectoryEntryIsFile, e: print "Error: unable to deploy directory %s, as it is already a file on disk" % (e[0], ) continue @@ -50,14 +56,17 @@ class Handler(handler_base.TopdirHandlerBase): (processed_path, file_info, dirs_created) = finfo -try: -dep_trans.add_preprocessed(path, processed_path, file_info, dirs_created) -except cfg_exceptions.UserNotFound, e: -print "Error: unable to deploy file %s, information on user '%s' could not be found." % (path,e[0]) -continue -except cfg_exceptions.GroupNotFound, e: -
Re: [Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
Coe, Colin C. (Unix Engineer) wrote: This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an --exclude parameter to 'rhncfg-client get'. This allows you to get all files for this system except that one. Example: rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf Please credit this to Ian. Hmm, did you intend to actually attach the patch to your email? :)) -- Miroslav Suchy RHN Satellite Engineering, Red Hat ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel
[Spacewalk-devel] PATCH: Allow for rhncfg-client get to --exclude files
This patch (which I'm submitting on behalf of a college, Ian Chapman) adds an --exclude parameter to 'rhncfg-client get'. This allows you to get all files for this system except that one. Example: rhncfg-client get --exclude /etc/ldap.conf --exclude /etc/openldap/ldap.conf Please credit this to Ian. Thanks CC NOTICE: This email and any attachments are confidential. They may contain legally privileged information or copyright material. You must not read, copy, use or disclose them without authorisation. If you are not an intended recipient, please contact us at once by return email and then delete both messages and all attachments. ___ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel