Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-28 Thread Miroslav Suchý
On 04/27/2011 02:39 PM, Marcelo Moreira de Mello wrote:
 Hello Miroslav and Jan, 
 
 Follow a better patch for BZ#699966 with --ignore-missing and a better
 logical flow. 
 
 [root@dhcp96 ~]# rhncfg-manager  update --channel=test2-channel
 --ignore-missing /etc/hosts /etc/shadow /etc/autofss /etc/group /etc/bunda
 Local file /etc/autofss does not exist. Ignoring file...
 Local file /etc/bunda does not exist. Ignoring file...
 Pushing to channel nega:
 Local file /etc/hosts - remote file /etc/hosts
 Local file /etc/shadow - remote file /etc/shadow
 Local file /etc/group - remote file /etc/group
 
 Thank you for guidelines guys!
 


Commited as 812793c6c24678e6e362d628ddef225c298f7ead
Thx for contributing.

-- 
Miroslav Suchy
Red Hat Satellite Engineering
___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-27 Thread Jan Pazdziora
On Wed, Apr 27, 2011 at 02:46:02AM -0300, Marcelo Moreira de Mello wrote:
 
 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, --helpshow this help message and exit
 
 [root@server ~]# rhncfg-manager  update --channel=test-channel
 --force /etc/shadow /etc/autofss /etc/group /etc/no_exists

I don't like the --force. Could we have it names --ignore-missing
or --skip-missing or something similar?

-- 
Jan Pazdziora
Principal Software Engineer, Satellite Engineering, Red Hat

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-27 Thread Miroslav Suchý
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, --helpshow 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.

-- 
Miroslav Suchy
Red Hat Satellite Engineering

___
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel


Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-27 Thread Marcelo Moreira de Mello
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, --helpshow 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

Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-27 Thread Marcelo Moreira de Mello
On Wed, 2011-04-27 at 09:51 +0200, Jan Pazdziora wrote:
 On Wed, Apr 27, 2011 at 02:46:02AM -0300, Marcelo Moreira de Mello wrote:
  
  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, --helpshow this help message and exit
  
  [root@server ~]# rhncfg-manager  update --channel=test-channel
  --force /etc/shadow /etc/autofss /etc/group /etc/no_exists
 
 I don't like the --force. Could we have it names --ignore-missing
 or --skip-missing or something similar?
 

Hey Jan, 

My first version I set --ignore-missing :) hehehe.. 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


Re: [Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-27 Thread Marcelo Moreira de Mello
Hello Miroslav and Jan, 

Follow a better patch for BZ#699966 with --ignore-missing and a better
logical flow. 

[root@dhcp96 ~]# rhncfg-manager  update --channel=test2-channel
--ignore-missing /etc/hosts /etc/shadow /etc/autofss /etc/group /etc/bunda
Local file /etc/autofss does not exist. Ignoring file...
Local file /etc/bunda does not exist. Ignoring file...
Pushing to channel nega:
Local file /etc/hosts - remote file /etc/hosts
Local file /etc/shadow - remote file /etc/shadow
Local file /etc/group - remote file /etc/group

Thank you for guidelines guys!

Cheers, 
Marcelo


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, --helpshow 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.
 

-- 
Marcelo Moreira de Mello mme...@redhat.com
Red Hat Inc.
From: Marcelo Moreira de Mello mme...@redhat.com
Date: Wed, 27 Apr 2011 09:32:24 -0300
Subject: [PATCH]   699966 - added --ignore-missing option in rhncfg-manager to ignore missing local files when adding or uploading files

---
 .../tools/rhncfg/config_management/rhncfg_add.py   |   10 +-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/client/tools/rhncfg/config_management/rhncfg_add.py b/client/tools/rhncfg/config_management/rhncfg_add.py
index 0795691..b88fbc1 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(
+'-i', '--ignore-missing',   action=store_true,
+ help=Ignore missing local files,
+ ),
 ]
 
 def run(self):
@@ -96,7 +100,11 @@ class Handler(handler_base.HandlerBase):
 
 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.ignore_missing:
+files_to_push.remove((local_file,remote_file))
+print Local file %s does not exist. Ignoring file... %(local_file)
+else:
+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

[Spacewalk-devel] [PATCH] - BZ#699966 - Add an option on rhncfg-manager to ignore missing local files

2011-04-26 Thread Marcelo Moreira de Mello
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, --helpshow 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