Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- ansible-vault create - Fix exception on no arguments given
2 changes: 1 addition & 1 deletion lib/ansible/cli/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def execute_decrypt(self):
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,
Expand Down