Bug 1454806 - As a user, I want to use hammer to CRUD activation key repository sets.
Summary: As a user, I want to use hammer to CRUD activation key repository sets.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Activation Keys
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Partha Aji
QA Contact: Jonathon Turel
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-23 13:38 UTC by Tom McKay
Modified: 2019-08-12 16:08 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 19636 0 None None None 2017-05-23 13:38:53 UTC

Description Tom McKay 2017-05-23 13:38:51 UTC
With the introduction of #19543, where available repository sets (previously called product content in UI) may be listed for enable/disable through additional options, I want these options available in hammer.

Comment 1 Tom McKay 2017-05-23 13:38:56 UTC
Created from redmine issue http://projects.theforeman.org/issues/19636

Comment 2 Tom McKay 2017-05-23 13:38:59 UTC
Upstream bug assigned to paji

Comment 5 Jonathon Turel 2017-08-09 15:22:42 UTC
Verification failed against Sat 6.3 Snap 9 => satellite-6.3.0-16.0.beta.el7sat.noarch

I was able to CR & U, but no D.

I lost the stack trace - but the issue was related to Foreman::Cast.

Comment 6 Partha Aji 2017-08-10 22:38:15 UTC
Hmm having trouble reproducing this issue. Did you run something like this ?

hammer -rd activation-key content-override --id=5 --content-label=rhel-7-server-kickstart --name=enabled --remove

Comment 7 Partha Aji 2017-08-10 22:44:05 UTC
Here is a good link for different cases.

https://github.com/Katello/hammer-cli-katello/pull/489#issuecomment-289978454

Comment 8 Jonathon Turel 2017-08-11 13:29:58 UTC
Partha,

I think the command was one of:

hammer -v activation-key content-override --content-label=jb-eap-7.0-for-rhel-7-server-rpms --value 0 --id=1 --organization-id=1

hammer -v activation-key content-override --content-label=jb-eap-7.0-for-rhel-7-server-rpms --value false --id=1 --organization-id=1

hammer -v activation-key content-override --content-label=jb-eap-7.0-for-rhel-7-server-rpms --value true --id=1 --organization-id=1


I also found this in my hammer logs:

[ERROR 2017-08-02T19:49:32 API] 500 Internal Server Error
[ERROR 2017-08-02T19:49:32 Exception] uninitialized constant Katello::Foreman::Cast

Sorry - no error from the Rails log. I can try and reproduce later if you still can't.

Comment 9 Partha Aji 2017-08-11 20:50:33 UTC
Hmm cant reproduce this. Going to push it to on_qa . Fail it if you hit this again


