Bug 1486285

Summary: rhn-satellite-activate --manifest-info shows failed manifest
Product: Red Hat Satellite 5 Reporter: Kenny Tordeurs <ktordeur>
Component: OtherAssignee: Jan Dobes <jdobes>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: medium Docs Contact:
Priority: medium    
Version: 580CC: jdobes, lhellebr, tkasparek, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-backend-2.5.3-154-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-13 07:59:26 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: 1450111    

Description Kenny Tordeurs 2017-08-29 11:42:53 UTC
Description of problem:
The command `# rhn-satellite-activate --manifest-info` should show currently activated manifest however it gets updated with the manifest of a failed activation.

~~~
 --manifest-info       show information about currently activated manifest
~~~

Version-Release number of selected component (if applicable):
[root@ktordeur-sat58 home]# rpm -qa | grep satellite
~~~
satellite-schema-5.8.0.31-1.el6sat.noarch
satellite-branding-5.8.0.8-1.el6sat.noarch
satellite-repo-5.8.0.2-2.el6sat.noarch
satellite-doc-indexes-5.8.0-1.el6sat.noarch
~~~

How reproducible:
100%

Steps to Reproduce:
1) Current manifest:
[root@ktordeur-sat57 home]# rhn-satellite-activate --manifest-info
~~~
Name: ktordeur-satellite58
UUID: 58576be4-01a7-43f1-b015-3dc28baf406e
Owner ID: xxxxxx
Satellite version: 5.8
Created: 2017-07-26T08:06:53.255+0000
API URL: https://subscription.rhn.redhat.com/subscription/consumers/
~~~

2) Try to activate a new manifest (but it fails)
[root@ktordeur-sat57 home]# rhn-satellite-activate --manifest=manifest.zip 
~~~
Certificate specifies 14 of rhel-server-6 non-flex entitlements.
    There are 20 non-flex entitlements allocated to non-base org(s) (0 used).
    You might need to deallocate some entitlements from non-base organization(s).
    You need to free 6 entitlements to match the new certificate.
Certificate specifies 14 of rhel-server-7 non-flex entitlements.
    There are 20 non-flex entitlements allocated to non-base org(s) (0 used).
    You might need to deallocate some entitlements from non-base organization(s).
    You need to free 6 entitlements to match the new certificate.
Activation failed, will now exit with no changes.
~~~

3) --manifest-info gets updated with failed manifest information:
[root@ktordeur-sat57 home]# rhn-satellite-activate --manifest-info
~~~
Name: satellite01.example.com
UUID: 58576be4-01a7-43f1-b015-3dc28baf7452e
Owner ID: xxxxxx
Satellite version: 5.8
Created: 2017-07-20T12:02:37.995+0000
API URL: https://subscription.rhn.redhat.com/subscription/consumers/
~~~

Actual results:
[root@ktordeur-sat57 home]# rhn-satellite-activate --manifest-info
~~~
Name: satellite01.example.com
UUID: 58576be4-01a7-43f1-b015-3dc28baf7452e
Owner ID: xxxxxx
Satellite version: 5.8
Created: 2017-07-20T12:02:37.995+0000
API URL: https://subscription.rhn.redhat.com/subscription/consumers/
~~~

Expected results:
[root@ktordeur-sat57 home]# rhn-satellite-activate --manifest-info
~~~
Name: ktordeur-satellite58
UUID: 58576be4-01a7-43f1-b015-3dc28baf406e
Owner ID: xxxxxx
Satellite version: 5.8
Created: 2017-07-26T08:06:53.255+0000
API URL: https://subscription.rhn.redhat.com/subscription/consumers/
~~~

Additional info:

Comment 2 Jan Dobes 2017-08-30 15:37:13 UTC
This is result of how rhn-satellite-activate works. First, it copies manifest to default location, then it tries to activate it, it doesn't care about result of activation. --manifest-info only reads last attempted manifest from default location. It worked same way for certificates in Sat < 5.8, however there wasn't such info feature so it wasn't noticeable.

It could be improved by rewriting rhn-satellite-activate to store it here after activation succeeds or by storing manifest in DB table etc.

Comment 3 Kenny Tordeurs 2017-08-31 07:15:10 UTC
@Jan according to man page it should be the currently activated manifest which can be misleading in that case.

[root@ktordeur-sat58 ~]# rhn-satellite-activate --help | grep manifest-info
  --manifest-info       show information about currently activated manifest

Comment 4 Jan Dobes 2017-09-07 09:09:38 UTC
This is true. I'll try to investigate how to fix it.

Comment 5 Jan Dobes 2017-09-14 13:28:37 UTC
fixed in spacewalk.git(master):

55e2af89e54ae3a0363f4f86230885ac8d18afc1

Comment 8 Lukáš Hellebrandt 2017-11-22 10:41:07 UTC
Verified with spacewalk-backend-2.5.3-157.

Used reproducer from OP. After failing to activate with different manifest, the original manifest info is still shown.

Comment 12 errata-xmlrpc 2017-12-13 07:59:26 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.

https://access.redhat.com/errata/RHBA-2017:3445