mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Handle too many arguments for docs in salt-run. Refs #12261.
This commit is contained in:
parent
f3fa2aef74
commit
b969cd15f7
@ -2119,6 +2119,9 @@ class SaltRunOptionParser(OptionParser, ConfigDirMixIn, MergeConfigMixIn,
|
||||
)
|
||||
|
||||
def _mixin_after_parsed(self):
|
||||
if self.options.doc and len(self.args) > 1:
|
||||
self.error('You can only get documentation for one method at one time')
|
||||
|
||||
if len(self.args) > 0:
|
||||
self.config['fun'] = self.args[0]
|
||||
else:
|
||||
|
@ -46,6 +46,13 @@ class RunTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
|
||||
data = '\n'.join(data)
|
||||
self.assertNotIn('jobs.SaltException:', data)
|
||||
|
||||
def test_salt_documentation_too_many_arguments(self):
|
||||
'''
|
||||
Test to see if passing additional arguments shows an error
|
||||
'''
|
||||
data = self.run_run('-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_7754(self):
|
||||
old_cwd = os.getcwd()
|
||||
config_dir = os.path.join(integration.TMP, 'issue-7754')
|
||||
|
Loading…
Reference in New Issue
Block a user