Bug 1019227

Summary: auto-attach control does not work from client in CLI
Product: Red Hat Satellite Reporter: qianzhan
Component: Subscription ManagementAssignee: Christine Fouant <cfouant>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.3CC: bbuckingham, bkearney, cwelton, dgoodwin, gxing, jesusr, ldai, liliu, qianzhan, sgao, sthirugn, tomckay
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/6012
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1405922 1460939 (view as bug list) Environment:
Last Closed: 2015-08-12 05:07:41 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: 971511, 1014343, 1405922, 1460939    
Attachments:
Description Flags
'disable auto-attach from SAM web UI.png'
none
'disable auto-attach in CLI and the GUI does not work.png'
none
"enable auto-attach in satellite.png"
none
"enable auto-attach in subscripiton-manager-gui.png"
none
The auto-attach preference is still checked after disabling the it in CLI.png
none
enable auto-attach in satellite 2.png
none
enable auto-attach in subscripiton-manager-gui 2.png
none
The auto-attach preference is unchecked after disabling the it in CLI.png none

Description qianzhan 2013-10-15 10:33:59 UTC
Description of problem:
auto-attach control does not work from client in CLI

Version-Release number of selected component (if applicable):
katello-candlepin-cert-key-pair-1.0-1.noarch
katello-certs-tools-1.4.2-2.el6sat.noarch
katello-cli-1.4.3-11.el6sat.noarch
katello-cli-common-1.4.3-11.el6sat.noarch
katello-common-1.4.3.19-1.el6sam_splice.noarch
katello-configure-1.4.4-5.el6sam.noarch
katello-glue-candlepin-1.4.3.19-1.el6sam_splice.noarch
katello-glue-elasticsearch-1.4.3.19-1.el6sam_splice.noarch
katello-headpin-1.4.3.19-1.el6sam_splice.noarch
katello-headpin-all-1.4.3.19-1.el6sam_splice.noarch
katello-selinux-1.4.4-2.el6sat.noarch
candlepin-0.8.26-1.el6sam.noarch
candlepin-scl-1-5.el6_4.noarch
candlepin-scl-quartz-2.1.5-5.el6_4.noarch
candlepin-scl-rhino-1.7R3-1.el6_4.noarch
candlepin-scl-runtime-1-5.el6_4.noarch
candlepin-selinux-0.8.26-1.el6sam.noarch
candlepin-tomcat6-0.8.26-1.el6sam.noarch
thumbslug-0.0.34-1.el6sam.noarch
thumbslug-selinux-0.0.34-1.el6sam.noarch
subscription-manager: 1.9.9-1.el6

How reproducible:
always

Steps to Reproduce:
1. Register to SAM
[root@qianqian ~]# subscription-manager register
Username: admin
Password: 
The system has been registered with ID: 1f2b4183-4ece-42d0-9049-27c60a4e51bb 

2. Examine the 'Enable auto-attach preference' checkbox:
subscription-manager-gui ==> Systme ==> Preferences: the checkbox is checked by debault.

3. Log in the SAM web UI and disable the auto-attach, see attachment 'disable auto-attach from SAM web UI.png'

4. Examine the auto-attach control from SAM server:
(1)The 'Enable auto-attach preference' checkbox from subscription-manager-gui: the checkbox is unchecked.
(2)Show the current auto-attach preference in CLI
[root@qianqian ~]# subscription-manager auto-attach --show
Auto-attach preference: disabled

5. Enable auto-attach both from SAM web UI and subscription-manager-gui, disable auto-attach in CLI and examine the auto-attach control from client:
(1) Disable auto-attach in CLI:
[root@qianqian ~]# subscription-manager auto-attach --disable
Auto-attach preference: disabled

(2)The checkbox is checked when disable auto-attach in CLI, see attachment 'disable auto-attach in CLI and the GUI does not work.png'

(3)Show the current auto-attach preference in CLI
[root@qianqian ~]# subscription-manager auto-attach --show
Auto-attach preference: enabled

Actual results:
As step 5.

Expected results:
When control auto-attach from client, the CLI and GUI should both work.

Additional info:
I have examined that the issue does not exist on stage candlepin.

Comment 1 qianzhan 2013-10-15 10:34:44 UTC
Created attachment 812417 [details]
'disable auto-attach from SAM web UI.png'

Comment 2 qianzhan 2013-10-15 10:35:18 UTC
Created attachment 812418 [details]
'disable auto-attach in CLI and the GUI does not work.png'

