Bug 1134388 - RFE: Provide export tools for Transition Tooling
Summary: RFE: Provide export tools for Transition Tooling
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: New Feature
Version: 560
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
Assignee: Tomas Lestach
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks: sat560-triage
TreeView+ depends on / blocked
 
Reported: 2014-08-27 12:45 UTC by Tomas Lestach
Modified: 2014-09-10 15:01 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-09-10 15:01:01 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2014:1177 0 normal SHIPPED_LIVE spacewalk-java, spacewalk-reports and spacewalk-utils enhancement update 2014-09-10 19:00:16 UTC

Description Tomas Lestach 2014-08-27 12:45:55 UTC
Description of problem:
Provide new tools for exporting data from Red Hat Satellite 5 in csv format.
Especially new spacewalk-reports including a wrapper export tool and a tools for exporting custom channel content.

Version-Release number of selected component (if applicable):
Red Hat Satellite 5.6

Comment 1 Tomas Lestach 2014-08-27 13:09:51 UTC
The RFE introduces:

* new APIs needed for subscription-manager tools:
- system.unentile 
- system.transitionDataForSystem

* new spacewalk-reports:
- config-files
- config-files-latest
- system-profiles

* enhanced spacewalk-reports:
- channels report
- users report

* updated tools:
* spacewalk-export

Comment 3 Lukas Pramuk 2014-09-01 11:11:55 UTC
VERIFIED. spacewalk-reports-2.0.1-14.el6sat.noarch

>>> new spacewalk-reports present and functional

# spacewalk-report | grep -e config-files -e config-files-latest -e system-profiles
config-files
config-files-latest
system-profiles

# spacewalk-report config-files-latest | head -2
org_id,channel_id,channel,channel_type,path,file_type,file_id,revision,is_binary,contents,delim_start,delim_end,username,groupname,filemode,symbolic_link,selinux_ctx
1,410,ad-test-1,normal,"/""scriptalert1/script",file,496,2,N,Test rev.2,{|,|},root,root,644,,

# spacewalk-report config-files | head -3
org_id,channel_id,channel,channel_type,path,file_type,file_id,revision,is_binary,contents,delim_start,delim_end,username,groupname,filemode,symbolic_link,selinux_ctx
1,410,ad-test-1,normal,"/""scriptalert1/script",file,496,2,N,Test rev.2,{|,|},root,root,644,,
1,410,ad-test-1,normal,"/""scriptalert1/script",file,496,1,N,Test.,{|,|},root,root,644,,

# spacewalk-report system-profiles
server_id,profile_name,hostname,description,organization_id,organization_name,base_channel_id,base_channel_label,child_channel_id,child_channel_label,system_group_id,system_group,release,architecture,virtual_host,virtual_guest,is_virtualized,virt_type
1000012111,services.example.com,services.example.com,"Initial Registration Parameters:
OS: redhat-release
Release: 5Server
CPU Arch: x86_64-redhat-linux",1,RED HAT SATELLITE ENGINEERING,227,rhel-x86_64-server-5,None;288,None;rhel-x86_64-server-productivity-5,423,productive_servers,5Server,x86_64,,,No,
...


>>> enhanced spacewalk-reports functional (channels: channel_id added, users: roles multival ordering)

# spacewalk-report channels | head -2 
channel_id,channel_label,channel_name,number_of_packages,org_id
687,clone-2-rhel-i386-server-5,Clone 2 of Red Hat Enterprise Linux (v. 5 for 32-bit x86),2117,3

# spacewalk-report users | head -2
organization_id,organization,user_id,username,last_name,first_name,position,email,role,creation_time,last_login_time,active
1,RED HAT SATELLITE ENGINEERING,1,admin,Red,Hat,,qa,Activation Key Administrator;Channel Administrator;Configuration Administrator;Monitoring Administrator;Organization Administrator;Satellite Administrator;System Group Administrator,2006-12-22 14:20:16,2014-09-01 10:35:14,enabled

Comment 4 Lukas Pramuk 2014-09-01 12:01:13 UTC
VERIFIED. spacewalk-utils-2.0.2-16.el6sat.noarch


>>> updated tool spacewalk-export: support for new entities added and functional

