Bug 1489760 - content-override done by hammer has no effect when using AK
Summary: content-override done by hammer has no effect when using AK
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Activation Keys
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Christine Fouant
QA Contact: Lukas Pramuk
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-08 10:11 UTC by Lukas Pramuk
Modified: 2019-09-26 14:48 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:54:37 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21275 0 Normal Closed content-override done by hammer has no effect when using AK 2020-09-18 11:33:19 UTC

Description Lukas Pramuk 2017-09-08 10:11:06 UTC
Description of problem:
overriding to enabled/disabled in hammer doesn't work.
Though hammer content-overide command finishes successfully, it has no effect when using AK while overriding in UI has.

Version-Release number of selected component (if applicable):
satellite-6.3.0-17.0.beta.el7sat.noarch
katello-3.4.5-1.el7sat.noarch
foreman-1.15.3-2.el7sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create the AK
# hammer activation-key create --name AK --lifecycle-environment-id 1 --content-view-id 1 --organization-id 1

2. Create product with a repository
# hammer product create --name Product --organization-id 1
# hammer repository create --name Repo --url "http://some.useful.repo/x86_64/os/" --content-type yum  --product Product --organization-id 1
# hammer product synchronize --name Product --organization-id 1

3. Assign the product to the AK
sub_id=$(hammer --csv subscription list --organization-id 1 | awk -F, '$3=="Product"{print$1}')
hammer activation-key add-subscription --name AK --organization-id 1 --subscription-id $sub_id

4. Override custom content in AK to disabled (since the default is enabled)
# hammer activation-key content-override --name AK --organization-id 1 --content-label Default_Organization_Product_Repo --value 0
Updated content override

# hammer activation-key product-content --name AK --organization-id 1
--------------|------|------|-----|---------|-----------------------------------|----------|---------
ID            | NAME | TYPE | URL | GPG KEY | LABEL                             | ENABLED? | OVERRIDE
--------------|------|------|-----|---------|-----------------------------------|----------|---------
1504093523357 | Repo |      |     |         | Default_Organization_Product_Repo | yes      | ak:0    
--------------|------|------|-----|---------|-----------------------------------|----------|---------

>>> UI check says "Enabled" (no effect?)

5. @client: Register using AK
# subscription-manager register --activationkey AK --org Default_Organization
The system has been registered with ID: a2adfb49-722b-46d1-8a88-59822f4ac29e 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.

6. Check repos available
# yum repolist
Loaded plugins: product-id, search-disabled-repos, subscription-manager
repo id                                                                 repo name                                 status
!Default_Organization_Product_Repo                                      Repo                                      304
repolist: 304

>>> BAD repo is not disabled (it has really no effect) 

Actual results:
content-override done by hammer has no effect 

Expected results:
content-override done by hammer works

Comment 2 Lukas Pramuk 2017-09-19 14:17:43 UTC
This is regression as in 6.2 this worked/works.

hammer activation-key content-override only sets an override "ak:0/1" but doesn't enable such override or put into effect "enabled:0/1" (while UI override does both)


CLI (override done by hammer - bullet 4 in comment#0):

# hammer activation-key product-content --name AK --organization-id 1
--------------|------|------|-----|---------|-----------------------------------|----------|---------
ID            | NAME | TYPE | URL | GPG KEY | LABEL                             | ENABLED? | OVERRIDE
--------------|------|------|-----|---------|-----------------------------------|----------|---------
1504093523357 | Repo |      |     |         | Default_Organization_Product_Repo | yes      | ak:0    
--------------|------|------|-----|---------|-----------------------------------|----------|---------

vs.

UI (override done in webui):

# hammer activation-key product-content --name AK --organization-id 1
--------------|------|------|-----|---------|-----------------------------------|----------|----------------
ID            | NAME | TYPE | URL | GPG KEY | LABEL                             | ENABLED? | OVERRIDE       
--------------|------|------|-----|---------|-----------------------------------|----------|----------------
1505758907338 | Repo |      |     |         | Default_Organization_Product_Repo | yes      | ak:0, enabled:0
--------------|------|------|-----|---------|-----------------------------------|----------|----------------

>>> an override done by hammer is incomplete (enabled:0/1 is missing) so such override is not put into effect

Comment 4 Lukas Pramuk 2017-09-19 14:26:26 UTC
UI override from comment#2 should be "enabled:0" instead of "ak:0, enabled:0" - mix of CLI+UI overrides

--------------|------|------|-----|---------|-----------------------------------|----------|----------
ID            | NAME | TYPE | URL | GPG KEY | LABEL                             | ENABLED? | OVERRIDE 
--------------|------|------|-----|---------|-----------------------------------|----------|----------
1505758907338 | Repo |      |     |         | Default_Organization_Product_Repo | yes      | enabled:0
--------------|------|------|-----|---------|-----------------------------------|----------|----------


>>> so hammer sets "ak:0/1" (name in lowercease)  vs. webui sets "enabled:0/1" which really works !!!

Comment 5 Brad Buckingham 2017-10-10 12:12:42 UTC
Created redmine issue http://projects.theforeman.org/issues/21275 from this bug

Comment 6 Satellite Program 2017-12-04 21:12:13 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21275 has been resolved.

Comment 7 Lukas Pramuk 2017-12-13 05:40:48 UTC
VERIFIED.

@satellite-6.3.0-22.0.el7sat.noarch
tfm-rubygem-hammer_cli_katello-0.11.3.4-1.el7sat.noarch

by the manual reproducer described in comment#0:

4. Override custom content in AK to disabled (since the default is enabled)
# hammer activation-key content-override --name AK --organization-id 1 --content-label Default_Organization_Product_Repo --value 0
Updated content override

# hammer activation-key product-content --name AK --organization-id 1
--------------|------|------|-----|---------|-----------------------------------|------------------|----------
ID            | NAME | TYPE | URL | GPG KEY | LABEL                             | DEFAULT ENABLED? | OVERRIDE 
--------------|------|------|-----|---------|-----------------------------------|------------------|----------
1513070931633 | Repo |      |     |         | Default_Organization_Product_Repo | yes              | enabled:0
--------------|------|------|-----|---------|-----------------------------------|------------------|----------

>>> UI says correctly "Disabled (overridden)"

5. @client: Register using AK
# subscription-manager register --activationkey AK --org Default_Organization
The system has been registered with ID: 28767822-ac2a-4615-ac49-2e5fa24a1e4f 

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Unable to find available subscriptions for all your installed products.

6. Check repos available
# subscription-manager repos --list
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   Default_Organization_Product_Repo
Repo Name: Repo
Repo URL:  https://<SATFQDN>/pulp/repos/Default_Organization/Library/custom/Product/Repo
Enabled:   0

>>> repo is correctly disabled - content-override done by hammer works

Comment 9 Satellite Program 2018-02-21 16:54:37 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-2018:0336


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