sydro / atom-ansible-vault

Atom package to create and modify ansible-vault file
MIT License
32 stars 10 forks source link

0.7.1 doesn't detect ansible.cfg file #35

Closed triplepoint closed 6 years ago

triplepoint commented 6 years ago

Describe the bug A directory structure with an ansible.cfg in the root directory defining a vault password, and vault-encrypted files in a subdirectory, errors with a "No ansible.cfg file found." notification. Prior versions on this same repository worked fine.

To Reproduce Steps to reproduce the behavior:

  1. Have a directory structure with an ansible.cfg file in the root, defining a vault_password_file
  2. open an ecrypted vault file and use the ctrl-alt-0 keybinding to activate this plugin
  3. Observe the red "No ansible.cfg file found" error notification

Expected behavior The file would be decrypted, as before.

Desktop (please complete the following information):

sydro commented 6 years ago

Hi, I can't reproduce the same behavior. With the same configuration, i have this structure

/path_project/

  • ansible.cfg (with vault_password_file variable = test/pass.txt )
  • test/
    • pass.txt
  • vaulted_file.yml

and it works fine.

The ansible.cfg file need to be in root of projects of in some subdirectories.

Can you test it with ansible-vault command without using plugin ?

triplepoint commented 6 years ago

My project structure has the vaulted file deeper in the file structure, like this:

.
├── ansible.cfg
├── .ansible-vault-password
├── inventories
│   ├── production
│       ├── group_vars
│       │   └── all
│       │       ├── vars.vault.yml
│       │       └── some_other_vars.yml
│       └── groups
├── playbooks
│   └── some_project_name.yml
├── roles
       └── {a whole bunch of roles}

my ./ansible.cfg file has content like so:

[defaults]
....
vault_password_file = ./.ansible-vault-password
....

[ssh_connection]
....

If I open, say, ./inventories/production/group_vars/all/vars.vault.yml, and use the ctrl-alt-0 hot key, I get the error notification:

No ansible.cfg file found.
Disable flag in preferencies or add ansible.cfg file

If I check the plugin's configuration:

If I do, from the project root:

ansible-vault view ./inventories/production/group_vars/all/vars.vault.yml

I see the contents of the file, without being prompted for any paswords.

triplepoint commented 6 years ago

Though it's worth noting that the file position doesn't matter, if I copy a vault file to the project root next to the ansible.cfg file, the plugin still fails with the same error.

sydro commented 6 years ago

Hi, thank you for your clarifications, they have been very helpful to find the error. I fixed it, i think that it works again now!

triplepoint commented 6 years ago

Can confirm, the 0.7.3 release solved this issue. Thanks for your work @sydro.