Hello Jan,

Following your guidelines, here is a better patch which fixes that issue.

Thank you.

Cheers,
Marcelo

--
Marcelo Moreira de Mello<mme...@redhat.com>
Red Hat Inc.


On 05/06/2011 05:19 AM, Jan Pazdziora wrote:
On Fri, May 06, 2011 at 12:48:15AM -0300, Marcelo Moreira de Mello wrote:
Hello,

This patch fixes the rhncfg-client error when trying to deploy a file
with permission 000.

The BZ# mentioned in $subject were cloned to BZ#702535 and flipped
Product to Satellite.

Cheers,
mmello

--
Marcelo Moreira de Mello<mme...@redhat.com>
Red Hat Inc.
From: Marcelo Moreira de Mello<mme...@redhat.com>
Date: Fri, 6 May 2011 00:39:56 -0300
Subject: [PATCH] 702524 - fixed the python error when trying to deploy an file 
with permission 000 using rhncfg-client

---
  client/tools/rhncfg/config_common/transactions.py |    7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/client/tools/rhncfg/config_common/transactions.py 
b/client/tools/rhncfg/config_common/transactions.py
index de7a459..e55b337 100644
--- a/client/tools/rhncfg/config_common/transactions.py
+++ b/client/tools/rhncfg/config_common/transactions.py
@@ -142,9 +142,12 @@ class DeployTransaction:
              if file_info['filetype'] != 'symlink':
                  os.chown(temp_file_path, uid, gid)

-                mode = '600'
                  if file_info.has_key('filemode'):
-                    mode = file_info['filemode']
+                    try:
+                        if string.atoi(str(file_info['filemode']))>  0:
+                            mode = file_info['filemode']
+                    except:
+                        mode='600'

                  mode = string.atoi(str(mode), 8)
                  os.chmod(temp_file_path, mode)
So, why is the default here set to '600' by default, not to that '000'?

I don't like the exception logic as well -- why not something like
(untested)

        mode = 0
        if file_info.has_key('filemode'):
                try:
                        mode = string.atoi(str(file_info['filemode']))
                except ValueError:
                        None

?

From: Marcelo Moreira de Mello <mme...@redhat.com>
Date: Fri, 6 May 2011 11:26:21 -0300
Subject: [PATCH] 702524 - Fixed python traceback when deploying a file with 
permission set to 000

---
 client/tools/rhncfg/config_common/transactions.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/client/tools/rhncfg/config_common/transactions.py 
b/client/tools/rhncfg/config_common/transactions.py
index de7a459..44ffc60 100644
--- a/client/tools/rhncfg/config_common/transactions.py
+++ b/client/tools/rhncfg/config_common/transactions.py
@@ -144,7 +144,10 @@ class DeployTransaction:
 
                 mode = '600'
                 if file_info.has_key('filemode'):
-                    mode = file_info['filemode']
+                    if file_info['filemode'] is "":
+                        mode='000'
+                    else:
+                        mode = file_info['filemode']
 
                 mode = string.atoi(str(mode), 8)
                 os.chmod(temp_file_path, mode)
-- 
1.7.1

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

Reply via email to