Bug 1655239 - Could not enable redhat repository using hammer cli
Summary: Could not enable redhat repository using hammer cli
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Repositories
Version: 6.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
high vote
Target Milestone: Released
Assignee: Andrew Kofink
QA Contact: Nikhil Kathole
URL:
Whiteboard:
: 1655970 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-12-01 19:25 UTC by Nikhil Kathole
Modified: 2019-10-07 17:13 UTC (History)
7 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_katello-0.16.0.2-1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:39:19 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:39:27 UTC
Foreman Issue Tracker 25628 None None None 2018-12-04 23:02:54 UTC

Description Nikhil Kathole 2018-12-01 19:25:41 UTC
Description of problem:

Trying to enable repository using cli gives error

# hammer repository-set enable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"
Could not enable repository:
  One of parameters [ organization_id ] required but not specified.


Version-Release number of selected component (if applicable):
Satellite 6.5 snap 6


How reproducible: always


Steps to Reproduce:
1. hammer repository-set enable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"


Actual results: Error Could not enable repository:
  One of parameters [ organization_id ] required but not specified.

though organization-id is passed and production.log showed

2018-12-01T14:24:25 [I|app|] Started GET "/katello/api/organizations/1/products?name=Red+Hat+Enterprise+Linux+Server" for IP at 2018-12-01 14:24:25 -0500
2018-12-01T14:24:25 [I|app|1f209] Processing by Katello::Api::V2::ProductsController#index as JSON
2018-12-01T14:24:25 [I|app|1f209]   Parameters: {"name"=>"Red Hat Enterprise Linux Server", "api_version"=>"v2", "organization_id"=>"1", "product"=>{}}
2018-12-01T14:24:25 [I|app|1f209] Authorized user admin(Admin User)
2018-12-01T14:24:25 [I|app|1f209] Current user set to admin (admin)
2018-12-01T14:24:25 [I|app|1f209]   Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.rc1/app/views/katello/api/v2/products/index.json.rabl within katello/api/v2/layouts/collection
2018-12-01T14:24:25 [I|app|1f209]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.rc1/app/views/katello/api/v2/products/index.json.rabl within katello/api/v2/layouts/collection (47.6ms)
2018-12-01T14:24:25 [I|app|1f209] Completed 200 OK in 83ms (Views: 43.3ms | ActiveRecord: 15.9ms)
2018-12-01T14:24:25 [I|app|] Started GET "/katello/api/repository_sets?name=Red+Hat+Enterprise+Linux+7+Server+%28RPMs%29" for IP at 2018-12-01 14:24:25 -0500
2018-12-01T14:24:25 [I|app|f7910] Processing by Katello::Api::V2::RepositorySetsController#index as JSON
2018-12-01T14:24:25 [I|app|f7910]   Parameters: {"name"=>"Red Hat Enterprise Linux 7 Server (RPMs)", "api_version"=>"v2", "repository_set"=>{}}
2018-12-01T14:24:25 [I|app|f7910] Authorized user admin(Admin User)
2018-12-01T14:24:25 [I|app|f7910] Current user set to admin (admin)
2018-12-01T14:24:25 [E|app|f7910] Katello::HttpErrors::NotFound: One of parameters [ organization_id ] required but not specified.
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.rc1/app/controllers/katello/api/v2/api_controller.rb:135:in `find_organization'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.rc1/app/controllers/katello/api/v2/repository_sets_controller.rb:138:in `find_product_or_organization'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:426:in `block in make_lambda'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:199:in `block in halting'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `block in invoke_before'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:513:in `invoke_before'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:107:in `block in run_callbacks'
/usr/share/foreman/app/controllers/api/v2/base_controller.rb:163:in `disable_json_root'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/share/foreman/app/controllers/concerns/application_shared.rb:15:in `set_timezone'



Expected results: repository should enable. 


Additional info:

Comment 5 Nikhil Kathole 2018-12-04 10:57:08 UTC
*** Bug 1655970 has been marked as a duplicate of this bug. ***

Comment 6 Partha Aji 2018-12-04 22:11:44 UTC
I am unable to reproduce this on my instance

Question for for Nikhil
I see that while your hammer call asked for -> "Red Hat Enterprise Linux 7 Server (Kickstart)" 

 hammer repository-set enable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"

I see that the error showed up for "Red Hat Enterprise Linux 7 Server (RPMs)"

2018-12-01T14:24:25 [I|app|] Started GET "/katello/api/repository_sets?name=Red+Hat+Enterprise+Linux+7+Server+%28RPMs%29" for IP at 2018-12-01 14:24:25 -0500

Wondering the log pasted corresponded to this hammer call. 
Can you also provide us the output of 

 hammer -vd repository-set enable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"

If you have the machine where this is reproducible that would be great too.

Comment 7 Andrew Kofink 2018-12-04 23:02:53 UTC
Created redmine issue https://projects.theforeman.org/issues/25628 from this bug

Comment 12 vijsingh 2019-01-21 06:43:10 UTC
Verified:

@Satellite 6.5.0 Snap 12.0

Steps:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[root@satellite6 ~]# rpm -qa satellite katello foreman pulp-server tfm-rubygem-hammer_cli_foreman
tfm-rubygem-hammer_cli_foreman-0.15.1-1.el7sat.noarch
pulp-server-2.18.0-0.1.rc.el7sat.noarch
foreman-1.20.1.7-1.el7sat.noarch
satellite-6.5.0-5.beta.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch

[root@satellite6 ~]# hammer repository-set enable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"
Repository enabled.

[root@satellite6 ~]# hammer repository-set list --enabled yes --organization-id="1"
-----|-----------|----------------------------------------------
ID   | TYPE      | NAME                                         
-----|-----------|----------------------------------------------
2455 | kickstart | Red Hat Enterprise Linux 7 Server (Kickstart)
-----|-----------|----------------------------------------------

[root@satellite6 ~]# hammer repository-set disable --name="Red Hat Enterprise Linux 7 Server (Kickstart)" --basearch="x86_64" --releasever="7.5" --product "Red Hat Enterprise Linux Server" --organization-id="1"
Repository disabled.

[root@satellite6 ~]# hammer repository-set list --enabled yes --organization-id="1"
---|------|-----
ID | TYPE | NAME
---|------|-----
[root@satellite6 ~]#
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Observation:

 - Able to enable the repository using hammer repository-set.
 - Able to disable the repository using hammer repository-set.

Comment 15 errata-xmlrpc 2019-05-14 12:39:19 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-2019:1222


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