Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt -v with no additional commands throws traceback #8016

Closed
cachedout opened this Issue Oct 22, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@cachedout
Copy link
Collaborator

cachedout commented Oct 22, 2013

(master_env)root@master:~# /salt_mount/scripts/salt -v
Usage: salt [options] '' [arguments]

Options:
--version show program's version number and exit
--versions-report show program's dependencies version number and exit
-h, --help show this help message and exit
-c CONFIG_DIR, --config-dir=CONFIG_DIR
Pass in an alternative configuration directory.
Default: /etc/salt
-t TIMEOUT, --timeout=TIMEOUT
Change the timeout, if applicable, for the running
command; default=5
-s, --static Return the data from minions as a group after they all
return.
--async Run the salt command but don't wait for a reply
--state-output=STATE_OUTPUT, --state_output=STATE_OUTPUT
Override the configured state_output value for minion
output. Default: full
--subset=SUBSET Execute the routine on a random subset of the targeted
minions. The minions will be verified that they have
the named function before executing
-v, --verbose Turn on command verbosity, display jid and active job
queries
--show-timeout Display minions that timeout
-b BATCH, --batch=BATCH, --batch-size=BATCH
Execute the salt job in batch mode, pass either the
number of minions to batch at a time, or the
percentage of minions to have running
-a EAUTH, --auth=EAUTH, --eauth=EAUTH, --external-auth=EAUTH
Specify an external authentication system to use.
-T, --make-token Generate and save an authentication token for re-use.
Thetoken is generated and made available for the
period defined in the Salt Master.
--return=RETURNER Set an alternative return method. By default salt will
send the return data from the command back to the
master, but the return data can be redirected into any
number of systems, databases or applications.
-d, --doc, --documentation
Return the documentation for the specified module or
for all modules if none are specified.
--args-separator=ARGS_SEPARATOR
Set the special argument used as a delimiter between
command arguments of compound commands. This is useful
when one wants to pass commas as arguments to some of
the commands in a compound command.

Logging Options:
Logging options which override any settings defined on the
configuration files.

-l LOG_LEVEL, --log-level=LOG_LEVEL
                    Console logging log level. One of 'all', 'garbage',
                    'trace', 'debug', 'info', 'warning', 'error', 'quiet'.
                    Default: 'warning'.
--log-file=LOG_FILE
                    Log file path. Default: /var/log/salt/master.
--log-file-level=LOG_LEVEL_LOGFILE
                    Logfile logging log level. One of 'all', 'garbage',
                    'trace', 'debug', 'info', 'warning', 'error', 'quiet'.
                    Default: 'warning'.

Target Options:
Target Selection Options

-E, --pcre          Instead of using shell globs to evaluate the target
                    servers, use pcre regular expressions
-L, --list          Instead of using shell globs to evaluate the target
                    servers, take a comma or space delimited list of
                    servers.
-G, --grain         Instead of using shell globs to evaluate the target
                    use a grain value to identify targets, the syntax for
                    the target is the grain key followed by a
                    globexpression: "os:Arch*"
--grain-pcre        Instead of using shell globs to evaluate the target
                    use a grain value to identify targets, the syntax for
                    the target is the grain key followed by a pcre regular
                    expression: "os:Arch.*"
-N, --nodegroup     Instead of using shell globs to evaluate the target
                    use one of the predefined nodegroups to identify a
                    list of targets.
-R, --range         Instead of using shell globs to evaluate the target
                    use a range expression to identify targets. Range
                    expressions look like %cluster
-C, --compound      The compound target option allows for multiple target
                    types to be evaluated, allowing for greater
                    granularity in target matching. The compound target is
                    space delimited, targets other than globs are preceded
                    with an identifier matching the specific targets
                    argument type: salt 'G@os:RedHat and webser* or
                    E@database.*'
-X, --exsel         Instead of using shell globs use the return code of a
                    function.
-I, --pillar        Instead of using shell globs to evaluate the target
                    use a pillar value to identify targets, the syntax for
                    the target is the pillar key followed by a
                    globexpression: "role:production*"
-S, --ipcidr        Match based on Subnet (CIDR notation) or IPv4 address.