Comment 4 Carter Kozak 2014-01-30 16:04:06 UTC
This sounds like something isn't sending a request correctly.

I cannot reproduce any problems with the subscription-manager client.  I think modifying it with other tools while the gui is running (preferences window open) gets the gui into a stale state, but nothing will actually be wrong.

It sounds like you're leaving the preferences window open, and expecting it to update, which never happens.

There may be a sam bug, but I can't really tell what the problem is from the description.

Feel free to re-open if this is still reproducible and is a bug, not just a stale preferences dialog (not closed and re-opened).

Comment 5 gaoshang 2014-02-08 10:13:03 UTC
This bug still exit in RHEL-7.0-20140207.0, so I reopened it, please see following details.

1, Register to SAM, and run "# subscription-manager auto-attach --disable"
2, Run "# subscription-manager-gui", the auto-attach check box in System Preference window still selected.

It should be a SAM bug, because when registered to Stage Candlepin, rerun above steps, the result is correct, please compare the logs

Run command "# subscription-manager auto-attach --disable" after registered to Stage Candlepin

    2014-02-08 04:02:24,610 [DEBUG] subscription-manager @plugins.py:519 - loaded plugin modules: []
    2014-02-08 04:02:24,610 [DEBUG] subscription-manager @plugins.py:520 - loaded plugins: {}
    2014-02-08 04:02:24,630 [DEBUG] subscription-manager @identity.py:130 - Loading consumer info from identity certificates.
    2014-02-08 04:02:24,635 [DEBUG] subscription-manager @profile.py:97 - Loading current RPM profile.
    2014-02-08 04:02:24,729 [INFO] subscription-manager @managercli.py:288 - Client Versions: {'python-rhsm': '1.10.12-1.el7', 'subscription-manager': '1.10.13-1.el7'}
    2014-02-08 04:02:24,730 [INFO] subscription-manager @connection.py:663 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
    2014-02-08 04:02:24,730 [INFO] subscription-manager @connection.py:674 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
    2014-02-08 04:02:24,730 [INFO] subscription-manager @connection.py:670 - Using no auth
    2014-02-08 04:02:24,730 [INFO] subscription-manager @connection.py:674 - Connection Built: host: subscription.rhn.stage.redhat.com, port: 443, handler: /subscription
    2014-02-08 04:02:24,741 [DEBUG] subscription-manager @connection.py:418 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem
    2014-02-08 04:02:24,741 [DEBUG] subscription-manager @connection.py:450 - Making request: GET /subscription/
    2014-02-08 04:02:25,798 [DEBUG] subscription-manager @connection.py:473 - Response: status=200
    2014-02-08 04:02:25,799 [DEBUG] subscription-manager @connection.py:690 - Server supports the following resources:
    2014-02-08 04:02:25,799 [DEBUG] subscription-manager @connection.py:691 - {'owners': '/owners', 'jobs': '/jobs', 'users': '/users', 'consumers': '/consumers', 'subscriptions': '/subscriptions', 'distributor_versions': '/distributor_versions', 'hypervisors': '/hypervisors', 'products': '/products', 'entitlements': '/entitlements', 'pools': '/pools'}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2014-02-08 04:02:25,800 [INFO] subscription-manager @managercli.py:299 - Server Versions: {'candlepin': 'Unknown', 'server-type': 'Red Hat Subscription Management'}
    2014-02-08 04:02:25,801 [DEBUG] subscription-manager @connection.py:418 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem
    2014-02-08 04:02:25,802 [DEBUG] subscription-manager @connection.py:450 - Making request: PUT /subscription/consumers/599e263a-3aee-45f5-8e07-7004d935e5b9
    2014-02-08 04:02:27,355 [DEBUG] subscription-manager @connection.py:473 - Response: status=204


