Bug 896125

Summary: configure-proxy.sh does not handle appropriately wrong options
Product: Red Hat Satellite Proxy 5 Reporter: Dimitar Yordanov <dyordano>
Component: InstallerAssignee: Michael Mráka <mmraka>
Status: CLOSED CURRENTRELEASE QA Contact: Jiří Mikulka <jmikulka>
Severity: medium Docs Contact:
Priority: medium    
Version: 550CC: cperry, jmikulka, mkorbel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-proxy-installer-1.10.2-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-01 19:40:15 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:
Bug Depends On:    
Bug Blocks: 924174    
Attachments:
Description Flags
Patch - bz896125 none

Description Dimitar Yordanov 2013-01-16 16:51:44 UTC
Description of problem:

In case some of the parameters are wrong configure-proxy.sh just inform the user about this fact but does not exit itself.
 

Version-Release number of selected component (if applicable):
spacewalk-proxy-installer-1.7.6-4

How reproducible:
100 %

Steps to Reproduce:
1. Register EL x86_64 system to Satellite or Hosted
2. Add Tools channel to the system
3. yum -y install spacewalk-proxy-installer
4. configure-proxy.sh --some-bad-option  

Actual results:
#configure-proxy.sh --some-bad-option
Error: Invalid option --some-bad-option
RHN Parent [ibm-hs22-01.rhts.eng.brq.redhat.com]: 
CA Chain [/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT]:


Expected results:

#configure-proxy.sh --some-bad-option
Error: Invalid option --some-bad-option
You may want to try: /usr/sbin/configure-proxy.sh --help


Additional info:

Code base related :
(with possible fix that is commented out and which output is in "Expected results")

while [ $# -ge 1 ]; do
    case $1 in
        --help | -h)  print_help;;
        --answer-file=*) parse_answer_file $1;;
        --non-interactive) INTERACTIVE=0;;
        --version=*) VERSION=$(echo $1 | cut -d= -f2-);;

        ...

        --monitoring-parent=*) MONITORING_PARENT_IP=$(echo $1 | cut -d= -f2-);;
        --monitoring-parent-ip=*) MONITORING_PARENT_IP=$(echo $1 | cut -d= -f2-);;
        --populate-config-channel=*) POPULATE_CONFIG_CHANNEL=$(echo $1 | cut -d= -f2-);;
        --start-services=*) START_SERVICES=$(echo $1 | cut -d= -f2-);;
        *) echo Error: Invalid option $1
           # FIX dyordano
           #echo You may want to try: $0 --help
           #exit      
    esac
    shift
done

Comment 2 Michael Mráka 2013-01-28 15:25:24 UTC
Fixed in spacewalk master by
commit 430faadbe5cd3ff7783782eeaaf117b1c7b61ae2
    896125 - use standard option parser

Comment 4 Dimitar Yordanov 2013-02-05 14:51:23 UTC
Created attachment 693398 [details]
Patch - bz896125

Comment 5 Michael Mráka 2013-03-29 13:58:12 UTC
Fixed in spacewalk master by
commit 265c47f05c1a82cc354908acb41cc40836a9453c
    896125 - fixed configure-proxy.sh help
commit 663e3053f0dec9f531b189b6eb2af0ebda06057d
    896125 - make Y/N values optional
commit f32c64d0e8cfec08dd47f2d127472828ad4c6ec2
    896125 - report extra commandline arguments
commit c7cf84c51d84a28f099bff21e52fa7b99ad98994
    896125 - fail if answer file is not readable

Comment 6 Dimitar Yordanov 2013-03-29 15:39:44 UTC
I think there is one more issue that is not addressed. Please try:
./configure-proxy.sh --traceback-email --use-ssl

Comment 7 Michael Mráka 2013-04-02 06:50:47 UTC
(In reply to comment #6)
> ./configure-proxy.sh --traceback-email --use-ssl

It's not a bug. This is how getopts works - --traceback-email needs argument so it takes '--use-ssl' as an argument. If you want to set an empty traceback email use
 ./configure-proxy.sh --traceback-email= --use-ssl

Comment 8 Michael Mráka 2013-04-03 09:42:17 UTC
Issue from comment #6 fixed in
commit 8c3d36cbe1f9b1bee9cfaa192652f6b87969552c
    896125 - fixed missing arguments issue

Comment 9 Dimitar Yordanov 2013-04-03 11:37:00 UTC
Just one more thing:

        --monitoring-parent) set_value "$1" MONITORING_PARENT_IP "$2"; shift;;
        --monitoring-parent-ip) set_value "$1" MONITORING_PARENT_IP "$2"; shift;;

I think it should be:
        --monitoring-parent) set_value "$1" MONITORING_PARENT "$2"; shift;;

Comment 11 Martin Korbel 2013-09-30 13:59:49 UTC
Stage validated with spacewalk-proxy-installer-2.0.1-2.el6sat.

a)
> configure-proxy.sh
RHN Parent [<fqdn>]:

b)
> configure-proxy.sh --wrong-option
configure-proxy.sh: unrecognized option '--wrong-option'
usage: configure-proxy.sh [options]

c)
> configure-proxy.sh --use-ssl --wrong-option
configure-proxy.sh: unrecognized option '--wrong-option'
usage: configure-proxy.sh [options]

d)
> configure-proxy.sh --answer-file=/tmp/aaaa
Answer file '/tmp/aaaa' is not readable.

e)
> configure-proxy.sh --monitoring-parent-ip
configure-proxy.sh: option '--monitoring-parent-ip' requires an argument
usage: configure-proxy.sh [options]

Comment 12 Clifford Perry 2013-10-01 19:40:15 UTC
Red Hat Satellite Proxy 5.6 has been released. This bug tracked under Proxy. 

This bug either was VERIFIED or RELEASE_PENDING (re-verified prior shortly
before release). 

Moving to CLOSED CURRENT_RELEASE. 

Text from Upgrade Erratum follows:



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.

http://rhn.redhat.com/errata/RHEA-2013-1392.html