Bug 1249655

Summary: exit code when enabling repository-set changed, message is not that helpful as well
Product: Red Hat Satellite Reporter: Jan Hutař <jhutar>
Component: APIAssignee: Brad Buckingham <bbuckingham>
Status: CLOSED ERRATA QA Contact: Corey Welton <cwelton>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, cwelton, jcallaha, jhutar
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/12525
Whiteboard: FAILEDQA in Upstream
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 08:54:24 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:

Description Jan Hutař 2015-08-03 13:53:12 UTC
Description of problem:
Exit code when enabling repository-set changed, message is not that helpful as well


Version-Release number of selected component (if applicable):
Satellite-6.1.0-RHEL-6-20150721.7-Satellite-x86_64
vs.
Satellite-6.1.0-RHEL-6-20150731.1-Satellite-x86_64


How reproducible:
always


Steps to Reproduce:
1. Attempt to enable repository-set without providing all the substitutions:
   # hammer --username <user> --password <pass> repository-set enable \
     --product-id 6 --id 1952


Actual results:
# hammer --username admin --password changeme repository-set enable --product-id 6 --id 1952
Could not enable repository:
  {} are not valid substitutions for /content/dist/rhel/server/6/$releasever/$basearch/kickstart
# echo $?
65


Expected results:
Error message from hammer from the older compose seems to be more helpful to me:

# hammer --username admin --password changeme repository-set enable --product-id 6 --id 1952
Could not enable repository:
  Missing arguments for 'basearch', 'releasever'
# echo $?
64


Additional info:
Please feel free to close as notabug. I just want to be 100% sure this is intentional.

Comment 2 Brad Buckingham 2015-11-18 19:34:16 UTC
Created redmine issue http://projects.theforeman.org/issues/12525 from this bug

Comment 3 Brad Buckingham 2015-11-18 19:42:53 UTC
Upstream katello PR:

https://github.com/Katello/katello/pull/5606

This issue was introduced when the Docker feature was introduced. Rather than see:
      {} are not valid substitutions for /content/dist/rhel/server/7/$releasever/$basearch/kickstart


The user will now see: 

      Missing arguments releasever, basearch for /content/dist/rhel/server/7/$releasever/$basearch/kickstart

The error code will remain as it was reported, since the detection of the error occurs later in the process.

Comment 4 Bryan Kearney 2015-11-18 21:02:08 UTC
Upstream bug component is Content Management

Comment 5 Bryan Kearney 2015-11-18 23:01:55 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/12525 has been closed
-------------
Brad Buckingham
Applied in changeset commit:katello|9c4e25da5c280cb63f20574329b343064757f1d4.

Comment 6 Bryan Kearney 2015-11-20 16:33:52 UTC
Moving to 6.2 since it will be addressed in the

Comment 7 Tazim Kolhar 2015-12-18 09:35:37 UTC
*** This bug is failing in upstream ****
Version tested:
# rpm -qa | grep foreman
tfm-rubygem-foreman_discovery-4.1.2-1.fm1_11.el7.noarch
tfm-rubygem-foreman_hooks-0.3.9-1.el7.noarch
foreman-debug-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.3-4.el7.noarch
foreman-ovirt-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
foreman-postgresql-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
foreman-release-scl-1-1.el7.x86_64
foreman-vmware-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
tfm-rubygem-foreman_gutterball-0.0.1-3.el7.noarch
foreman-gce-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
dell-per300-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-release-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.8-1.el7.noarch
foreman-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
tfm-rubygem-foreman_docker-1.4.1-2.fm1_10.el7.noarch
foreman-libvirt-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
dell-per300-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
dell-per300-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-2.noarch
tfm-rubygem-hammer_cli_foreman-0.4.0-1.201512101420git81ec371.el7.noarch
foreman-compute-1.11.0-0.develop.201512111432git98f6ca5.el7.noarch
tfm-rubygem-foreman-tasks-0.7.6-1.fm1_10.el7.noarch
foreman-selinux-1.11.0-0.develop.201510071426git6234447.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-3.el7.noarch
tfm-rubygem-foreman_bootdisk-6.0.0-2.fm1_10.el7.noarch
foreman-proxy-1.11.0-0.develop.201512101505git62c9e22.el7.noarch