Output Options:
Configure your preferred output format

--out=OUTPUT, --output=OUTPUT
                    Print the output from the 'salt' command using the
                    specified outputter. The builtins are 'no_return',
                    'grains', 'yaml', 'overstatestage', 'json', 'pprint',
                    'nested', 'raw', 'highstate', 'quiet', 'key', 'txt',
                    'virt_query'.
--out-indent=OUTPUT_INDENT, --output-indent=OUTPUT_INDENT
                    Print the output indented by the provided value in
                    spaces. Negative values disables indentation. Only
                    applicable in outputters that support indentation.
--out-file=OUTPUT_FILE, --output-file=OUTPUT_FILE
                    Write the output to the specified file
--no-color, --no-colour
                    Disable all colored output
--force-color, --force-colour
                    Force colored output

You can find additional help about salt issuing "man salt" or on
http://docs.saltstack.org
[ERROR ] list index out of range
Traceback (most recent call last):
File "/salt_mount/salt/utils/parsers.py", line 158, in parse_args
mixin_after_parsed_func(self)
File "/salt_mount/salt/utils/parsers.py", line 1111, in _mixin_after_parsed
self.config['tgt'] = self.args[0]
IndexError: list index out of range
Usage: salt [options] '' [arguments]

salt: error: Error while processing : Traceback (most recent call last):
File "/salt_mount/salt/utils/parsers.py", line 158, in parse_args
mixin_after_parsed_func(self)
File "/salt_mount/salt/utils/parsers.py", line 1111, in _mixin_after_parsed
self.config['tgt'] = self.args[0]
IndexError: list index out of range

@lcosmin

This comment has been minimized.

Copy link

lcosmin commented Nov 21, 2013

Is this fixed in 0.17.2 ?

root@server1 ~ # /usr/bin/salt --version
salt 0.17.2

root@server1 ~ # /usr/bin/salt -G 'roles:upload' -s  -v                                                                                                                                                                                
Usage: salt [options] '<target>' <function> [arguments]

Options:
  --version             show program's version number and exit
...
You can find additional help about salt issuing "man salt" or on http://docs.saltstack.org
[ERROR   ] list index out of range
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/salt/utils/parsers.py", line 158, in parse_args 
    mixin_after_parsed_func(self)
  File "/usr/lib/pymodules/python2.7/salt/utils/parsers.py", line 1130, in _mixin_after_parsed
    if ',' in self.args[1]:
 IndexError: list index out of range
Usage: salt [options] '<target>' <function> [arguments]

salt: error: Error while processing <unbound method SaltCMDOptionParser._mixin_after_parsed>: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/salt/utils/parsers.py", line 158, in parse_args
     mixin_after_parsed_func(self)
  File "/usr/lib/pymodules/python2.7/salt/utils/parsers.py", line 1130, in _mixin_after_parsed
     if ',' in self.args[1]:
IndexError: list index out of range

I just upgraded from 0.16.3, using the debian package from the Launchpad PPA.

root@server1 ~ # apt-cache policy salt-master
salt-master:
  Installed: 0.17.2-2precise1
  Candidate: 0.17.2-2precise1
@basepi

This comment has been minimized.

Copy link
Collaborator

basepi commented Nov 21, 2013

Apparently not. I thought I had cherry-picked this....

@basepi

This comment has been minimized.

Copy link
Collaborator

basepi commented Nov 21, 2013

I just checked, and I cherry-picked that fix. Looks like it wasn't quite complete enough -- I can reproduce with the command you used above.

@cachedout FYI.

@basepi basepi reopened this Nov 21, 2013

thatch45 added a commit that referenced this issue Nov 22, 2013

Merge pull request #8731 from cachedout/#8016
Broader exception handling for invalid options in the salt command.
@cachedout

This comment has been minimized.

Copy link
Collaborator Author

cachedout commented Nov 22, 2013

@lcosmin The above PR should resolve the case that you brought to our attention. I'm going to go ahead and close this and if you see any other cases where this might be an issue, please let us know and we'll happily re-open this again. Thanks for keeping us on top of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.