Hello, This patch adds a new option in rhncfg-manager which allows to continue if local files were missing.
Per example: [root@server ~]# rhncfg-manager update --help usage: rhncfg-manager update [options] file [ file ... ] options: -c CHANNEL, --channel=CHANNEL Upload files in this config channel -d DEST_FILE, --dest-file=DEST_FILE Upload the file as this path -t TOPDIR, --topdir=TOPDIR Make all files relative to this string --delim-start=DELIM_START Start delimiter for variable interpolation --delim-end=DELIM_END End delimiter for variable interpolation -f, --force Ignore errors if some local files does not exist -h, --help show this help message and exit [root@server ~]# rhncfg-manager update --channel=test-channel --force /etc/shadow /etc/autofss /etc/group /etc/no_exists Local file /etc/autofss does not exist. Ignoring file... Local file /etc/no_exists does not exist. Ignoring file... Pushing to channel test-channel: Local file /etc/shadow -> remote file /etc/shadow Local file /etc/group -> remote file /etc/group Cheers, Marcelo -- Marcelo Moreira de Mello <mme...@redhat.com> Red Hat Inc.
From: Marcelo Moreira de Mello <mme...@redhat.com> Date: Wed, 27 Apr 2011 02:40:34 -0300 Subject: [PATCH] 699966 - added --force option in rhncfg-manager to ignore missing local files when adding or uploading files --- .../tools/rhncfg/config_management/rhncfg_add.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/client/tools/rhncfg/config_management/rhncfg_add.py b/client/tools/rhncfg/config_management/rhncfg_add.py index 0795691..3035615 100644 --- a/client/tools/rhncfg/config_management/rhncfg_add.py +++ b/client/tools/rhncfg/config_management/rhncfg_add.py @@ -44,6 +44,10 @@ class Handler(handler_base.HandlerBase): '--delim-end', action="store", help="End delimiter for variable interpolation", ), + handler_base.HandlerBase._option_class( + '-f', '--force', action="store_true", + help="Ignore errors if some local files does not exist", + ), ] def run(self): @@ -95,8 +99,13 @@ class Handler(handler_base.HandlerBase): files_to_push.append((f, f)) for (local_file, remote_file) in files_to_push: - if not os.path.exists(local_file): - die(9, "No such file `%s'" % local_file) + if self.options.force: + if not os.path.exists(local_file): + files_to_push.remove((local_file,remote_file)) + print "Local file %s does not exist. Ignoring file..." %(local_file) + else: + if not os.path.exists(local_file): + die(9, "No such file `%s'" % local_file) print "Pushing to channel %s:" % (channel, ) -- 1.7.1
_______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel