mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Handle too many arguments for docs in salt-call. Refs #12261.
This commit is contained in:
parent
762d0b1e24
commit
f3fa2aef74
2 changed files with 11 additions and 2 deletions
|
@ -2044,8 +2044,7 @@ class SaltCallOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
|
|||
)
|
||||
|
||||
def _mixin_after_parsed(self):
|
||||
if not self.args and not self.options.grains_run \
|
||||
and not self.options.doc:
|
||||
if not self.args and not self.options.grains_run and not self.options.doc:
|
||||
self.print_help()
|
||||
self.exit(1)
|
||||
|
||||
|
@ -2053,6 +2052,9 @@ class SaltCallOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
|
|||
if self.options.grains_run:
|
||||
self.error('-g/--grains does not accept any arguments')
|
||||
|
||||
if self.options.doc and len(self.args) > 1:
|
||||
self.error('You can only get documentation for one method at one time')
|
||||
|
||||
self.config['fun'] = self.args[0]
|
||||
self.config['arg'] = self.args[1:]
|
||||
|
||||
|
|
|
@ -58,6 +58,13 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
|
|||
''.join(ret)
|
||||
)
|
||||
|
||||
def test_salt_documentation_too_many_arguments(self):
|
||||
'''
|
||||
Test to see if passing additional arguments shows an error
|
||||
'''
|
||||
data = self.run_call('-d salt ldap.search "filter=ou=People"', catch_stderr=True)
|
||||
self.assertIn('You can only get documentation for one method at one time', '\n'.join(data[1]))
|
||||
|
||||
def test_issue_6973_state_highstate_exit_code(self):
|
||||
'''
|
||||
If there is no tops/master_tops or state file matches
|
||||
|
|
Loading…
Add table
Reference in a new issue