Project

General

Profile

Bug #27221

Cannot override activation key repository-sets status using hammer

Added by Matthew Smith almost 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Hammer
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

When I try to override any activation key's repository set status to enable or disable using hammer cli there is no change even though there is a message to suggest the update was successful.

Using Katello 3.12 on CentOS 7.6

[root@katello ~]# hammer activation-key product-content --name test --organization-id 1
---|--------------------------------|--------------------------------------------------|------------------|---------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
---|--------------------------------|--------------------------------------------------|------------------|---------
2 | CentOS 7.6.1810 Extras | MNSMITHUK_CentOS_CentOS_7_6_1810_Extras | yes |
1 | CentOS 7.6.1810 OS | MNSMITHUK_CentOS_CentOS_7_6_1810_OS | yes |
3 | CentOS 7.6.1810 Updates | MNSMITHUK_CentOS_CentOS_7_6_1810_Updates | yes |
4 | EPEL 7 | MNSMITHUK_EPEL_EPEL_7 | yes |
8 | Foreman 1.22 Client EL7 | MNSMITHUK_Foreman_Foreman_1_22_Client_EL7 | yes |
7 | Foreman 1.22 EL7 | MNSMITHUK_Foreman_Foreman_1_22_EL7 | yes |
9 | Foreman 1.22 Plugins EL7 | MNSMITHUK_Foreman_Foreman_1_22_Plugins_EL7 | yes |
5 | Puppet 5 EL7 | MNSMITHUK_Puppet_Puppet_5_EL7 | yes |
6 | Puppet 5 EL8 | MNSMITHUK_Puppet_Puppet_5_EL8 | yes |
10 | Rails SCL for Foreman 1.22 EL7 | MNSMITHUK_Foreman_Rails_SCL_for_Foreman_1_22_EL7 | yes |
---|--------------------------------|--------------------------------------------------|------------------|---------
[root@katello ~]# hammer activation-key content-override --name test --content-label "EPEL_7" --value 0 --organization-id 1
Updated content override.
[root@katello ~]# hammer activation-key product-content --name test --organization-id 1
---|--------------------------------|--------------------------------------------------|------------------|---------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
---|--------------------------------|--------------------------------------------------|------------------|---------
2 | CentOS 7.6.1810 Extras | MNSMITHUK_CentOS_CentOS_7_6_1810_Extras | yes |
1 | CentOS 7.6.1810 OS | MNSMITHUK_CentOS_CentOS_7_6_1810_OS | yes |
3 | CentOS 7.6.1810 Updates | MNSMITHUK_CentOS_CentOS_7_6_1810_Updates | yes |
4 | EPEL 7 | MNSMITHUK_EPEL_EPEL_7 | yes |
8 | Foreman 1.22 Client EL7 | MNSMITHUK_Foreman_Foreman_1_22_Client_EL7 | yes |
7 | Foreman 1.22 EL7 | MNSMITHUK_Foreman_Foreman_1_22_EL7 | yes |
9 | Foreman 1.22 Plugins EL7 | MNSMITHUK_Foreman_Foreman_1_22_Plugins_EL7 | yes |
5 | Puppet 5 EL7 | MNSMITHUK_Puppet_Puppet_5_EL7 | yes |
6 | Puppet 5 EL8 | MNSMITHUK_Puppet_Puppet_5_EL8 | yes |
10 | Rails SCL for Foreman 1.22 EL7 | MNSMITHUK_Foreman_Rails_SCL_for_Foreman_1_22_EL7 | yes |
---|--------------------------------|--------------------------------------------------|------------------|---------
[root@katello ~]# hammer activation-key content-override --name test --content-label "EPEL_7" --value 1 --organization-id 1
Updated content override.
[root@katello ~]# hammer activation-key product-content --name test --organization-id 1
---|--------------------------------|--------------------------------------------------|------------------|---------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
---|--------------------------------|--------------------------------------------------|------------------|---------
2 | CentOS 7.6.1810 Extras | MNSMITHUK_CentOS_CentOS_7_6_1810_Extras | yes |
1 | CentOS 7.6.1810 OS | MNSMITHUK_CentOS_CentOS_7_6_1810_OS | yes |
3 | CentOS 7.6.1810 Updates | MNSMITHUK_CentOS_CentOS_7_6_1810_Updates | yes |
4 | EPEL 7 | MNSMITHUK_EPEL_EPEL_7 | yes |
8 | Foreman 1.22 Client EL7 | MNSMITHUK_Foreman_Foreman_1_22_Client_EL7 | yes |
7 | Foreman 1.22 EL7 | MNSMITHUK_Foreman_Foreman_1_22_EL7 | yes |
9 | Foreman 1.22 Plugins EL7 | MNSMITHUK_Foreman_Foreman_1_22_Plugins_EL7 | yes |
5 | Puppet 5 EL7 | MNSMITHUK_Puppet_Puppet_5_EL7 | yes |
6 | Puppet 5 EL8 | MNSMITHUK_Puppet_Puppet_5_EL8 | yes |
10 | Rails SCL for Foreman 1.22 EL7 | MNSMITHUK_Foreman_Rails_SCL_for_Foreman_1_22_EL7 | yes |
---|--------------------------------|--------------------------------------------------|------------------|---------

Extract from production.log

2019-07-03T13:16:02 [I|app|014c85d5] Started PUT "/katello/api/activation_keys/4/content_override" for 192.168.77.5 at 2019-07-03 13:16:02 +0100
2019-07-03T13:16:02 [I|app|014c85d5] Processing by Katello::Api::V2::ActivationKeysController#content_override as JSON
2019-07-03T13:16:02 [I|app|014c85d5] Parameters: {"content_overrides"=>[{"content_label"=>"EPEL_7", "value"=>"[FILTERED]", "name"=>"enabled"}], "api_version"=>"v2", "id"=>"4", "activation_key"=>{}}