root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key product-content   --id=1
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|---------
ID   | NAME                                                 | TYPE | URL | GPG KEY | LABEL                        | ENABLED? | OVERRIDE
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|---------
3822 | Red Hat Enterprise Linux Atomic Host (Trees)         |      |     |         | rhel-atomic-host-ostree      | no       |         
2456 | Red Hat Enterprise Linux 7 Server (RPMs)             |      |     |         | rhel-7-server-rpms           | yes      |         
2396 | Red Hat Enterprise Linux 6 Server - RH Common (RPMs) |      |     |         | rhel-6-server-rh-common-rpms | no       |         
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|---------
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key content-override    --id=1 --content-label=rhel-7-server-rpms --value 0
Updated content override
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key product-content   --id=1
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
ID   | NAME                                                 | TYPE | URL | GPG KEY | LABEL                        | ENABLED? | OVERRIDE 
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
3822 | Red Hat Enterprise Linux Atomic Host (Trees)         |      |     |         | rhel-atomic-host-ostree      | no       |          
2456 | Red Hat Enterprise Linux 7 Server (RPMs)             |      |     |         | rhel-7-server-rpms           | yes      | enabled:0
2396 | Red Hat Enterprise Linux 6 Server - RH Common (RPMs) |      |     |         | rhel-6-server-rh-common-rpms | no       |          
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key content-override    --id=1 --content-label=rhel-7-server-rpms --value false
Updated content override
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key product-content   --id=1
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
ID   | NAME                                                 | TYPE | URL | GPG KEY | LABEL                        | ENABLED? | OVERRIDE 
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
3822 | Red Hat Enterprise Linux Atomic Host (Trees)         |      |     |         | rhel-atomic-host-ostree      | no       |          
2456 | Red Hat Enterprise Linux 7 Server (RPMs)             |      |     |         | rhel-7-server-rpms           | yes      | enabled:0
2396 | Red Hat Enterprise Linux 6 Server - RH Common (RPMs) |      |     |         | rhel-6-server-rh-common-rpms | no       |          
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key content-override    --id=1 --content-label=rhel-7-server-rpms --value true
Updated content override
[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key product-content   --id=1
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
ID   | NAME                                                 | TYPE | URL | GPG KEY | LABEL                        | ENABLED? | OVERRIDE 
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------
3822 | Red Hat Enterprise Linux Atomic Host (Trees)         |      |     |         | rhel-atomic-host-ostree      | no       |          
2456 | Red Hat Enterprise Linux 7 Server (RPMs)             |      |     |         | rhel-7-server-rpms           | yes      | enabled:1
2396 | Red Hat Enterprise Linux 6 Server - RH Common (RPMs) |      |     |         | rhel-6-server-rh-common-rpms | no       |          
-----|------------------------------------------------------|------|-----|---------|------------------------------|----------|----------

Comment 10 Partha Aji 2017-08-11 22:28:12 UTC
I managed to hit this error with this change

"""


[root@sat63qedev ~]# hammer -u admin -p changeme -v activation-key content-override    --id=1 --content-label=rhel-7-server-rpms --remove


[ERROR 2017-08-11 22:24:09 API] 500 Internal Server Error
[ERROR 2017-08-11 22:24:09 Exception] uninitialized constant Katello::Foreman::Cast
Could not update content override:
  uninitialized constant Katello::Foreman::Cast
[ERROR 2017-08-11 22:24:09 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/abstract_response.rb:74:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:352:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:493:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:421:in `block in transmit'
    /opt/rh/rh-ruby23/root/usr/share/ruby/net/http.rb:853:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:413:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:176:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/request.rb:41:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-1.8.0/lib/restclient/resource.rb:76:in `put'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:324:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:240:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.0/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.10.2/lib/hammer_cli_foreman/commands.rb:166:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.10.2/bin/hammer:147:in `<top (required)>'
    /bin/hammer:23:in `load'
    /bin/hammer:23:in `<main>'

"""

Stack trace
"""
2017-08-11 22:24:09 d55ce8d8 [app] [E] NameError: uninitialized constant Katello::Foreman::Cast
 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_hooks-0.3.14/lib/foreman_hooks/as_dependencies_hook.rb:4:in `load_missing_constant'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.4/app/controllers/katello/concerns/api/v2/content_overrides_controller.rb:10:in `validate_content_overrides_enabled'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.4/app/controllers/katello/api/v2/activation_keys_controller.rb:231:in `block in content_override'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.4/app/controllers/katello/api/v2/activation_keys_controller.rb:230:in `map'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.4/app/controllers/katello/api/v2/activation_keys_controller.rb:230:in `content_override'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/action_controller/metal/rendering.rb:10:in `process_action'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'

"""



This has been resolved by https://github.com/Katello/katello/commit/4315142b3941c4ca1d5678012e74f7980073c77e upstream which needs to get in downstream.

Comment 11 Jonathon Turel 2017-09-06 19:18:25 UTC
Verified against Sat 6.3 Snap 14 => satellite-6.3.0-17.0.beta.el7sat.noarch

hammer -u admin -p changeme -v activation-key product-content --id=1 --organization-id=1                                                                                                                                                                
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|---------                                                                                                                                      
ID   | NAME                                                           | TYPE | URL | GPG KEY | LABEL                           | ENABLED? | OVERRIDE                                                                                                                                      
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|---------                                                                                                                                      
2456 | Red Hat Enterprise Linux 7 Server (RPMs)                       |      |     |         | rhel-7-server-rpms              | yes      |                                                                                                                                               
2472 | Red Hat Enterprise Linux 7 Server - RH Common (RPMs)           |      |     |         | rhel-7-server-rh-common-rpms    | no       |                                                                                                                                               
4474 | JBoss Enterprise Application Platform 7 (RHEL 7 Server) (RPMs) |      |     |         | jb-eap-7-for-rhel-7-server-rpms | no       |                                                                                                                                               
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|--------- 

Adding content override:

hammer -u admin -p changeme -v activation-key content-override  --id=1 --content-label=rhel-7-server-rpms --value 1
Updated content override
[vagrant@sat63-qa-rhel7 foreman]$ hammer -u admin -p changeme -v activation-key product-content --id=1 --organization-id=1
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|----------
ID   | NAME                                                           | TYPE | URL | GPG KEY | LABEL                           | ENABLED? | OVERRIDE 
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|----------
2456 | Red Hat Enterprise Linux 7 Server (RPMs)                       |      |     |         | rhel-7-server-rpms              | yes      | enabled:1
2472 | Red Hat Enterprise Linux 7 Server - RH Common (RPMs)           |      |     |         | rhel-7-server-rh-common-rpms    | no       |          
4474 | JBoss Enterprise Application Platform 7 (RHEL 7 Server) (RPMs) |      |     |         | jb-eap-7-for-rhel-7-server-rpms | no       |          
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|----------

Updating:

hammer -u admin -p changeme -v activation-key content-override  --id=1 --content-label=rhel-7-server-rpms --value 0
Updated content override

Removing the override: 

hammer -u admin -p changeme -v activation-key content-override  --id=1 --content-label=rhel-7-server-rpms --remove
Updated content override


Final state:
hammer -u admin -p changeme -v activation-key product-content --id=1 --organization-id=1
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|---------
ID   | NAME                                                           | TYPE | URL | GPG KEY | LABEL                           | ENABLED? | OVERRIDE
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|---------
2456 | Red Hat Enterprise Linux 7 Server (RPMs)                       |      |     |         | rhel-7-server-rpms              | yes      |         
2472 | Red Hat Enterprise Linux 7 Server - RH Common (RPMs)           |      |     |         | rhel-7-server-rh-common-rpms    | no       |         
4474 | JBoss Enterprise Application Platform 7 (RHEL 7 Server) (RPMs) |      |     |         | jb-eap-7-for-rhel-7-server-rpms | no       |         
-----|----------------------------------------------------------------|------|-----|---------|---------------------------------|----------|---------

Comment 13 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.