mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
added missing ansibleoptionserror import and moved args check in playbook to after parser exists to allow for creating usage info
This commit is contained in:
parent
d1b4371287
commit
47be5b4166
2 changed files with 5 additions and 4 deletions
|
@ -31,7 +31,7 @@ import subprocess
|
|||
|
||||
from ansible import __version__
|
||||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
from ansible.utils.unicode import to_bytes
|
||||
|
||||
class SortedOptParser(optparse.OptionParser):
|
||||
|
|
|
@ -24,7 +24,7 @@ import sys
|
|||
|
||||
from ansible import constants as C
|
||||
from ansible.cli import CLI
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
from ansible.executor.playbook_executor import PlaybookExecutor
|
||||
from ansible.inventory import Inventory
|
||||
from ansible.parsing import DataLoader
|
||||
|
@ -69,11 +69,12 @@ class PlaybookCLI(CLI):
|
|||
|
||||
self.options, self.args = parser.parse_args()
|
||||
|
||||
if len(self.args) == 0:
|
||||
raise AnsibleOptionsError("You must specify a playbook file to run")
|
||||
|
||||
self.parser = parser
|
||||
|
||||
if len(self.args) == 0:
|
||||
raise AnsibleOptionsError("You must specify a playbook file to run")
|
||||
|
||||
self.display.verbosity = self.options.verbosity
|
||||
self.validate_conflicts()
|
||||
|
||||
|
|
Loading…
Reference in a new issue