Run command "# subscription-manager auto-attach --disable" after registered to SAM
    2014-02-08 03:32:21,731 [DEBUG] subscription-manager @plugins.py:519 - loaded plugin modules: []
    2014-02-08 03:32:21,731 [DEBUG] subscription-manager @plugins.py:520 - loaded plugins: {}
    2014-02-08 03:32:21,751 [DEBUG] subscription-manager @identity.py:130 - Loading consumer info from identity certificates.
    2014-02-08 03:32:21,756 [DEBUG] subscription-manager @profile.py:97 - Loading current RPM profile.
    2014-02-08 03:32:21,846 [INFO] subscription-manager @managercli.py:288 - Client Versions: {'python-rhsm': '1.10.12-1.el7', 'subscription-manager': '1.10.13-1.el7'}
    2014-02-08 03:32:21,846 [INFO] subscription-manager @connection.py:663 - Using certificate authentication: key = /etc/pki/consumer/key.pem, cert = /etc/pki/consumer/cert.pem, ca = /etc/rhsm/ca/, insecure = False
    2014-02-08 03:32:21,846 [INFO] subscription-manager @connection.py:674 - Connection Built: host: samserv.redhat.com, port: 443, handler: /sam/api
    2014-02-08 03:32:21,847 [INFO] subscription-manager @connection.py:670 - Using no auth
    2014-02-08 03:32:21,847 [INFO] subscription-manager @connection.py:674 - Connection Built: host: samserv.redhat.com, port: 443, handler: /sam/api
    2014-02-08 03:32:21,858 [DEBUG] subscription-manager @connection.py:418 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem
    2014-02-08 03:32:21,858 [DEBUG] subscription-manager @connection.py:450 - Making request: GET /sam/api/
    2014-02-08 03:32:21,908 [DEBUG] subscription-manager @connection.py:473 - Response: status=200
    2014-02-08 03:32:21,909 [DEBUG] subscription-manager @connection.py:690 - Server supports the following resources:
    2014-02-08 03:32:21,909 [DEBUG] subscription-manager @connection.py:691 - {'status': '/api/status/', 'organizations': '/api/organizations/', 'roles': '/api/roles/', 'sync_plans': '/api/sync_plans/', 'users': '/api/users/', 'distributors': '/api/distributors/', 'providers': '/api/providers/', 'entitlements': '/api/entitlements/', 'content_views': '/api/content_views/', 'system_groups': '/api/system_groups/', 'products': '/api/products/', 'systems': '/api/systems/', 'activation_keys': '/api/activation_keys/', 'content_view_definitions': '/api/content_view_definitions/', 'consumers': '/api/consumers/'}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2014-02-08 03:32:21,911 [DEBUG] subscription-manager @connection.py:418 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem
    2014-02-08 03:32:21,911 [DEBUG] subscription-manager @connection.py:450 - Making request: GET /sam/api/status
    2014-02-08 03:32:21,940 [DEBUG] subscription-manager @connection.py:473 - Response: status=200
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2014-02-08 03:32:21,941 [INFO] subscription-manager @managercli.py:299 - Server Versions: {'candlepin': '1.4.3.23-1.el6sam_splice-Headpin', 'server-type': 'Red Hat Subscription Management'}
    2014-02-08 03:32:21,942 [DEBUG] subscription-manager @connection.py:418 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-stage.pem, redhat-uep.pem, candlepin-local.pem
    2014-02-08 03:32:21,943 [DEBUG] subscription-manager @connection.py:450 - Making request: PUT /sam/api/consumers/d4e0044e-7c32-4fc0-bebc-c2a3f02e064e
    2014-02-08 03:32:22,481 [DEBUG] subscription-manager @connection.py:473 - Response: status=200

Comment 6 William Poteat 2014-07-08 15:37:08 UTC
The setting of this parameter works correctly when the client is run against Candlepin. It is only when SAM [1.3 or 1.4] is involved that the setting is ineffective. Pushing this to katello team for resolution.

Comment 7 RHEL Program Management 2014-07-09 18:04:18 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 9 Christine Fouant 2014-07-10 20:14:51 UTC
Created redmine issue http://projects.theforeman.org/issues/6578 from this bug

Comment 10 Christine Fouant 2014-07-16 21:12:36 UTC

*** This bug has been marked as a duplicate of bug 1113879 ***

Comment 11 qianzhan 2014-07-17 03:21:38 UTC
I don't think this bug is duplicate of 1113879, because this bug aims at auto-attach function by CLI, while 1113879 by Web UI.

Comment 12 Christine Fouant 2014-07-17 18:16:42 UTC

*** This bug has been marked as a duplicate of bug 1103774 ***

Comment 13 qianzhan 2014-07-18 03:48:26 UTC
Bug 1103774 should be a duplicate of this bug, because this bug is filed earlier than 1103774 by more than 8 months.

Comment 14 qianzhan 2014-07-18 03:48:56 UTC
*** Bug 1103774 has been marked as a duplicate of this bug. ***

Comment 15 Bryan Kearney 2014-07-29 18:18:49 UTC
Connecting redmine issue http://projects.theforeman.org/issues/6012 from this bug

Comment 19 qianzhan 2015-02-28 09:46:59 UTC
Verifying Version:
subscription-manager: 1.13.22-1.el7
python-rhsm: 1.13.10-1.el7

