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

?

-- 
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

Reply via email to