.
.
.

2019-07-03T13:16:02 [I|app|014c85d5] Started PUT "/katello/api/activation_keys/4/content_override" for 192.168.77.5 at 2019-07-03 13:16:02 +0100
2019-07-03T13:16:02 [I|app|014c85d5] Processing by Katello::Api::V2::ActivationKeysController#content_override as JSON
2019-07-03T13:16:24 [I|app|66ce16a3] Processing by Katello::Api::V2::ActivationKeysController#content_override as JSON
2019-07-03T13:16:24 [I|app|66ce16a3] Parameters: {"content_overrides"=>[{"content_label"=>"EPEL_7", "value"=>"[FILTERED]", "name"=>"enabled"}], "api_version"=>"v2", "id"=>"4", "activation_key"=>{}}

Associated revisions

Revision fcd47679 (diff)
Added by John Mitsch over 1 year ago

Fixes #27221 - Verify Act Key Content Overrides

This commit add validation that the content label sent with the the content override matches to
an actual label in the organization. Previously, you could submit any label and get a successful
response back, but nothing actually updated. Now, a proper error message should be returned by
the API. Since multiple activation keys can be used on on client, it is best to validate the
label exists in the org rather than just the key.

The 'content_override' param was deprecated previously, but not actually removed (this is whole other
issue with how we handle deprecations). Its removed in this PR

History

#1 Updated by Suraj Patil almost 2 years ago

Hello,

It is working in satellite 6.5 (foreman-1.20.1.34-1.el7sat.noarch). Hammer does not actually update the "Default Enabled?" field rather it adds the entry in the "OVERRIDE" column. Please see the below output.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@satellite64 ]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes |
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]# hammer activation-key content-override --name demo --content-label "RedHat_test-rpm_epel" --value 0 --organization-id 1
Updated content override.
[root@satellite64 ~]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes | enabled:0
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~

#2 Updated by Matthew Smith almost 2 years ago

Thanks Suraj. I do understand that the command should change the override column in the table and glad it is working in Satellite 6.5 for you, however I am just highlighting that I found that it is not working in Katello 3.12.

Suraj Patil wrote:

Hello,

It is working in satellite 6.5 (foreman-1.20.1.34-1.el7sat.noarch). Hammer does not actually update the "Default Enabled?" field rather it adds the entry in the "OVERRIDE" column. Please see the below output.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@satellite64 ]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes |
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]# hammer activation-key content-override --name demo --content-label "RedHat_test-rpm_epel" --value 0 --organization-id 1
Updated content override.
[root@satellite64 ~]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes | enabled:0
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~

#3 Updated by Chris Roberts almost 2 years ago

  • Target version set to Katello 3.13.0
  • Category set to Hammer
  • Project changed from Hammer CLI CSV to Katello

#4 Updated by Chris Roberts almost 2 years ago

  • Triaged changed from No to Yes

#5 Updated by Matthew Smith over 1 year ago

Matthew Smith wrote:

Thanks Suraj. I do understand that the command should change the override column in the table and glad it is working in Satellite 6.5 for you, however I am just highlighting that I found that it is not working in Katello 3.12.

Suraj Patil wrote:

Hello,

It is working in satellite 6.5 (foreman-1.20.1.34-1.el7sat.noarch). Hammer does not actually update the "Default Enabled?" field rather it adds the entry in the "OVERRIDE" column. Please see the below output.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@satellite64 ]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes |
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]# hammer activation-key content-override --name demo --content-label "RedHat_test-rpm_epel" --value 0 --organization-id 1
Updated content override.
[root@satellite64 ~]# hammer activation-key product-content --name demo --organization-id 1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
ID | NAME | LABEL | DEFAULT ENABLED? | OVERRIDE
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
5531 | epel | RedHat_test-rpm_epel | yes | enabled:0
1757 | Red Hat Enterprise Linux 7 Server (Kickstart) | rhel-7-server-kickstart | no |
1756 | Red Hat Enterprise Linux 7 Server (RPMs) | rhel-7-server-rpms | yes |
5100 | Red Hat Enterprise Linux 8 for x86_64 - AppStream (Kickstart) | rhel-8-for-x86_64-appstream-kickstart | no |
5098 | Red Hat Enterprise Linux 8 for x86_64 - BaseOS (Kickstart) | rhel-8-for-x86_64-baseos-kickstart | no |
1942 | Red Hat Satellite Tools 6.4 (for RHEL 7 Server) (RPMs) | rhel-7-server-satellite-tools-6.4-rpms | no | enabled:1
-----|---------------------------------------------------------------|----------------------------------------|------------------|----------
[root@satellite64 ~]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~

I have found the problem. The override is actually working. I had mised off the ORG name and the Product name from the content-label. In my example above the content-label should have been MNSMITHUK_EPEL_EPEL_7 and not just EPEL_7. However I still think this is a bug because an error should have been reported to say the content-label EPEL_7 does not exist rather than the message "Updated content override." that suggests something was updated.

#6 Updated by John Mitsch over 1 year ago

  • Target version changed from Katello 3.13.0 to Katello 3.14.0

#7 Updated by The Foreman Bot over 1 year ago

  • Assignee set to John Mitsch
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/8269 added

#8 Updated by The Foreman Bot over 1 year ago

  • Fixed in Releases Katello 3.14.0 added

#9 Updated by John Mitsch over 1 year ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF