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

vault: check dir value before passing #43184

Merged
merged 1 commit into from Jul 24, 2018
Merged

Conversation

Akasurde
Copy link
Member

SUMMARY

This fix checks if dirname is not equal to '' before proceeding
to create actual directory with name.

Before fix -

$ ansible-vault create before.yml
New Vault password:
Confirm New Vault password:
 [WARNING]:  does not exist, creating...

After fix -

# ansible-vault create after.yml
New Vault password:
Confirm New Vault password:

Signed-off-by: Abhijeet Kasurde akasurde@redhat.com

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/parsing/vault/init.py

ANSIBLE VERSION
2.7-devel

@Akasurde Akasurde requested a review from mkrizek July 24, 2018 07:28
@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 24, 2018
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Jul 24, 2018
@@ -927,7 +927,7 @@ def create_file(self, filename, secret, vault_id=None):
""" create a new encrypted file """

dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
if dirname != '' and not os.path.exists(dirname):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we do if dirname and not os.path.exists(dirname): instead? Looks nicer I think.

This fix checks if dirname is not equal to '' before proceeding
to create actual directory with name.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jul 24, 2018
@Akasurde
Copy link
Member Author

@mkrizek Can you please take another look ?

@Akasurde Akasurde merged commit 4f1746e into ansible:devel Jul 24, 2018
@Akasurde Akasurde deleted the vault_minor_fix branch July 24, 2018 10:57
@Akasurde
Copy link
Member Author

@mkrizek Thanks for the review.

@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. small_patch support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants