Bug 645842 - API call configchannel.lookupFileInfo() does not return 'macro-start-delimiter' and 'macro-end-delimiter'
Summary: API call configchannel.lookupFileInfo() does not return 'macro-start-delimite...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: API
Version: 540
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Pavel Novotny
URL:
Whiteboard:
: 663006 (view as bug list)
Depends On:
Blocks: sat54-errata
TreeView+ depends on / blocked
 
Reported: 2010-10-22 15:54 UTC by Pavel Novotny
Modified: 2011-11-10 09:15 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
For text files, the configchannel.lookupFileInfo() API call has been corrected to return the "macro-start-delimiter" and "macro-end-delimiter" as described in the documentation.
Clone Of:
Environment:
Last Closed: 2010-12-16 15:45:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0991 0 normal SHIPPED_LIVE Red Hat Network Satellite bug fix and enhancement update 2010-12-16 15:44:21 UTC

Description Pavel Novotny 2010-10-22 15:54:32 UTC
Description of problem:
API call configchannel.lookupFileInfo(token, channel, [file]) does not return fields 'macro-start-delimiter' and 'macro-end-delimiter' for text files. According to API documantation it should.

Version-Release number of selected component (if applicable):
>>> client.api.getVersion()
'10.11'
# rpm -q spacewalk-backend-xmlrpc
spacewalk-backend-xmlrpc-1.2.13-11.el5sat

How reproducible:
Always

Steps to Reproduce:
1. Create configuration channel.
2. Create configuration file with type "Text File" in it.
3. On client side, call API function configchannel.lookupFileInfo(token, channel, [file]) and see the result.
  
Actual results:
Fields 'macro-start-delimiter' and 'macro-end-delimiter' are missing.

Expected results:
Fields 'macro-start-delimiter' and 'macro-end-delimiter' should be returned for text files.

Additional info:
This bug is regression, Satellite 5.3 with API version '10.8' works ok and API call returns delimiter fields.

Comment 1 Pavel Novotny 2010-11-04 11:30:16 UTC
This bug also affects API function configchannel.createOrUpdatePath(). If you create new config file via this function, it returns exact data as configchannel.lookupFileInfo(). That means without macro delimiter keys.

-----------------------
In [12]: conf = server.configchannel.createOrUpdatePath(key, 'conf-channel-1', '/tmp/config.cfg', False, { "contents": "File content", "owner": "root", "group": "root", "permissions": "644", "macro-start-delimiter": "{|", "macro-end-delimiter": "|}" })

In [13]: conf 
Out[13]: 
{'binary': False,
 'channel': 'conf-channel-1',
 'contents': 'File content',
 'creation': <DateTime '20101104T11:36:26' at 2559a28>,
 'group': 'root',
 'md5': '8bb2564936980e92ceec8a5759ec34a8',
 'modified': <DateTime '20101104T11:36:26' at 2559a70>,
 'owner': 'root',
 'path': '/tmp/config.cfg',
 'permissions': 644,
 'permissions_mode': '644',
 'revision': 1,
 'type': 'file'}

In [14]: conf_info = server.configchannel.lookupFileInfo(key, 'conf-channel-1', ['/tmp/config.cfg'])

In [15]: conf_info 
Out[15]: 
[{'binary': False,
  'channel': 'conf-channel-1',
  'contents': 'File content',
  'creation': <DateTime '20101104T11:36:26' at 2559d88>,
  'group': 'root',
  'md5': '8bb2564936980e92ceec8a5759ec34a8',
  'modified': <DateTime '20101104T11:36:27' at 2559dd0>,
  'owner': 'root',
  'path': '/tmp/config.cfg',
  'permissions': 644,
  'permissions_mode': '644',
  'revision': 1,
  'type': 'file'}]
-----------------------

Comment 2 Tomas Lestach 2010-11-04 12:30:48 UTC
Fixed.

spacewalk.git: 4dcc5328985794df95c494ce4dc72577946f2c0d

Comment 5 Pavel Novotny 2010-12-06 17:34:56 UTC
Verified.
Macro delimiter keys are returned by API.

# rpm -q spacewalk-java
spacewalk-java-1.2.39-32.el5sat

IPython session:

In [1]: import xmlrpclib 
In [2]: SERVER=<FQDN>
In [3]: USER=<username>
In [4]: PASS=<password>
In [5]: s = xmlrpclib.Server('http://%s/rpc/api' % SERVER)
In [6]: key = s.auth.login(USER, PASS)
In [7]: file_info_new = s.configchannel.lookupFileInfo(key, 'conf-channel-1', [ '/tmp/config.cfg' ])
In [8]: file_info_new 
Out[8]: 
[{'binary': False,
  'channel': 'conf-channel-1',
  'contents': 'This is file content.',
  'creation': <DateTime '20101206T17:32:30' at 18c2320>,
  'group': 'root',
  'macro-end-delimiter': '|}',
  'macro-start-delimiter': '{|',
  'md5': '8b7d18162895e9e4eb0e21ed522c14f0',
  'modified': <DateTime '20101206T17:32:30' at 18c2368>,
  'owner': 'root',
  'path': '/tmp/config.cfg',
  'permissions': 644,
  'permissions_mode': '644',
  'revision': 2,
  'selinux_ctx': 'root:object_r:unconfined_t',
  'type': 'file'}]
In [9]: new_conf_file = s.configchannel.createOrUpdatePath(key, 'conf-channel-1', '/tmp/config2.cfg', False, { "contents": "File content", "owner": "root", "group": "root", "permissions": "644", "macro-start-delimiter": "{|", "macro-end-delimiter": "|}" })
In [10]: new_conf_file 
Out[10]: 
{'binary': False,
 'channel': 'conf-channel-1',
 'contents': 'File content',
 'creation': <DateTime '20101206T17:39:35' at 18c2488>,
 'group': 'root',
 'macro-end-delimiter': '|}',
 'macro-start-delimiter': '{|',
 'md5': '8bb2564936980e92ceec8a5759ec34a8',
 'modified': <DateTime '20101206T17:39:35' at 18c24d0>,
 'owner': 'root',
 'path': '/tmp/config2.cfg',
 'permissions': 644,
 'permissions_mode': '644',
 'revision': 1,
 'type': 'file'}
In [11]: new_file_info = s.configchannel.lookupFileInfo(key, 'conf-channel-1', [ '/tmp/config2.cfg' ])
In [12]: new_file_info 
Out[12]: 
[{'binary': False,
  'channel': 'conf-channel-1',
  'contents': 'File content',
  'creation': <DateTime '20101206T17:39:35' at 18c25f0>,
  'group': 'root',
  'macro-end-delimiter': '|}',
  'macro-start-delimiter': '{|',
  'md5': '8bb2564936980e92ceec8a5759ec34a8',
  'modified': <DateTime '20101206T17:39:35' at 18c2638>,
  'owner': 'root',
  'path': '/tmp/config2.cfg',
  'permissions': 644,
  'permissions_mode': '644',
  'revision': 1,
  'type': 'file'}]

Comment 7 errata-xmlrpc 2010-12-16 15:45:38 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0991.html

Comment 8 Jaromir Hradilek 2010-12-16 16:34:21 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
For text files, the configchannel.lookupFileInfo() API call has been corrected to return the "macro-start-delimiter" and "macro-end-delimiter" as described in the documentation.

Comment 9 Clifford Perry 2011-01-04 17:21:18 UTC
*** Bug 663006 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.