Merge pull request #11832 from amenonsen/zeroforks

Disallow --forks 0
pull/8127/head
James Cammarata 9 years ago
commit 7b9aee7077

@ -186,7 +186,7 @@ class CLI(object):
self.options.become_method = 'su'
def validate_conflicts(self, vault_opts=False, runas_opts=False):
def validate_conflicts(self, vault_opts=False, runas_opts=False, fork_opts=False):
''' check for conflicting options '''
op = self.options
@ -211,6 +211,10 @@ class CLI(object):
"and become arguments ('--become', '--become-user', and '--ask-become-pass')"
" are exclusive of each other")
if fork_opts:
if op.forks < 1:
self.parser.error("The number of processes (--forks) must be >= 1")
@staticmethod
def expand_tilde(option, opt, value, parser):
setattr(parser.values, option.dest, os.path.expanduser(value))

@ -60,7 +60,7 @@ class AdHocCLI(CLI):
raise AnsibleOptionsError("Missing target hosts")
self.display.verbosity = self.options.verbosity
self.validate_conflicts(runas_opts=True, vault_opts=True)
self.validate_conflicts(runas_opts=True, vault_opts=True, fork_opts=True)
return True

@ -76,7 +76,7 @@ class PlaybookCLI(CLI):
raise AnsibleOptionsError("You must specify a playbook file to run")
self.display.verbosity = self.options.verbosity
self.validate_conflicts(runas_opts=True, vault_opts=True)
self.validate_conflicts(runas_opts=True, vault_opts=True, fork_opts=True)
def run(self):

Loading…
Cancel
Save