diff --git a/changelogs/fragments/68667-dont-crash-ansible-vault-create-when-no-arguments.yaml b/changelogs/fragments/68667-dont-crash-ansible-vault-create-when-no-arguments.yaml new file mode 100644 index 00000000000..e81d5216595 --- /dev/null +++ b/changelogs/fragments/68667-dont-crash-ansible-vault-create-when-no-arguments.yaml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-vault create - Fix exception on no arguments given diff --git a/lib/ansible/cli/vault.py b/lib/ansible/cli/vault.py index 6ea330ab4ef..e80318b70ee 100644 --- a/lib/ansible/cli/vault.py +++ b/lib/ansible/cli/vault.py @@ -424,7 +424,7 @@ class VaultCLI(CLI): def execute_create(self): ''' create and open a file in an editor that will be encrypted with the provided vault secret when closed''' - if len(context.CLIARGS['args']) > 1: + if len(context.CLIARGS['args']) != 1: raise AnsibleOptionsError("ansible-vault create can take only one filename argument") self.editor.create_file(context.CLIARGS['args'][0], self.encrypt_secret,