Bug 2119117

Summary: ACS create fails when --smart-proxy-ids option not passed with "undefined method `uniq' for nil:NilClass"
Product: Red Hat Satellite Reporter: Gaurav Talreja <gtalreja>
Component: Alternate Content SourcesAssignee: Chris Roberts <chrobert>
Status: CLOSED ERRATA QA Contact: Gaurav Talreja <gtalreja>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.12.0CC: chrobert, iballou, pcreech
Target Milestone: 6.12.0Keywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-4.5.0.14-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 13:35:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gaurav Talreja 2022-08-17 15:09:56 UTC
Description of problem:


Version-Release number of selected component (if applicable):
Satellite 6.12.0 Snap 6.1

How reproducible:
Always

Steps to Reproduce:
1. Enable ACS lab feature
2. # hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333 --subpaths fake_yum0/
Could not create the Alternate Content Source.:
  undefined method `uniq' for nil:NilClass

3. # hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333 --subpaths fake_yum0/ --smart-proxy-ids 1
Alternate Content Source created.

Actual results:
Could not create the Alternate Content Source.:
  undefined method `uniq' for nil:NilClass

Expected results:
An error like "Missing arguments for '--smart-proxy-ids'" or take satellite as default

Additional info:

Comment 1 Ian Ballou 2022-08-17 16:22:07 UTC
This is fixed upstream in code that I believe is not back-portable to 6.12 (it was included in further feature completion): https://github.com/Katello/katello/blame/master/app/lib/actions/katello/alternate_content_source/create.rb#L11

Comment 2 Brad Buckingham 2022-08-18 14:12:51 UTC
Is --smart-proxy-ids a required parameter for the create command?

If the mentioned fix is not backportable for 6.12, can the error behavior be improved?

Comment 3 Ian Ballou 2022-08-30 13:38:53 UTC
--smart-proxy-ids is not specifically required.  The error could be dealt with by applying the code that I linked in comment 1.

Comment 4 Chris Roberts 2022-08-30 14:46:52 UTC
Tested this on my devel box and it works correctly:

[vagrant@centos7-hammer-devel hammer-cli-foreman]$ hammer alternate-content-source create --name test_repo_acs --base-url http://reposerver.example.com:33333 --subpaths fake_yum0/
Alternate Content Source created.

Since this is not backportable to 6.12 I say we push this to 6.13? Removing the Triage word for Brad to decide what to do.

Comment 5 Ian Ballou 2022-08-30 14:50:34 UTC
I'd vote for a fix that's applied only to Katello 4.5 and downstream.  It should be pretty small, perhaps only one line.

Comment 6 Chris Roberts 2022-08-31 21:34:17 UTC
Thats fair, I will submit a MR downstream for 6.12

Setting 6.12 flags for BZ triage team

Comment 8 Gaurav Talreja 2022-09-27 15:42:02 UTC
Hi Ian/Chris, 

Using Snap 12, the mentioned command works with and without the --smart-proxy-ids option, however, no capsule is assigned to ACS in the case of no --smart-proxy-ids option. Is this expected behaviour?

Also same goes for capsule selection in the ACS create wizard in UI, or shouldn't it be Satellite by default?


Thanks,
Gaurav

Comment 9 Ian Ballou 2022-09-27 16:47:51 UTC
Hey Gaurav,

For Satellite 6.12, it's okay to have ACSs that don't have smart proxies.

We wouldn't want a default because a user might unwittingly create an ACS that affects their library repositories.

Comment 10 Gaurav Talreja 2022-09-27 20:51:50 UTC
Ian, Thanks for the confirmation, I'll move this BZ to VERIFIED.

Comment 14 errata-xmlrpc 2022-11-16 13:35:21 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 (Important: Satellite 6.12 Release), 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-2022:8506