Bug 786825 - plumage_stats parameter for server raise exception
Summary: plumage_stats parameter for server raise exception
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: condor-plumage
Version: Development
Hardware: All
OS: Linux
medium
medium
Target Milestone: 2.3
: ---
Assignee: Pete MacKinnon
QA Contact: Daniel Horák
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-02 14:00 UTC by Martin Kudlej
Modified: 2013-03-06 18:41 UTC (History)
4 users (show)

Fixed In Version: condor-7.8.2-0.1
Doc Type: Bug Fix
Doc Text:
Cause: Incorrect parsing of server hostname and port arguments. Consequence: TypeError from python when plumage_stats was invoked with a server:port string. Fix: Unnecessary nargs keyword was removed from parser option for mongodb host. Result: plumage_stats correctly parses optional server argument.
Clone Of:
Environment:
Last Closed: 2013-03-06 18:41:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0564 0 normal SHIPPED_LIVE Low: Red Hat Enterprise MRG Grid 2.3 security update 2013-03-06 23:37:09 UTC

Description Martin Kudlej 2012-02-02 14:00:13 UTC
Description of problem:
$ plumage_stats -s "localhost:27017"
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1438, in _process_args
    self._process_short_opts(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1535, in _process_short_opts
    % (opt, nargs))
TypeError: %d format: a number is required, not str
$  condor_config_val -dump | grep ODS_DB_PORT
ODS_DB_PORT = 27017
$  condor_config_val -dump | grep ODS_DB_HOST
ODS_DB_HOST = localhost
$ plumage_stats -s "localhost:27017"
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1438, in _process_args
    self._process_short_opts(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1535, in _process_short_opts
    % (opt, nargs))
TypeError: %d format: a number is required, not str
$ plumage_stats --server="localhost:27017"
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1496, in _process_long_opt
    % (opt, nargs))
TypeError: %d format: a number is required, not str
$ plumage_stats --server="$(hostname):27017"
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1496, in _process_long_opt
    % (opt, nargs))
TypeError: %d format: a number is required, not str
$ plumage_stats --server=$(hostname)
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1496, in _process_long_opt
    % (opt, nargs))
TypeError: %d format: a number is required, not str
$ plumage_stats --server=localhost
Traceback (most recent call last):
  File "/usr/bin/plumage_stats", line 78, in <module>
    (options, args) =  parser.parse_args()
  File "/usr/lib64/python2.6/optparse.py", line 1394, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1434, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib64/python2.6/optparse.py", line 1496, in _process_long_opt
    % (opt, nargs))
TypeError: %d format: a number is required, not str


Version-Release number of selected component (if applicable):
condor-plumage-7.6.5-0.12

How reproducible:
100%

Steps to Reproduce:
1. install and setup condor and ODS
2. plumage_stats -s(or --server=) hostname(:port)
3. it raises exception
  
Actual results:
It raises exception for server parameter.

Expected results:
It will not raise exception. If anything is wrong, it will write message and end with return code>0. It will be able to use server parameter.

Comment 1 Pete MacKinnon 2012-05-02 19:43:16 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: Incorrect parsing of server hostname and port arguments.
Consequence: TypeError from python when plumage_stats was invoked with a server:port string. 
Fix: Unnecessary nargs keyword was removed from parser option for mongodb host.
Result: plumage_stats correctly parses optional server argument.

Comment 4 Daniel Horák 2012-11-15 10:57:29 UTC
Tested and verified on RHEL 6.4 i386/x86_64:

# rpm -qa | grep  condor
  condor-7.8.7-0.4.el6.i686
  condor-plumage-7.8.7-0.4.el6.i686
  condor-classads-7.8.7-0.4.el6.i686


# plumage_stats --rl -s "localhost:27017"
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server="localhost:27017"
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server=localhost
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server="$(hostname):27017"
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server=$(hostname)
  MACHINE
  slot1.com
  slot2.com
  slot3.com

# plumage_stats --rl -s "HOST2.redhat.com:27017"
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server="HOST2.redhat.com:27017"
  MACHINE
  slot1.com
  slot2.com
  slot3.com
# plumage_stats --rl --server=HOST2.redhat.com
  MACHINE
  slot1.com
  slot2.com
  slot3.com

# plumage_stats --rl --server=xyz
  could not find master/primary
# echo $?
  1

# plumage_stats --rl --server="localhost:1234"
  could not find master/primary
# echo $?
  1

# plumage_stats --rl --server=
  empty host (or extra comma in host list)
# echo $?
  1

# plumage_stats --rl --server
  Usage: plumage_stats [options]

  plumage_stats: error: --server option requires an argument
# echo $?
  2

# plumage_stats --rl -s
  Usage: plumage_stats [options]

  plumage_stats: error: -s option requires an argument
# echo $?
  2


It is possible to use -s/--server parameter.
In case of problem, it write error message and exit with return code>0 (without raise exception).

>>> VERIFIED

Comment 6 errata-xmlrpc 2013-03-06 18:41:35 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.

http://rhn.redhat.com/errata/RHSA-2013-0564.html


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