mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-06 10:43:14 +00:00
Throw an exception for a missing <file_name> param in ansible-vault
Without this fix you have to enter your vault password before you realize that you forgot to pass in the filename. This commit checks that an filename argument was at least passed on the command line.
This commit is contained in:
@@ -112,7 +112,6 @@ def _read_password(filename):
|
||||
return data
|
||||
|
||||
def execute_create(args, options, parser):
|
||||
|
||||
if len(args) > 1:
|
||||
raise errors.AnsibleError("'create' does not accept more than one filename")
|
||||
|
||||
@@ -204,6 +203,11 @@ def main():
|
||||
parser = build_option_parser(action)
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if not len(args):
|
||||
raise errors.AnsibleError(
|
||||
"The '%s' command requires a filename as the first argument" % action
|
||||
)
|
||||
|
||||
# execute the desired action
|
||||
try:
|
||||
fn = globals()["execute_%s" % action]
|
||||
|
||||
Reference in New Issue
Block a user