Handle too many arguments for docs in salt-run. Refs #12261.

This commit is contained in:
Pedro Algarvio 2014-04-24 16:01:25 +01:00
parent f3fa2aef74
commit b969cd15f7
2 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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')