On Wed, 2011-04-27 at 10:45 +0200, Miroslav Suchý wrote: > On 04/27/2011 07:46 AM, Marcelo Moreira de Mello wrote: > > 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 > > > > > > > > > > > > _______________________________________________ > > Spacewalk-devel mailing list > > Spacewalk-devel@redhat.com > > https://www.redhat.com/mailman/listinfo/spacewalk-devel > > > I do not like this: > - 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) > > I would rather use: > > if not os.path.exists(local_file): > if self.options.force: > files_to_push.remove((local_file,remote_file)) > print "Local file %s does not exist. Ignoring > else: > die(9, "No such file `%s'" % local_file) > > This is very similar, but you do not duplicate that line with: > os.path.exists(local_file) > also IMHO it better reflect the logical flow. >
OK. Thanks for guide lines. I'm fixing it. Cheers, Marcelo -- Marcelo Moreira de Mello RHCA RHCSS RHCVA Software Maintenance Engineer/SEG gpg id: 2048R/FDB110E5 gpg fingerprint: 3BE7 EF71 4DD7 6812 D309 8F18 BD42 D095 FDB1 10E5 _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel