Don't crash ansible-vault create when no arguments (#68667)

* Don't crash ansible-vault create when no arguments

* Add changelog entry
This commit is contained in:
Sylvia van Os 2020-04-23 21:15:25 +02:00 committed by GitHub
parent 813ea48fcf
commit 3f47610d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- ansible-vault create - Fix exception on no arguments given

View file

@ -424,7 +424,7 @@ class VaultCLI(CLI):
def execute_create(self): def execute_create(self):
''' create and open a file in an editor that will be encrypted with the provided vault secret when closed''' ''' 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") raise AnsibleOptionsError("ansible-vault create can take only one filename argument")
self.editor.create_file(context.CLIARGS['args'][0], self.encrypt_secret, self.editor.create_file(context.CLIARGS['args'][0], self.encrypt_secret,