Use self.args when we parse arguments that way the arguments can be constructed manually

This commit is contained in:
Toshio Kuratomi 2015-12-06 22:16:31 -08:00
parent 71ffa5abdc
commit 40c01f3739
6 changed files with 6 additions and 6 deletions

View file

@ -70,7 +70,7 @@ class AdHocCLI(CLI):
help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME, help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME,
default=C.DEFAULT_MODULE_NAME) default=C.DEFAULT_MODULE_NAME)
self.options, self.args = self.parser.parse_args() self.options, self.args = self.parser.parse_args(self.args[1:])
if len(self.args) != 1: if len(self.args) != 1:
raise AnsibleOptionsError("Missing target hosts") raise AnsibleOptionsError("Missing target hosts")

View file

@ -62,7 +62,7 @@ class DocCLI(CLI):
self.parser.add_option("-s", "--snippet", action="store_true", default=False, dest='show_snippet', self.parser.add_option("-s", "--snippet", action="store_true", default=False, dest='show_snippet',
help='Show playbook snippet for specified module(s)') help='Show playbook snippet for specified module(s)')
self.options, self.args = self.parser.parse_args() self.options, self.args = self.parser.parse_args(self.args[1:])
display.verbosity = self.options.verbosity display.verbosity = self.options.verbosity
def run(self): def run(self):

View file

@ -113,7 +113,7 @@ class GalaxyCLI(CLI):
help='Force overwriting an existing role') help='Force overwriting an existing role')
# get options, args and galaxy object # get options, args and galaxy object
self.options, self.args =self.parser.parse_args() self.options, self.args =self.parser.parse_args(self.args[1:])
display.verbosity = self.options.verbosity display.verbosity = self.options.verbosity
self.galaxy = Galaxy(self.options) self.galaxy = Galaxy(self.options)

View file

@ -72,7 +72,7 @@ class PlaybookCLI(CLI):
parser.add_option('--start-at-task', dest='start_at_task', parser.add_option('--start-at-task', dest='start_at_task',
help="start the playbook at the task matching this name") help="start the playbook at the task matching this name")
self.options, self.args = parser.parse_args() self.options, self.args = parser.parse_args(self.args[1:])
self.parser = parser self.parser = parser

View file

@ -90,7 +90,7 @@ class PullCLI(CLI):
help='verify GPG signature of checked out commit, if it fails abort running the playbook.' help='verify GPG signature of checked out commit, if it fails abort running the playbook.'
' This needs the corresponding VCS module to support such an operation') ' This needs the corresponding VCS module to support such an operation')
self.options, self.args = self.parser.parse_args() self.options, self.args = self.parser.parse_args(self.args[1:])
if not self.options.dest: if not self.options.dest:
hostname = socket.getfqdn() hostname = socket.getfqdn()

View file

@ -69,7 +69,7 @@ class VaultCLI(CLI):
elif self.action == "rekey": elif self.action == "rekey":
self.parser.set_usage("usage: %prog rekey [options] file_name") self.parser.set_usage("usage: %prog rekey [options] file_name")
self.options, self.args = self.parser.parse_args() self.options, self.args = self.parser.parse_args(self.args[1:])
display.verbosity = self.options.verbosity display.verbosity = self.options.verbosity
can_output = ['encrypt', 'decrypt'] can_output = ['encrypt', 'decrypt']