# spacewalk-export --list-entities 2>&1 | grep -e config-files-latest -e kickstart-scripts -e system-profiles
INFO:    kickstart-scripts : Kickstart scripts for all organizations
INFO:  config-files-latest : Latest revision of all configuration files
INFO:      system-profiles : System profiles for all organizations

# spacewalk-export --entities=config-files-latest,kickstart-scripts,system-profiles
INFO: Processing config-files...
INFO: Processing kickstart-scripts...
INFO: Processing system-profiles...
INFO: Export-file created at /root/spacewalk-export-dir/spacewalk_export.tar.gz


>>> new csv files are exported and are sane

# ls /root/spacewalk-export-dir/exports/
config-files-latest.csv  kickstart-scripts.csv  system-profiles.csv

# head -2 `ls /root/spacewalk-export-dir/exports/*.csv`
==> /root/spacewalk-export-dir/exports/config-files-latest.csv <==
org_id,channel_id,channel,channel_type,path,file_type,file_id,revision,is_binary,contents,delim_start,delim_end,username,groupname,filemode,symbolic_link,selinux_ctx
1,410,ad-test-1,normal,"/""scriptalert1/script",file,496,2,N,Test rev.2,{|,|},root,root,644,,

==> /root/spacewalk-export-dir/exports/kickstart-scripts.csv <==
id,org_id,script_name,kickstart_id,kickstart_label,position,script_type,chroot,interpreter,data
404,1,,181,ad-test-1,1,pre,Y,/bin/bash,echo '10.56.23.199 sputnik-prod.brq.redhat.com' >> /etc/hosts

==> /root/spacewalk-export-dir/exports/system-profiles.csv <==
server_id,profile_name,hostname,description,organization_id,organization_name,base_channel_id,base_channel_label,child_channel_id,child_channel_label,system_group_id,system_group,release,architecture,virtual_host,virtual_guest,is_virtualized,virt_type
1000012111,services.brq.redhat.com,services.brq.redhat.com,"Initial Registration Parameters:


>>> fixed file ownership within export archive (root/root > apache/apache) 

# tar -tvf /root/spacewalk-export-dir/spacewalk_export.tar.gz
drwx------ apache/apache     0 2014-09-01 07:49 exports/
-rw-r--r-- apache/apache 636083 2014-09-01 07:58 exports/config-files-latest.csv
-rw-r--r-- apache/apache 430235 2014-09-01 07:58 exports/system-profiles.csv
-rw-r--r-- apache/apache   8922 2014-09-01 07:58 exports/kickstart-scripts.csv

Comment 5 Lukas Pramuk 2014-09-03 14:54:03 UTC
VERIFIED. spacewalk-java-2.0.2-81.el5sat.noarch

>>> new API calls present

# spacewalk-api --server=localhost --nologin api.getApiCallList $key | grep -e 'system.unentitle' -e 'system.transitionDataForSystem'
                        'system.transitionDataForSystem_string' => {
                        'system.unentitle_string' => {

>>> new API calls functional

1.register Sat5 to itself
2.run spacewalk-export and transfer export tar to sat6

3.@sat6: run hammer import content-host
4.@sat6: build system profiles transition rpm as hammer advised

5.install system-profile-transition rpm
# rpm -i system-profile-transition-<SAT6_FQDN>-1409658421-0.0.1-1.el6.noarch

6.call new APIs and verify result
# spacewalk-api --server=localhost --nologin system.transitionDataForSystem "$(</etc/sysconfig/rhn/systemid)"
$result = {
            'system_id' => '1000010001',
            'timestamp' => '1409658421',
            'hostname' => '<SAT6_FQDN>',
            'uuid' => '<UUID>'
          };

# spacewalk-api --server=localhost --nologin system.unentitle "$(</etc/sysconfig/rhn/systemid)"
$result = '1';

# key=$(spacewalk-api --server=localhost --nologin auth.login admin <password> | cut -d\' -f2)
# spacewalk-api --server=localhost --nologin system.getEntitlements $key 1000010001
$result = [];

Comment 7 errata-xmlrpc 2014-09-10 15:01:01 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/RHEA-2014-1177.html


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