Bug 1401464 - Output message of subscription-manager refresh , while trying to pull down a accidently deleted cert is "1 local certificate has been deleted."
Summary: Output message of subscription-manager refresh , while trying to pull down a ...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager
Version: 6.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-05 11:20 UTC by Shwetha Kallesh
Modified: 2016-12-05 17:26 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-05 17:26:37 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Shwetha Kallesh 2016-12-05 11:20:26 UTC
Description of problem:
Output message of subscription-manager refresh , while trying to pull a accidently deleted cert is "1 local certificate has been deleted."

Version-Release number of selected component (if applicable):
[root@dhcp35-179 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.21-1
subscription management rules: 5.20
subscription-manager: 1.18.5-1.git.1.b4f7184.el6
python-rhsm: 1.18.5-1.git.0.b42d418.el6


How reproducible:


Steps to Reproduce:
[root@dhcp35-179 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-server-basic
Contract:            0
Account:             12331131231
Serial:              2616796679901694000
Pool ID:             8ac6a39f58bf07120158bf0761e7038f
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       None
Service Type:        Self-Support
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/01/2016
Ends:                12/01/2017
System Type:         Physical

Subscription Name:   Awesome OS Server Bundled
Provides:            Load Balancing Bits
                     Awesome OS Server Bits
                     Clustering Bits
                     Shared Storage Bits
                     Large File Support Bits
                     Management Bits
SKU:                 awesomeos-server
Contract:            0
Account:             12331131231
Serial:              6912271364823775181
Pool ID:             8ac6a39f58bf07120158bf075f1602e1
Provides Management: Yes
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        Level 3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/01/2016
Ends:                12/01/2017
System Type:         Physical

[root@dhcp35-179 ~]# rm -rf /etc/pki/entitlement/6912271364823775181*
[root@dhcp35-179 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-server-basic
Contract:            0
Account:             12331131231
Serial:              2616796679901694000
Pool ID:             8ac6a39f58bf07120158bf0761e7038f
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       None
Service Type:        Self-Support
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/01/2016
Ends:                12/01/2017
System Type:         Physical

[root@dhcp35-179 ~]# subscription-manager refresh
1 local certificate has been deleted.
All local data refreshed

Actual results:
1 local certificate has been deleted.
All local data refreshed

Expected results:

All local data refreshed

Additional info:

Comment 1 Shwetha Kallesh 2016-12-05 11:24:56 UTC
rhsm.log and the consumed list details after subscription-manager refresh
 
------------------------------------------------------------
[root@dhcp35-179 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS Server Basic
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-server-basic
Contract:            0
Account:             12331131231
Serial:              2784279269193606638
Pool ID:             8ac6a39f58bf07120158bf0761e7038f
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       None
Service Type:        Self-Support
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/01/2016
Ends:                12/01/2017
System Type:         Physical

Subscription Name:   Awesome OS Server Bundled
Provides:            Load Balancing Bits
                     Awesome OS Server Bits
                     Clustering Bits
                     Shared Storage Bits
                     Large File Support Bits
                     Management Bits
SKU:                 awesomeos-server
Contract:            0
Account:             12331131231
Serial:              2428154520604804769
Pool ID:             8ac6a39f58bf07120158bf075f1602e1
Provides Management: Yes
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        Level 3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              12/01/2016
Ends:                12/01/2017
System Type:         Physical


[root@dhcp35-179 ~]# tail -f /var/log/rhsm/rhsm.log
2016-12-05 06:18:29,434 [DEBUG] subscription-manager:30099:MainThread @cert_sorter.py:207 - partial stacks: []
2016-12-05 06:18:29,434 [DEBUG] subscription-manager:30099:MainThread @cache.py:154 - Checking current system info against cache: /var/lib/rhsm/cache/installed_products.json
2016-12-05 06:18:29,443 [DEBUG] subscription-manager:30099:WriteCacheEntitlementStatusCacheThread @cache.py:110 - Wrote cache: /var/lib/rhsm/cache/entitlement_status.json
2016-12-05 06:18:29,471 [DEBUG] subscription-manager:30099:MainThread @cache.py:171 - No changes.
2016-12-05 06:18:29,472 [DEBUG] subscription-manager:30099:MainThread @identity.py:131 - Loading consumer info from identity certificates.
2016-12-05 06:18:29,475 [INFO] subscription-manager:30099:MainThread @connection.py:758 - Connection built: http_proxy=auto-services.usersys.redhat.com:3129 host=shwetha-workstation.usersys.redhat.com port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2016-12-05 06:18:29,475 [DEBUG] subscription-manager:30099:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:29,476 [DEBUG] subscription-manager:30099:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:29,476 [DEBUG] subscription-manager:30099:MainThread @connection.py:490 - Making request: GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/entitlements?exclude=certificates.key&exclude=certificates.cert
2016-12-05 06:18:32,343 [INFO] subscription-manager:30099:MainThread @connection.py:525 - Response: status=200, requestUuid=a90d9548-ecaa-454e-aeab-f784d76b7403, request="GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/entitlements?exclude=certificates.key&exclude=certificates.cert"
2016-12-05 06:18:46,203 [DEBUG] subscription-manager:30122:MainThread @https.py:59 - Using m2crypto wrappers to provide httplib and ssl
2016-12-05 06:18:46,321 [DEBUG] subscription-manager:30122:MainThread @ga_loader.py:89 - ga_loader GaImporterGtk2
2016-12-05 06:18:46,325 [DEBUG] subscription-manager:30122:MainThread @plugins.py:569 - loaded plugin modules: [<module 'container_content' from '/usr/share/rhsm-plugins/container_content.pyc'>]
2016-12-05 06:18:46,325 [DEBUG] subscription-manager:30122:MainThread @plugins.py:570 - loaded plugins: {'container_content.ContainerContentPlugin': <container_content.ContainerContentPlugin object at 0x1587c90>}
2016-12-05 06:18:46,326 [DEBUG] subscription-manager:30122:MainThread @identity.py:131 - Loading consumer info from identity certificates.
2016-12-05 06:18:46,360 [INFO] subscription-manager:30122:MainThread @managercli.py:389 - Client Versions: {'python-rhsm': '1.18.5-1.git.0.b42d418.el6', 'subscription-manager': '1.18.5-1.git.1.b4f7184.el6'}
2016-12-05 06:18:46,360 [INFO] subscription-manager:30122:MainThread @connection.py:758 - Connection built: http_proxy=auto-services.usersys.redhat.com:3129 host=shwetha-workstation.usersys.redhat.com port=8443 handler=/candlepin auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2016-12-05 06:18:46,361 [INFO] subscription-manager:30122:MainThread @connection.py:758 - Connection built: http_proxy=auto-services.usersys.redhat.com:3129 host=shwetha-workstation.usersys.redhat.com port=8443 handler=/candlepin auth=none
2016-12-05 06:18:46,361 [INFO] subscription-manager:30122:MainThread @managercli.py:364 - Consumer Identity name=dhcp35-179.lab.eng.blr.redhat.com uuid=8417ef78-8f00-48b6-9de0-18e50b1daf54
2016-12-05 06:18:46,362 [DEBUG] subscription-manager:30122:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:46,363 [DEBUG] subscription-manager:30122:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:46,363 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: PUT /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates?lazy_regen=true
2016-12-05 06:18:48,938 [INFO] subscription-manager:30122:MainThread @connection.py:525 - Response: status=204, requestUuid=76ef884b-b6b5-45e4-b7bc-72e29a866121, request="PUT /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates?lazy_regen=true"
2016-12-05 06:18:48,942 [DEBUG] subscription-manager:30122:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:48,943 [DEBUG] subscription-manager:30122:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:48,943 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates/serials
2016-12-05 06:18:52,009 [INFO] subscription-manager:30122:MainThread @connection.py:525 - Response: status=200, requestUuid=47813771-8f91-4bb0-9377-e0fcc026e014, request="GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates/serials"
2016-12-05 06:18:52,011 [DEBUG] subscription-manager:30122:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:52,012 [DEBUG] subscription-manager:30122:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:52,012 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates?serials=2784279269193606638,2428154520604804769
2016-12-05 06:18:54,892 [INFO] subscription-manager:30122:MainThread @connection.py:525 - Response: status=200, requestUuid=05cbaf69-37e4-4728-a403-b44d53ef855d, request="GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates?serials=2784279269193606638,2428154520604804769"
2016-12-05 06:18:54,893 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:351 - Ent cert bundle pre_install
2016-12-05 06:18:54,895 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:373 - ent cert bundle post_install
2016-12-05 06:18:54,896 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:351 - Ent cert bundle pre_install
2016-12-05 06:18:54,898 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:373 - ent cert bundle post_install
2016-12-05 06:18:54,898 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:305 - cert bundles post_install: <rhsm.certificate2.EntitlementCertificate object at 0x1695c50>
2016-12-05 06:18:54,898 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:305 - cert bundles post_install: <rhsm.certificate2.EntitlementCertificate object at 0x169c350>
2016-12-05 06:18:54,898 [INFO] subscription-manager:30122:MainThread @entcertlib.py:131 - certs updated:
Total updates: 3
Found (local) serial# [2616796679901694000L]
Expected (UEP) serial# [2784279269193606638, 2428154520604804769]
Added (new)
  [sn:2784279269193606638 (Awesome OS Server Bits,) @ /etc/pki/entitlement/2784279269193606638.pem]
  [sn:2428154520604804769 (Load Balancing Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
  [sn:2428154520604804769 (Awesome OS Server Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
  [sn:2428154520604804769 (Clustering Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
  [sn:2428154520604804769 (Shared Storage Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
  [sn:2428154520604804769 (Large File Support Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
  [sn:2428154520604804769 (Management Bits,) @ /etc/pki/entitlement/2428154520604804769.pem]
Deleted (rogue):
  [sn:2616796679901694000 (Awesome OS Server Bits,) @ /etc/pki/entitlement/2616796679901694000.pem]
2016-12-05 06:18:54,906 [DEBUG] subscription-manager:30122:MainThread @entcertlib.py:173 - entcerlibaction.repo_hook
2016-12-05 06:18:54,906 [DEBUG] subscription-manager:30122:MainThread @base_action_client.py:85 - running lib: <subscription_manager.repolib.RepoActionInvoker object at 0x15a3f50>
2016-12-05 06:18:54,942 [DEBUG] subscription-manager:30122:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:54,943 [DEBUG] subscription-manager:30122:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:54,943 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: GET /candlepin/
2016-12-05 06:18:57,445 [INFO] subscription-manager:30122:MainThread @connection.py:525 - Response: status=200, requestUuid=2046d274-6b61-4528-a3f7-c08678206543, request="GET /candlepin/"
2016-12-05 06:18:57,447 [DEBUG] subscription-manager:30122:MainThread @connection.py:775 - Server supports the following resources: {'': '/', 'guestids': '/consumers/{consumer_uuid}/guestids', 'cdn': '/cdn', 'content_overrides': '/consumers/{consumer_uuid}/content_overrides', 'hypervisors': '/hypervisors', 'serials': '/serials', 'deleted_consumers': '/deleted_consumers', 'consumers': '/consumers', 'content': '/content', 'entitlements': '/entitlements', 'events': '/events', 'status': '/status', 'jobs': '/jobs', 'users': '/users', 'subscriptions': '/subscriptions', 'rules': '/rules', 'distributor_versions': '/distributor_versions', 'consumertypes': '/consumertypes', 'pools': '/pools', 'atom': '/atom', 'owners': '/owners', 'roles': '/roles', 'admin': '/admin', 'products': '/products', 'activation_keys': '/activation_keys', 'crl': '/crl'}
2016-12-05 06:18:57,449 [DEBUG] subscription-manager:30122:MainThread @connection.py:444 - Loaded CA certificates from /etc/rhsm/ca/: candlepin-ca.pem, shwetha-workstation.pem, redhat-entitlement-authority.pem, 10.pem, redhat-uep.pem
2016-12-05 06:18:57,449 [DEBUG] subscription-manager:30122:MainThread @connection.py:476 - Using proxy: auto-services.usersys.redhat.com:3129
2016-12-05 06:18:57,449 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: GET /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/content_overrides
2016-12-05 06:18:59,659 [DEBUG] rhsmd:30138:MainThread @https.py:59 - Using m2crypto wrappers to provide httplib and ssl
2016-12-05 06:18:59,731 [INFO] rhsmd:30138:MainThread @rhsmd:261 - rhsmd started

Comment 4 Chris Snyder 2016-12-05 17:26:37 UTC
Due to the support of the query parameter "lazy_regen=True" on the following call:
2016-12-05 06:18:46,363 [DEBUG] subscription-manager:30122:MainThread @connection.py:490 - Making request: PUT /candlepin/consumers/8417ef78-8f00-48b6-9de0-18e50b1daf54/certificates?lazy_regen=true

We expect the subscription-manager refresh command to cause the subscription management server to create new entitlement certificates for all subscriptions consumed for the current consumer.

Because one entitlement cert has already been deleted (manually, by you using the rm command) there is only one stale entitlement certificate left to delete.
In fact if you had not manually deleted one cert, the output should have shown that two certs were deleted ("2 local certificates have been deleted").

The original behaviour you described is still valid against some older candlepin servers and / or with the use of older subscription-manager versions that do not pass the "lazy_regen=true" query parameter.


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