Bug 737697
Summary: | RFE: rhn_check fails to deploy some files when the configuration channel have some other files which does not have a valid UID/GID | ||||||
---|---|---|---|---|---|---|---|
Product: | [Community] Spacewalk | Reporter: | Marcelo Moreira de Mello <mmello> | ||||
Component: | Clients | Assignee: | Marcelo Moreira de Mello <mmello> | ||||
Status: | CLOSED DEFERRED | QA Contact: | Red Hat Satellite QA List <satqe-list> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | 1.6 | CC: | cperry, mmello, slukasik | ||||
Target Milestone: | --- | Keywords: | FutureFeature, Patch | ||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | All | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Enhancement | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | |||||||
: | 737698 (view as bug list) | Environment: | |||||
Last Closed: | 2020-03-23 12:21:47 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 737830 | ||||||
Attachments: |
|
Description
Marcelo Moreira de Mello
2011-09-12 22:08:15 UTC
Taking... client/tools/rhncfg/actions/configfiles.py 201 def deploy(params, topdir=None, cache_only=None): 202 if cache_only: 203 return (0, "no-ops for caching", {}) 204 205 action_type = 'configfiles.deploy' 206 if not _local_permission_check(action_type): 207 log_to_file(0, "permissions error: " + str(action_type)) 208 return _perm_error(action_type) 209 210 _init() 211 files = params.get('files') or [] 212 dep_trans = DeployTransaction(transaction_root=topdir, auto_rollback=0) 213 .... 214 for file in files: 215 dep_trans.add(file) 216 217 try: 218 dep_trans.deploy() 219 #5/3/05 wregglej - 135415 Adding stuff for missing user info 220 except cfg_exceptions.UserNotFound, e: 221 try: 222 dep_trans.rollback().... 223 except FailedRollback: 224 log_to_file(0, "Failed deployment and rollback, information on user '%s' could not be found" % (e[0], )) 225 return (44, "Failed deployment and rollback, information on user '%s' could not be found" % (e[0], ), {}) 226 #5/3/05 wregglej - 136415 Adding some more exceptions to handle 227 except cfg_exceptions.UserNotFound, f: 228 log_to_file(0, "Failed deployment and rollback, information on user '%s' could not be found" % (f[0], )) 229 return (50, "Failed deployment and rollback, information on user '%s' could not be found" % (f[0], ), {}) 230 #5/5/05 wregglej - 136415 Adding exception handling for unknown group, 231 except cfg_exceptions.GroupNotFound, f: 232 log_to_file(0, "Failed deployment and rollback, group '%s' could not be found" % (f[0],)) 233 return (51, "Failed deployment and rollback, group '%s' could not be found" % (f[0],), {}) 234 else: 235 log_to_file(0, "Failed deployment and rollback, information on user '%s' could not be found" % (e[0], )) 236 return (50, "Failed deployment and rollback, information on user '%s' could not be found" % (e[0], ), {}) Working into this.. *** notes to myself **** Giving a quick look into the code we added the debug mode below: /usr/share/rhn/actions/configfiles.py ------------------------------------- 204 #mmello 205 files = params.get('files') or [] 206 import pwd.... 207 for file in files: 208 uid = file.get('username') 209 group = file.get('groupname') 210 if uid and group: 211 try: 212 user_record = pwd.getpwnam(uid) 213 group_record = pwd.getgrnam(group) 214 except: 215 user_record = group_record = "NOT EXISTS" 216 217 log_to_file(0,"DEBUG --> uid '%s'" % (uid, )). 218 log_to_file(0,"DEBUG --> group '%s'" % (group, )). 219 log_to_file(0,"DEBUG --> uid_record '%s'" % (user_record, )). 220 log_to_file(0,"DEBUG --> group_record '%s'" % (group_record, )). 221 222 dep_trans = DeployTransaction(transaction_root=topdir, auto_rollback=0) 223 .... 224 for file in files: 225 log_to_file(0,"DEBUG --> file '%s'" % (file, )) 226 dep_trans.add(file) Then, going thru webUI and trying to deploy the files etc/no_such_user_file /etc/file2 using rhn_check # rhn_check -vv ; ls -la /etc/no_such_user_file /etc/file2 { SNIP } D: handle_action actionid = 1254, version = 2 D: do_call configfiles.deploy ({'files': [{'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}]},) D: Sending back response (50, "Failed deployment and rollback, information on user 'no_user' could not be found", {}) 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: /etc/no_such_user_file: No such file or directory ls: /etc/file2: No such file or directory Looking the logs: -------------- /var/log/rhncfg-actions ------------------- 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> uid 'root' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> group 'root' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> uid_record 'NOT EXISTS' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> group_record 'NOT EXISTS' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> uid 'no_user' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> group 'no_user' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> uid_record 'NOT EXISTS' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> group_record 'NOT EXISTS' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> file '{'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}' 2011-09-13 02:47:11 configfiles.deploy: DEBUG --> file '{'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}' 2011-09-13 02:47:11 configfiles.deploy: Failed deployment and rollback, information on user 'no_user' could not be found Looking into this.. Created attachment 524443 [details] patch proposed 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 ++++++++++++++++++++++ Patch already sent to approval at Spacewalk Devel Maillist Mail Thread: https://www.redhat.com/archives/spacewalk-devel/2011-September/msg00036.html Best, mmello As noted at https://www.redhat.com/archives/spacewalk-devel/2011-September/msg00042.html My preference would be to keep the current rhn_check (strict) behaviour and change the rhncfg-client get behaviour to - default to the current behaviour on terminal and to strict behaviour of stdout is not a terminal; - have command-line option to force either the strict or non-strict behaviour. I'm marking this bugzilla as RFE. Spacewalk project as an upstream for Red Hat Satellite 5 product is going to be End Of Life on May 31 2020. Spacewalk 2.10 has been released as the last release of this project. https://github.com/spacewalkproject/spacewalk/wiki/ReleaseNotes210 Any new feature will not be included therefore closing remaining RFEs to set expectations properly. |