Howdy team, 

 When scheduling a config files deployment using the webUI, rhn_check fails if 
some file scheduled does not have a valid UID/GID into client box. 

 This patch introduce to rhn_check the same behavior as rhncfg-client get 
allowing the correct files (which have a valid UID/GID) to be deployed and 
fails to those files which misses a valid UID/GID. 

  We back port it to a test package for RHN Satellite, and customer approved 
the test package. (See BZ#737698). 


  Bellow follow some tests output: 

# rhncfg-client elist
             Mode          Owner Group          Size Rev      Config Channel    
File
             -rw-r--r--     root root             35   1             no_user    
/etc/file2
             -rw-r--r--     root root            199   1             no_user    
/etc/hosts
             -rw-r--r--  no_user no_user          51   2             no_user    
/etc/no_such_user_file
             -rw-r--r--     root root             34   1             no_user    
/tmp/file1
             -rw-r--r--  no_user no_user          50   2             no_user    
/tmp/no_such_user_tmp_file


            # id no_user 
            id: no_user: No such user

            # rhncfg-client verify
            missing /etc/file2
            modified /etc/hosts
            missing /etc/no_such_user_file
            missing /tmp/file1
            missing /tmp/no_such_user_tmp_file

            ** Going to webUI and setting all files to be deployed

            ** Running rhn_check and reporting results

            # rhn_check  -vv
            { .. SNIP .. }
               
D: do_call configfiles.deploy ({'files': [{'config_channel': 'no_user', 
'username': 'root', 'encoding': 'base64', 'checksum': 
'361eac4774c9280fbd0c28221e3a7e39', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'root', 'file_contents': 
'IyN0aGlzIGZpbGUgaXMgb3duZWQgYnkgcm9vdC9yb290Cg==\n', 'selinux_ctx': '', 
'filemode': 644, 'path': '/tmp/file1', 'checksum_type': 'md5', 'revision': 1}, 
{'config_channel': 'no_user', 'username': 'root', 'encoding': 'base64', 
'checksum': 'b2cbe5f297d9af192d82fd84e8284fa5', 'filetype': 'file', 
'delim_start': '{|', 'delim_end': '|}', 'symlink': '', 'groupname': 'root', 
'file_contents': 'IyMgdGhpcyBmaWxlIGlzIG93bmVkIGJ5IHJvb3Qvcm9vdAo=\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/etc/file2', 'checksum_type': 
'md5', 'revision': 1}, {'config_channel': 'no_user', 'username': 'no_user', 
'encoding': 'base64', 'checksum': 'bbf7090602cc0b3560371070eea6adf9', 
'filetype': 'file', 'delim_start': '{|', 'delim_end': '|}', 'symlink': '', 
'groupname': 'no_user', 'file_contents': 
'IyMgdGhpcyBmaWxlIGlzIG93bmVkIGJ5IG5vX3N1Y2hfdXNlci9ub19zdWNoX3VzZXIK\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/etc/no_such_user_file', 
'checksum_type': 'md5', 'revision': 2}, {'config_channel': 'no_user', 
'username': 'no_user', 'encoding': 'base64', 'checksum': 
'ff64077256ab8a9153e460ee04e42c22', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'no_user', 'file_contents': 
'IyN0aGlzIGZpbGUgaXMgb3duZWQgYnkgbm9fc3VjaF91c2VyL25vX3N1Y2hfdXNlcgo=\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/tmp/no_such_user_tmp_file', 
'checksum_type': 'md5', 'revision': 2}, {'config_channel': 'no_user', 
'username': 'root', 'encoding': 'base64', 'checksum': 
'3ee5504a6f4824026fde8f4802a15881', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'root', 'file_contents': 
'IyMjIHRlc3Qgb2YgL2V0Yy9ob3N0cyBmaWxlcwoxMjcuMC4wLjEgICBsb2NhbGhvc3QgbG9jYWxo\nb3N0LmxvY2FsZG9tYWluIGxvY2FsaG9zdDQgbG9jYWxob3N0NC5sb2NhbGRvbWFpbjQKOjoxICAg\nICAgICAgbG9jYWxob3N0IGxvY2FsaG9zdC5sb2NhbGRvbWFpbiBsb2NhbGhvc3Q2IGxvY2FsaG9z\ndDYubG9jYWxkb21haW42CgoKIyBFT0YgZmlsZQ==\n',
 'selinux_ctx': '', 'filemode': 644, 'path': '/etc/hosts', 'checksum_type': 
'md5', 'revision': 1}]},) {'cache_only': None}
D: Sending back response (44, 'Files successfully deployed but some files were 
not deployed for not having a valid uid/gid', {})
D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}
Loaded plugins: rhnplugin
D: Called refresh_rpmlist
Updating package profile
D: local action status:  (0, 'rpmlist refreshed', {})

                 
           # rhncfg-client verify
                    /etc/file2
                    /etc/hosts
            missing /etc/no_such_user_file
                    /tmp/file1
            missing /tmp/no_such_user_tmp_file

          # ls -la /tmp/no_such_user_tmp_file /tmp/file1 /etc/no_such_user_file 
/etc/hosts /etc/file2 
          ls: /tmp/no_such_user_tmp_file: No such file or directory
          ls: /etc/no_such_user_file: No such file or directory
          -rw-r--r-- 1 root root  35 Sep 15 01:01 /etc/file2
          -rw-r--r-- 1 root root 199 Sep 15 01:01 /etc/hosts
          -rw-r--r-- 1 root root  34 Sep 15 01:01 /tmp/file1

   As we can see, the rhn_check now deployed the correct files and not the 
missing UID/GID files. Looking the logs we have: 

# cat /var/log/rhncfg-actions 
2011-09-15 01:01:51 configfiles.deploy: Files successfully deployed: 
path: /tmp/file1
revision: 1

path: /etc/file2
revision: 1

path: /etc/hosts
revision: 1
 {}
2011-09-15 01:01:51 configfiles.deploy: Files not deployed for not having a 
valid uid/gid: 
path: /tmp/no_such_user_tmp_file
revision: 2

path: /etc/no_such_user_file
revision: 2
 {}

  At webUI we have: 
Details:

     This action will be executed after 09/15/11 1:01:38 AM BRT.

     This action's status is: Failed.
     The client picked up this action on 09/15/11 1:01:52 AM BRT.
     The client completed this action on 09/15/11 1:01:53 AM BRT.
     Client execution returned "Files successfully deployed but some files were 
not deployed for not having a valid uid/gid" (code 44)
     
     Config Files:
          /etc/file2 (rev. 1)   
          /etc/hosts (rev. 1)   
          /etc/no_such_user_file (rev. 2)       
          /tmp/file1 (rev. 1)   
          /tmp/no_such_user_tmp_file (rev. 2)

 
   Afterwards, creating the missing user the deployment worked as expected:

   # useradd  no_user
   # rhn_check -v 
   .. { SNIP } ..
   D: do_call configfiles.deploy ({'files': [{'config_channel': 'no_user', 
'username': 'root', 'encoding': 'base64', 'checksum': 
'361eac4774c9280fbd0c28221e3a7e39', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'root', 'file_contents': 
'IyN0aGlzIGZpbGUgaXMgb3duZWQgYnkgcm9vdC9yb290Cg==\n', 'selinux_ctx': '', 
'filemode': 644, 'path': '/tmp/file1', 'checksum_type': 'md5', 'revision': 1}, 
{'config_channel': 'no_user', 'username': 'root', 'encoding': 'base64', 
'checksum': 'b2cbe5f297d9af192d82fd84e8284fa5', 'filetype': 'file', 
'delim_start': '{|', 'delim_end': '|}', 'symlink': '', 'groupname': 'root', 
'file_contents': 'IyMgdGhpcyBmaWxlIGlzIG93bmVkIGJ5IHJvb3Qvcm9vdAo=\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/etc/file2', 'checksum_type': 
'md5', 'revision': 1}, {'config_channel': 'no_user', 'username': 'no_user', 
'encoding': 'base64', 'checksum': 'bbf7090602cc0b3560371070eea6adf9', 
'filetype': 'file', 'delim_start': '{|', 'delim_end': '|}', 'symlink': '', 
'groupname': 'no_user', 'file_contents': 
'IyMgdGhpcyBmaWxlIGlzIG93bmVkIGJ5IG5vX3N1Y2hfdXNlci9ub19zdWNoX3VzZXIK\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/etc/no_such_user_file', 
'checksum_type': 'md5', 'revision': 2}, {'config_channel': 'no_user', 
'username': 'no_user', 'encoding': 'base64', 'checksum': 
'ff64077256ab8a9153e460ee04e42c22', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'no_user', 'file_contents': 
'IyN0aGlzIGZpbGUgaXMgb3duZWQgYnkgbm9fc3VjaF91c2VyL25vX3N1Y2hfdXNlcgo=\n', 
'selinux_ctx': '', 'filemode': 644, 'path': '/tmp/no_such_user_tmp_file', 
'checksum_type': 'md5', 'revision': 2}, {'config_channel': 'no_user', 
'username': 'root', 'encoding': 'base64', 'checksum': 
'3ee5504a6f4824026fde8f4802a15881', 'filetype': 'file', 'delim_start': '{|', 
'delim_end': '|}', 'symlink': '', 'groupname': 'root', 'file_contents': 
'IyMjIHRlc3Qgb2YgL2V0Yy9ob3N0cyBmaWxlcwoxMjcuMC4wLjEgICBsb2NhbGhvc3QgbG9jYWxo\nb3N0LmxvY2FsZG9tYWluIGxvY2FsaG9zdDQgbG9jYWxob3N0NC5sb2NhbGRvbWFpbjQKOjoxICAg\nICAgICAgbG9jYWxob3N0IGxvY2FsaG9zdC5sb2NhbGRvbWFpbiBsb2NhbGhvc3Q2IGxvY2FsaG9z\ndDYubG9jYWxkb21haW42CgoKIyBFT0YgZmlsZQ==\n',
 'selinux_ctx': '', 'filemode': 644, 'path': '/etc/hosts', 'checksum_type': 
'md5', 'revision': 1}]},) {'cache_only': None}
   D: Sending back response (0, 'Files successfully deployed', {})
   D: do_call packages.checkNeedUpdate ('rhnsd=1',) {}
   Loaded plugins: rhnplugin
   D: local action status:  (0, 'rpm database not modified since last update 
(or package list recently updated)', {})

   # ls -la /tmp/no_such_user_tmp_file /tmp/file1 /etc/no_such_user_file 
/etc/hosts /etc/file2 
   -rw-r--r-- 1 root    root     35 Sep 15 01:06 /etc/file2
   -rw-r--r-- 1 root    root    199 Sep 15 01:06 /etc/hosts
   -rw-r--r-- 1 no_user no_user  51 Sep 15 01:06 /etc/no_such_user_file
   -rw-r--r-- 1 root    root     34 Sep 15 01:06 /tmp/file1
   -rw-r--r-- 1 no_user no_user  50 Sep 15 01:06 /tmp/no_such_user_tmp_file

   # rhncfg-client  verify
    /etc/file2
    /etc/hosts
    /etc/no_such_user_file
    /tmp/file1
    /tmp/no_such_user_tmp_file

   # rhncfg-client  elist
   Mode          Owner Group          Size Rev      Config Channel    File
   -rw-r--r--     root root             35   1             no_user    /etc/file2
   -rw-r--r--     root root            199   1             no_user    /etc/hosts
   -rw-r--r--  no_user no_user          51   2             no_user    
/etc/no_such_user_file
   -rw-r--r--     root root             34   1             no_user    /tmp/file1
   -rw-r--r--  no_user no_user          50   2             no_user    
/tmp/no_such_user_tmp_file

 Best Regards, 
mmello

Attachment: 0001-737697-fixed-rhn_check-when-deploying-a-group-files-.patch
Description: Binary data



Marcelo Moreira de Mello
RHCA RHCSS RHCVA
Senior Software Maintenance Engineer - SEG

gpg id: 2048/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

Reply via email to