+++ This bug was initially created as a clone of Bug #595500 +++ Description of problem: using the createOrUpdatePath xmlrpc command API results in newlines being removed from the end of the file Version-Release number of selected component (if applicable): 0.6 How reproducible: Always Steps to Reproduce: 1. configchannel.createOrUpdatePath() 2. Log in to web ui, see that the file has a missing newline. 3. Actual results: ending newlines are removed Expected results: ending newlines are preserved Additional info: have not tested against 1.0 yet --- Additional comment from roysjosh on 2010-05-25 15:56:21 EDT --- Created an attachment (id=416499) api verbose output 1.0 has the bug still.
Commited in spacewalk, will cherry pick into sat later today.
Fixed in 9c3bbcfc6cac71b6abc1056495882383a5bd2072
Added new parameter named "contents_enc64" to the filestruct of client.system.config.createOrUpdatePath API call. When this parameter is set to true the server expects to have the content in base64 encoding. This prevents from any whitespace stripping that takes place while parsing XML. Example: # login etc content = base64.b64encode(open("/my/config/file.conf").read()) file_struct = { 'contents':content, 'owner':owner, 'group':group, 'permissions':permissions, 'macro-start-delimiter':'', 'macro-end-delimiter':'', 'contents_enc64':'true' } # call createOrUpdatePath and logout
Setting ON_QA on Cliff's request. This should be already in 2010-09-19 respin.
# cat >/tmp/emptylines <EOF 3rd line EOF # cat >/tmp/test.py <<EOF import xmlrpclib import base64 DEFAULT_USER = "admin" DEFAULT_PASSWORD = "XXXXX" DEFAULT_SERVER = "localhost" server_url = "http://%s/rpc/api" % DEFAULT_SERVER client = xmlrpclib.Server(server_url) key = client.auth.login(DEFAULT_USER, DEFAULT_PASSWORD) content = base64.b64encode(open("/tmp/emptylines").read()) file_struct = { 'contents':content, 'owner':'apache', 'group':'apache', 'permissions':'444', 'selinux_ctx': 'unconfined_u:object_r:user_tmp_t:s0', 'macro-start-delimiter':'', 'macro-end-delimiter':'', 'contents_enc64':'true' } print client.configchannel.createOrUpdatePath(key, 'configch', '/etc/blabla', False, file_struct) EOF * created 'configch' config channel in webUI # python /tmp/test.py {'binary': False, 'group': 'apache', 'creation': <DateTime '20101008T04:04:12' at 855d08c>, 'modified': <DateTime '20101008T04:04:12' at 855d10c>, 'permissions_mode': '444', 'selinux_ctx': 'unconfined_u:object_r:user_tmp_t:s0', 'channel': 'configch', 'md5': 'cccab077d3cc88bd55d98933cdaa0c98', 'owner': 'apache', 'path': '/etc/blabla', 'permissions': 444, 'type': 'file', 'contents': '\n\n3rd line\n\n', 'revision': 1} * https://amd-ma78gm-01.rhts.eng.bos.redhat.com/rhn/configuration/file/FileDetails.do?cfid=1 file has empty lines at the begining and the end Verified. Satellite-5.4.0-RHEL5-re20101001.1
The 5.4.0 RHN Satellite and RHN Proxy release has occurred. This issue has been resolved with this release. RHEA-2010:0801 - RHN Satellite Server 5.4.0 Upgrade https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10332 RHEA-2010:0803 - RHN Tools enhancement update https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10333 RHEA-2010:0802 - RHN Proxy Server 5.4.0 bug fix update https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10334 RHEA-2010:0800 - RHN Satellite Server 5.4.0 https://rhn.redhat.com/rhn/errata/details/Details.do?eid=10335 Docs are available: http://docs.redhat.com/docs/en-US/Red_Hat_Network_Satellite/index.html Regards, Clifford
*** Bug 533828 has been marked as a duplicate of this bug. ***