Bug 1395883 - spacecmd configchannel_import fails with 'Invalid argument(s): contents' exception
Summary: spacecmd configchannel_import fails with 'Invalid argument(s): contents' exce...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Client
Version: 580
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Tomáš Kašpárek
QA Contact: Pavel Studeník
URL:
Whiteboard:
: 1395884 (view as bug list)
Depends On: 1179333
Blocks: sat580-spw-retest
TreeView+ depends on / blocked
 
Reported: 2016-11-16 21:18 UTC by Jan Hutař
Modified: 2017-06-21 12:15 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1179333
Environment:
Last Closed: 2017-06-21 12:15:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Jan Hutař 2016-11-16 21:18:21 UTC
We have tested (or attempted to test) bug like this when Spacewalk 2.6 was to be released. This is a clone of that bug to get it re-tested on Satellite 5.8.0. In some cases bug can be completely irrelevant (in such cases I suggest to close the bug as NOTABUG), in some cases it might be wise to take the bug as a note that something changed in a given area and we might want to sanity-test that area (and mark the bug as VERIFIED with "SanityOnly" keyword) and in some cases bug might be totally relevant to Satellite.



+++ This bug was initially created as a clone of Bug #1179333 +++

Hello Everyone,
space_cmd failing  to import *.json configuration channel when file type "Directory" is created under the channel, because key contents is empty or not exist.

Command:

spacecmd -d configchannel_import oel6-general.json -u rhn_update

Error: 

ERROR: redstone.xmlrpc.XmlRpcFault: Invalid argument(s): contents


Fix:

/usr/lib/python2.6/site-packages/spacecmd/configchannel.py


1067                 if filedetails['type'] == 'directory':
1068                     isdir = True
1069                     if filedetails.has_key('contents'):
1070                         del filedetails['contents']

--- Additional comment from Ondrej Gajdusek on 2016-08-31 14:40:12 EDT ---

repaired in commit: 26ba75d31fb7aa5bed167245a891ad28d508facb

--- Additional comment from Jan Hutař on 2016-11-10 16:18:28 EST ---

Used this file for testing: https://bugzilla.redhat.com/attachment.cgi?id=990404&action=edit

  # spacecmd -u <user> -p <pass> -- configchannel_import db-postgresql-wal-el7.json
  INFO: Spacewalk Username: <user>
  INFO: Connected to https://<fqdn>/rpc/api as admin
  INFO: Importing config channel  Database PostgreSQL WAL EL7
  INFO: Found file /var/lib/pgsql/data/postgresql.conf for cc Database PostgreSQL WAL EL7
  INFO: Found directory /var/lib/pgsql/data/wal-archive for cc Database PostgreSQL WAL EL7

Import worked and on webUI I can see 1 file and 1 directory in the created config channel.

I have tested on both SWnightly@OracleXE10@RHEL6 and SWnightly@PostgreSQL@RHEL7 (spacecmd-2.6.16-1.el6).

Comment 1 Jan Hutař 2016-11-16 21:28:47 UTC
*** Bug 1395884 has been marked as a duplicate of this bug. ***

Comment 2 Pavel Studeník 2017-05-09 13:48:43 UTC
Verified with spacecmd-2.5.0-13.el6sat.noarch

Reproducer:

Create some channels and export it as backup

>> spacecmd -u admin -p nimda configchannel_export

remove it and import from backup

>> spacecmd -u admin -p nimda configchannel_import cc_all.json


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