Verification:
1. Prepare Satellite-6.1.0-RHEL-7-20150225.0 and RHEL-7.1-20150219.1

2. Register the rhel to satellite:

[root@dhcp-128-77 ~]# rpm -ivh katello-ca-consumer-intel-s3e3432-01.rhts.eng.bos.redhat.com-1.0-1.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:katello-ca-consumer-intel-s3e3432################################# [100%]

[root@dhcp-128-77 ~]# subscription-manager register
Username: admin
Password: 
The system has been registered with ID: c8c33775-6698-4a8f-9b05-0dd9a25e2932 

3. Enable auto-attach in satellite web UI: see attachment "enable auto-attach in satellite.png"

4. Enable auto-attach in subscription-manager-gui of RHEL7.1: see attachment "enable auto-attach in subscripiton-manager-gui.png"

5. Disable auto-attach in CLI of RHEL7.1
[root@dhcp-128-77 ~]# subscription-manager auto-attach --disable
Auto-attach preference: disabled

6. Lanch subscription-manager-gui and open Preference window: The auto-attach preference is still checked, see attachment "The auto-attach preference is still checked after disabling the it in CLI.png"

7. Show the current auto-attach preference in CLI:
[root@dhcp-128-77 ~]# subscription-manager auto-attach --show
Auto-attach preference: enabled

As per step 6 and step 7, disabling auto-attach in subscription-manager CLI, can not control the auto-attach preference in subscription-manager-gui, can not control the auto-attach preference in subscription-manager CLI neither.

Moving the bug from ON_QA to ASSIGNED.

Comment 20 qianzhan 2015-02-28 09:47:46 UTC
Created attachment 996407 [details]
"enable auto-attach in satellite.png"

Comment 21 qianzhan 2015-02-28 09:48:24 UTC
Created attachment 996408 [details]
"enable auto-attach in subscripiton-manager-gui.png"

Comment 22 qianzhan 2015-02-28 09:49:02 UTC
Created attachment 996409 [details]
The auto-attach preference is still checked after disabling the it in CLI.png

Comment 23 Christine Fouant 2015-03-10 22:40:48 UTC
I have tried this using a RHEL7.1 machine and the latest compose (Satellite-6.1.0-RHEL-7-20150310.0), and I have not been able to recreate this bug. I am able to enable and disable it from CLI, and in sub-man-gui those changes are reflected.

Comment 24 qianzhan 2015-03-11 03:36:41 UTC
Verifying Version:
subscription-manager: 1.13.22-1.el7
python-rhsm: 1.13.10-1.el7

Verification:
1. Prepare Satellite-6.1.0-RHEL-7-20150310.0 and RHEL-7.1-20150219.1

2. Register the rhel to satellite:

[root@dhcp-128-77 ~]# subscription-manager register
Username: admin
Password: 
The system has been registered with ID: 4913a150-640a-47f2-9439-7ffd5887cd36 
[root@dhcp-128-77 ~]# 

3. Enable auto-attach in satellite web UI: see attachment "enable auto-attach in satellite 2.png"

4. Enable auto-attach in subscription-manager-gui of RHEL7.1: see attachment "enable auto-attach in subscripiton-manager-gui 2.png"

5. Disable auto-attach in CLI of RHEL7.1

[root@dhcp-128-77 ~]# subscription-manager auto-attach --disable
Auto-attach preference: disabled

6. Lanch subscription-manager-gui and open Preference window: 

The auto-attach preference is unchecked, see attachment "The auto-attach preference is unchecked after disabling the it in CLI.png"

7. Show the current auto-attach preference in CLI:

[root@dhcp-128-77 ~]# subscription-manager auto-attach --show
Auto-attach preference: disabled

As per step 6 and step 7, Moving the bug from ON_QA to VERIFIED.

Comment 25 qianzhan 2015-03-11 03:37:47 UTC
Created attachment 1000259 [details]
enable auto-attach in satellite 2.png

Comment 26 qianzhan 2015-03-11 03:38:24 UTC
Created attachment 1000260 [details]
enable auto-attach in subscripiton-manager-gui 2.png

Comment 27 qianzhan 2015-03-11 03:39:30 UTC
Created attachment 1000261 [details]
The auto-attach preference is unchecked after disabling the it in CLI.png

Comment 28 Bryan Kearney 2015-08-11 13:26:37 UTC
This bug is slated to be released with Satellite 6.1.

Comment 29 errata-xmlrpc 2015-08-12 05:07:41 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/RHSA-2015:1592