adambullmer / sublime_ansible_vault

Ansible vault manipulation in Sublime Text
MIT License
6 stars 2 forks source link

Plugin no longer works with ST3, view opens blank file #6

Closed shanedroid closed 6 years ago

shanedroid commented 7 years ago

Plugin does not appear to work at all no matter what troubleshooting steps I take and I can not figure out why in ST3 on OSX. I don't edit ansible vaultsfrequently so I was unsure of what settings or conditions may have changed for me locally since the last time I used the plugin without any issue.

Ansible Vault Plugin
version: 1.0.2

plugin user settings:
{
  "password_file": "/absolute_path_to/vault_password.py"
}

$ which subl && subl --version
subl is /usr/local/bin/subl
Sublime Text Build 3126

which python && python --version
python is /usr/local/opt/python/libexec/bin/python
python is /usr/local/opt/python/libexec/bin/python
python is /usr/local/opt/python/libexec/bin/python
python is /usr/bin/python
Python 2.7.13

$ which ansible && ansible --version
ansible is /usr/local/bin/ansible
ansible 2.3.2.0
  config file = ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jul 18 2017, 09:16:53) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

$ sw_vers
ProductName:  Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G1611

$ uname -a
Darwin SandCrawler 15.6.0 Darwin Kernel Version 15.6.0: Sun Jun  4 21:43:07 PDT 2017; root:xnu-3248.70.3~1/RELEASE_X86_64 x86_64

$ cat /absolute_path_to/ansible.cfg | grep vault
vault_password_file = ./vault_password.py

$ cat /absolute_path_to/vault_password.py
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Set Ansible Vault Password from Env Var"""
import os
print(os.environ['ANSIBLE_VAULT_PASS'])

When attempting to view a vault file, an empty file is opened in a new tab with the correct name but nothing in the file itself. When attempting to decrypt or encrypt a vault file nothing happens.

I have tried specifying a password directly in the plugins settings instead and it had the same results. I also tried using older versions of ansible as well and tried with:

ansible 2.3.1.0
ansible 2.3.0.0_2

I am able to use ansible-vault from the cli ok without any issues. I have never worked on or debugged a sublime text plugin before so I may just be naive, but I see nothing in the sublime console when using the plugin either. I wanted to see if anyone else has had the same issue or at the very least if there is some logging I can enable/view or additional steps I can take to troubleshoot.

adambullmer commented 7 years ago

out of curiosity, i see that your vault file ends in .py. The contents of that file is just a plaintext password, correct?

shanedroid commented 7 years ago

@adambullmer no I am relying on using an env variable:

$ cat /absolute_path_to/vault_password.py
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Set Ansible Vault Password from Env Var"""
import os
print(os.environ['ANSIBLE_VAULT_PASS'])

I had tried setting a plain text file as well and observed the same thing in ST3 using the plugin however. Still the same for me on the latest ST3 for OSX:

$ which subl && subl --version
subl is /usr/local/bin/subl
Sublime Text Build 3143
adambullmer commented 7 years ago

Just cut a release that fixes some view updating issues. Not quite sure if it will also fix your issue. I added an error popup, so if anything isn't working properly, there should at least be some more feedback.

shanedroid commented 6 years ago

Thank you so much @adambullmer ! I really missed using your plugin such a time saver :) Kicking myself for not checking back sooner/ignoring notifications!

Since the update it works perfectly for me!

Just to reiterate my current conf/setup in case this helps with feedback or others:

Ansible Vault Plugin
version: 1.1.1

plugin user settings:
{
  "password_file": "/absolute_path_to/vault_password.py"
}

$ which subl && subl --version
subl is /usr/local/bin/subl
Sublime Text Build 3143

which python && python --version
python is /usr/local/opt/python/libexec/bin/python
python is /usr/bin/python
Python 2.7.14

$ which ansible && ansible --version
ansible is /usr/local/bin/ansible
ansible 2.4.1.0
  config file = ansible.cfg
  configured module search path = Default w/o overrides
  ansible python module location = /usr/local/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Jan  6 2018, 12:12:40) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

$ sw_vers
ProductName:  Mac OS X
ProductVersion: 10.11.6
BuildVersion: 15G18013

$ uname -a
Darwin 15.6.0 Darwin Kernel Version 15.6.0: Mon Nov 13 21:58:35 PST 2017; root:xnu-3248.72.11~1/RELEASE_X86_64 x86_64

$ cat /absolute_path_to/ansible.cfg | grep vault
vault_password_file = ./vault_password.py

$ cat /absolute_path_to/vault_password.py
#!/usr/bin/env python
## -*- coding: utf-8 -*-
"""Set Ansible Vault Password from Env Var"""
import os
print(os.environ['ANSIBLE_VAULT_PASS'])