Bug 1142337

Summary: rhncfg-client produces "Corrupt file received: Content checksums do not match!" errors when using macros
Product: Red Hat Satellite 5 Reporter: Stephan Dühr <stephan.duehr>
Component: Configuration ManagementAssignee: Stephen Herr <sherr>
Status: CLOSED ERRATA QA Contact: Jan Hutař <jhutar>
Severity: high Docs Contact:
Priority: urgent    
Version: 560CC: ddevra, jhutar, xdmoon
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhncfg-5.10.55-11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1142412 (view as bug list) Environment:
Last Closed: 2014-09-18 14:20:42 UTC Type: Bug
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: 465198, 1142412, 1165223    

Description Stephan Dühr 2014-09-16 15:25:00 UTC
Description of problem:

When Config-Files with macros are used, using rhncfg-client get or rhncfg-client verify fails with
Traceback (most recent call last):
  File "/usr/bin/rhncfg-client", line 38, in <module>
    sys.exit(Main().main() or 0)
  File "/usr/share/rhn/config_common/rhn_main.py", line 207, in main
    handler.run()
  File "/usr/share/rhn/config_client/rhncfgcli_get.py", line 25, in run
    self.options.exclude)
  File "/usr/share/rhn/config_common/deploy.py", line 42, in deploy_files
    finfo = repository.get_file_info(*args, **kwargs)
  File "/usr/share/rhn/config_client/rpc_cli_repository.py", line 91, in get_file_info
    temp_file, dirs_created = f.process(result, directory=dest_directory)
  File "/usr/share/rhn/config_common/file_utils.py", line 81, in process
    raise Exception, "Corrupt file received: Content checksums do not match!"
Exception: Corrupt file received: Content checksums do not match!

Version-Release number of selected component (if applicable):
rhncfg-client-5.10.55-10.el6sat.noarch
rhncfg-5.10.55-10.el6sat.noarch
rhncfg-actions-5.10.55-10.el6sat.noarch

How reproducible:
Use a macro in a config file, eg. in /etc/postfix/main.cf:
myhostname = {| rhn.system.hostname |}

Steps to Reproduce:
1. add
myhostname = {| rhn.system.hostname |}
to /etc/postfix/main.cf in a config channel.
Probably the same for any other file/macro
2. run rhncfg-client get /etc/postfix/main.cf on the client system
3. 

Actual results:
Traceback (most recent call last):
  File "/usr/bin/rhncfg-client", line 38, in <module>
    sys.exit(Main().main() or 0)
  File "/usr/share/rhn/config_common/rhn_main.py", line 207, in main
    handler.run()
  File "/usr/share/rhn/config_client/rhncfgcli_verify.py", line 73, in run
    (src, file_info, dirs_created) = self.repository.get_file_info(file)
  File "/usr/share/rhn/config_client/rpc_cli_repository.py", line 91, in get_file_info
    temp_file, dirs_created = f.process(result, directory=dest_directory)
  File "/usr/share/rhn/config_common/file_utils.py", line 81, in process
    raise Exception, "Corrupt file received: Content checksums do not match!"
Exception: Corrupt file received: Content checksums do not match!

Expected results:
Config files with macros should be deployed

Additional info:

Comment 1 Stephan Dühr 2014-09-16 15:27:09 UTC
forgot to mention that it works again after
yum downgrade rhncfg-5.10.55-8.el6sat rhncfg-client-5.10.55-8.el6sat rhncfg-actions-5.10.55-8.el6sat

Comment 2 Stephan Dühr 2014-09-16 16:44:32 UTC
I could reproduce this also with
rhncfg-5.10.77-1.el6.noarch
rhncfg-client-5.10.77-1.el6.noarch
rhncfg-actions-5.10.77-1.el6.noarch
from http://yum.spacewalkproject.org/nightly-client/RHEL/6/x86_64/
against spacewalk 2.2 (not spacewalk nightly, don't know if any
server part has an impact on this.)

Comment 3 Stephen Herr 2014-09-16 17:38:20 UTC
The fix for this problem is going to come in two parts.

Part 1 - client side:
We will release updated rhncfg* packages that cause this exception to not happen. This will ensure that the latest rhncfg works correctly against any version of Red Hat Satellite or RHN Classic.

Part 2 - serer side:
We will release updated spacewalk-backend packages for Satellite that will correctly checksum config files containing macros.

When using updated Satellite with an updated client then checksum validation of the config file contents will happen and work correctly before the config file is deployed. If using only an updated client then config file deployment will happen correctly, however the contents will not be validated (the same behavior as rhncfg-5.10.55-8).

This bug will track part 1. I will create a clone to track part 2.

Comment 4 Stephen Herr 2014-09-16 18:32:58 UTC
Committing to Spacewalk master:
2328a546d67847a61923bbe6f4085a8d2a802fba

Comment 7 Xixi 2014-09-16 21:32:03 UTC
KCS Solution https://access.redhat.com/solutions/1198383 with workaround has been updated with current status and BZ#s (thanks Stephen for heads-up!).

Comment 12 errata-xmlrpc 2014-09-18 14:20:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1261.html