steps:
# hammer --username admin --password changeme repository-set enable --product-id 2 --id 1450430687170
Could not enable repository:
  undefined method `substitutor' for nil:NilClass

Comment 8 Bryan Kearney 2015-12-18 11:01:52 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/12525 has been closed
-------------
Brad Buckingham
Applied in changeset commit:katello|9c4e25da5c280cb63f20574329b343064757f1d4.

Comment 9 Jan Hutař 2015-12-20 06:29:19 UTC
I guess this was in POST by mistake.

Comment 10 Bryan Kearney 2015-12-20 07:02:14 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/12525 has been closed
-------------
Brad Buckingham
Applied in changeset commit:katello|9c4e25da5c280cb63f20574329b343064757f1d4.

Comment 11 Bryan Kearney 2015-12-21 17:01:46 UTC
Upstream bug component is API

Comment 12 Brad Buckingham 2015-12-22 15:18:06 UTC
Hi Tazim,

Testing this on upstream master/develop, I am not seeing the same issue.

Below is the output attempting to enable the 7Server Kickstart repo as well as 6Server RPM repo.

hammer> repository-set enable --product-id 9 --id 2455
Could not enable repository:
  Missing arguments releasever, basearch for /content/dist/rhel/server/7/$releasever/$basearch/kickstart
hammer> repository-set enable --product-id 9 --id 168
Could not enable repository:
  Missing arguments releasever, basearch for /content/dist/rhel/server/6/$releasever/$basearch/os
hammer> 

If possible, please do provide the following details:
1. the tfm-rubygem-katello rpm version that was under test
2. the product and repo name that you were enabling

Comment 13 Brad Buckingham 2016-02-29 20:26:03 UTC
Tazim,

I am still seeing the behavior described in comment #12; therefore, moving this back to POST.  If you are not seeing the same, please provide the requested details.  Thanks!


hammer> repository-set enable --organization-id 1 --product-id 48 --id 2455
Could not enable repository:
  Missing arguments releasever, basearch for /content/dist/rhel/server/7/$releasever/$basearch/kickstart
hammer> repository-set enable --organization-id 1 --product-id 48 --id 168
Could not enable repository:
  Missing arguments releasever, basearch for /content/dist/rhel/server/6/$releasever/$basearch/os
hammer>

Comment 16 Tazim Kolhar 2016-03-29 15:50:39 UTC
FAILEDQA:
# rpm -qa | grep foreman
tfm-rubygem-hammer_cli_foreman_tasks-0.0.10-2.el7sat.noarch
tfm-rubygem-foreman-tasks-0.7.14.1-1.el7sat.noarch
foreman-libvirt-1.11.0.7-1.el7sat.noarch
tfm-rubygem-foreman_gutterball-0.0.1-6.el7sat.noarch
foreman-discovery-image-3.0.5-3.el7sat.noarch
foreman-selinux-1.11.0-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman-0.5.1.2-1.el7sat.noarch
foreman-gce-1.11.0.7-1.el7sat.noarch
foreman-debug-1.11.0.7-1.el7sat.noarch
tfm-rubygem-foreman_theme_satellite-0.1.3-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-4.el7sat.noarch
foreman-1.11.0.7-1.el7sat.noarch
tfm-rubygem-foreman_bootdisk-6.1.0-1.el7sat.noarch
foreman-postgresql-1.11.0.7-1.el7sat.noarch
amd-ma78gm-01.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
amd-ma78gm-01.rhts.eng.bos.redhat.com-foreman-proxy-1.0-1.noarch
foreman-proxy-1.11.0.2-1.el7sat.noarch
foreman-installer-1.11.0.0-1.el7sat.noarch
foreman-compute-1.11.0.7-1.el7sat.noarch
foreman-ovirt-1.11.0.7-1.el7sat.noarch
tfm-rubygem-foreman-redhat_access-1.0.1-2.el7sat.noarch
tfm-rubygem-foreman_discovery-5.0.0.2-1.el7sat.noarch
foreman-vmware-1.11.0.7-1.el7sat.noarch
foreman-installer-katello-3.0.0.9-1.el7sat.noarch
tfm-rubygem-hammer_cli_foreman_docker-0.0.4-1.el7sat.noarch
tfm-rubygem-foreman_docker-2.0.1.1-1.el7sat.noarch
tfm-rubygem-foreman_hooks-0.3.9-2.el7sat.noarch
amd-ma78gm-01.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
tfm-rubygem-foreman_remote_execution-0.3.0.2-1.el7sat.noarch
tfm-rubygem-foreman_openscap-0.5.3.2-1.el7sat.noarch



# hammer -u admin -p changeme product list --organization-id 1
---|------------------------------------------------------------|-------------|----------------------|--------------|------------------
ID | NAME                                                       | DESCRIPTION | ORGANIZATION         | REPOSITORIES | SYNC STATE       
---|------------------------------------------------------------|-------------|----------------------|--------------|------------------
17 | test_prod5                                                 |             | Default Organization | 1            |                  
15 | test_prod3                                                 |             | Default Organization | 0            |                  
14 | test_prod2                                                 |             | Default Organization | 0            |                  
13 | test_prod                                                  |             | Default Organization | 0            |                  
16 | rhel7                                                      |             | Default Organization | 1            | Syncing Complete.
3  | Red Hat Software Collections for RHEL Server               |             | Default Organization | 0            |                  
11 | Red Hat Software Collections Beta for RHEL Server          |             | Default Organization | 0            |                  
5  | Red Hat Satellite with Embedded Oracle                     |             | Default Organization | 0            |                  
2  | Red Hat Satellite Capsule Beta                             |             | Default Organization | 0            |                  
4  | Red Hat Satellite Capsule                                  |             | Default Organization | 0            |                  
6  | Red Hat Satellite Beta                                     |             | Default Organization | 0            |                  
7  | Red Hat Satellite 6 Beta                                   |             | Default Organization | 0            |                  
10 | Red Hat Satellite                                          |             | Default Organization | 0            |                  
9  | Red Hat Enterprise Linux Server                            |             | Default Organization | 3            | Syncing Complete.
12 | Red Hat Enterprise Linux Load Balancer for RHEL Server     |             | Default Organization | 0            |                  
8  | Red Hat Enterprise Linux High Availability for RHEL Server |             | Default Organization | 0            |                  
1  | Red Hat Beta                                               |             | Default Organization | 0            |                  
---|------------------------------------------------------------|-------------|----------------------|--------------|------------------


# hammer -u admin -p changme repository-set list --organization-id 1 --product-id 10
Invalid username or password
[root@amd-ma78gm-01 ~]# hammer repository-set list --organization-id 1 --product-id 10
[Foreman] Password for admin: 
-----|------|-------------------------------------------------------------------
ID   | TYPE | NAME                                                              
-----|------|-------------------------------------------------------------------
3763 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 6 Server) (Debug RPMs) 
4015 | yum  | Red Hat Satellite 5.7 (for RHEL 6 System Z) (Source RPMs)         
3711 | yum  | Red Hat Satellite 5.6 (for RHEL 5 System Z) (Source RPMs)         
4072 | file | Red Hat Satellite 6.1 (for RHEL 7 Server) (ISOs)                  
3760 | yum  | Red Hat Satellite 6.0 (for RHEL 6 Server) (Debug RPMs)            
3708 | yum  | Red Hat Satellite 5.6 (for RHEL 5 Server) (Source RPMs)           
4074 | yum  | Red Hat Satellite 6.1 (for RHEL 7 Server) (Source RPMs)           
4010 | file | Red Hat Satellite 5.7 (ISOs)                                      
4011 | file | Red Hat Satellite 5.7 (for RHEL 6 System Z) (ISOs)                
3709 | file | Red Hat Satellite 5.6 (for RHEL 5 Server) (ISOs)                  
4012 | yum  | Red Hat Satellite 5.7 (for RHEL 6 Server) (RPMs)                  
3770 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 7 Server) (Debug RPMs) 
4013 | yum  | Red Hat Satellite 5.7 (for RHEL 6 Server) (Source RPMs)           
3758 | yum  | Red Hat Satellite 6.0 (for RHEL 6 Server) (RPMs)                  
4066 | yum  | Red Hat Satellite 6.1 (for RHEL 6 Server) (Debug RPMs)            
3710 | yum  | Red Hat Satellite 5.6 (for RHEL 5 System Z) (RPMs)                
3015 | file | Red Hat Satellite 5.6 (ISOs)                                      
3713 | yum  | Red Hat Satellite 5.6 (for RHEL 6 Server) (RPMs)                  
3765 | yum  | Red Hat Satellite 6.0 (for RHEL 7 Server) (RPMs)                  
4064 | yum  | Red Hat Satellite 6.1 (for RHEL 6 Server) (RPMs)                  
3714 | yum  | Red Hat Satellite 5.6 (for RHEL 6 Server) (Source RPMs)           
3761 | yum  | Red Hat Satellite 6.0 (for RHEL 6 Server) (Source RPMs)           
4071 | yum  | Red Hat Satellite 6.1 (for RHEL 7 Server) (RPMs)                  
3715 | yum  | Red Hat Satellite 5.6 (for RHEL 6 System Z) (RPMs)                
3712 | file | Red Hat Satellite 5.6 (for RHEL 5 System Z) (ISOs)                
4073 | yum  | Red Hat Satellite 6.1 (for RHEL 7 Server) (Debug RPMs)            
3759 | file | Red Hat Satellite 6.0 (for RHEL 6 Server) (ISOs)                  
4065 | file | Red Hat Satellite 6.1 (for RHEL 6 Server) (ISOs)                  
3767 | yum  | Red Hat Satellite 6.0 (for RHEL 7 Server) (Debug RPMs)            
3764 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 6 Server) (Source RPMs)
3769 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 7 Server) (RPMs)       
4067 | yum  | Red Hat Satellite 6.1 (for RHEL 6 Server) (Source RPMs)           
3707 | yum  | Red Hat Satellite 5.6 (for RHEL 5 Server) (RPMs)                  
3771 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 7 Server) (Source RPMs)
3716 | yum  | Red Hat Satellite 5.6 (for RHEL 6 System Z) (Source RPMs)         
4014 | yum  | Red Hat Satellite 5.7 (for RHEL 6 System Z) (RPMs)                
3766 | file | Red Hat Satellite 6.0 (for RHEL 7 Server) (ISOs)                  
3717 | file | Red Hat Satellite 5.6 (for RHEL 6 System Z) (ISOs)                
3768 | yum  | Red Hat Satellite 6.0 (for RHEL 7 Server) (Source RPMs)           
3762 | yum  | Red Hat Satellite 6.0 - Optional (for RHEL 6 Server) (RPMs)       
-----|------|-------------------------------------------------------------------


# hammer repository-set enable --product-id 10 --id 3762
[Foreman] Password for admin: 
Could not enable repository:
  Missing arguments releasever, basearch for /content/dist/rhel/server/6/$releasever/$basearch/satellite-optional/6.0/os

# echo $?
65

Comment 17 Brad Buckingham 2016-03-29 16:30:32 UTC
Tazim,

A return code of 65 is defined as:
  EX_DATAERR      = 65      # data format error

We can attempt to update the result to be 64; however, 65 could also be viewed as appropriate as the format needed for "/content/dist/rhel/server/6/$releasever/$basearch/satellite-optional/6.0/os"  cannot be satisfied.

Also note, that this return code is what was used before the regression (mentioned in comment 3) was introduced.

Comment 18 Corey Welton 2016-03-29 18:14:02 UTC
I agree with Brad.

Jan, is there a reason the exit code should be changed to 64, versus 65?

Comment 22 Tazim Kolhar 2016-04-09 13:11:25 UTC
I agree with you all and moving this BZ to
verified.
thanks

Comment 25 errata-xmlrpc 2016-07-27 08:54:24 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/RHBA-2016:1500