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

Change default editor for ansible-vault #15577

Closed
pstauffer opened this issue Apr 25, 2016 · 4 comments
Closed

Change default editor for ansible-vault #15577

pstauffer opened this issue Apr 25, 2016 · 4 comments
Assignees
Labels
bug This issue/PR relates to a bug. feature This issue/PR relates to a feature request.

Comments

@pstauffer
Copy link
Contributor

pstauffer commented Apr 25, 2016

ISSUE TYPE
  • Feature Idea
ANSIBLE VERSION
ansible 2.0.2.0
  config file =
  configured module search path = Default w/o overrides
CONFIGURATION

None

OS / ENVIRONMENT

Debian 7.9

SUMMARY

In the vault documentation is the following described:

After providing a password, the tool will launch whatever editor you have defined with $EDITOR, and defaults to vim.

If vim is not installed, the error-message is a little bit tricky to understand.

So is it possible to

  • change the default EDITOR to vi instead of vim. Because vim is not installed on every os distribution.
  • modify the error description with a hint, that the EDITOR wasn't found.
STEPS TO REPRODUCE
ansible-vault create -vvvv test2.yml
ACTUAL RESULTS
No config file found; using defaults
New Vault password:
Confirm New Vault password:
ERROR! Unexpected Exception: [Errno 2] No such file or directory
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/bin/ansible-vault", line 86, in <module>
    sys.exit(cli.run())
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/vault.py", line 120, in run
    self.execute()
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/__init__.py", line 114, in execute
    fn()
  File "/usr/local/lib/python2.7/dist-packages/ansible/cli/vault.py", line 152, in execute_create
    self.editor.create_file(self.args[0])
  File "/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py", line 351, in create_file
    self._edit_file_helper(filename)
  File "/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py", line 302, in _edit_file_helper
    call(self._editor_shell_command(tmp_path))
  File "/usr/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
@alikins alikins self-assigned this Apr 25, 2016
@jtru
Copy link
Contributor

jtru commented May 2, 2016

It's not ansible's fault if your environment is lying about your preferred editor. It'd be wrong to handle this in the application; clearly, the host ansible is being executed on needs fixing here.

@pstauffer
Copy link
Contributor Author

I've never written that it's ansible's fault. It's a feature idea to use vi instead of vim. And Ansible is already handle it in the application with the default editor vim. (see the Ansible vault documentation -> After providing a password, the tool will launch whatever editor you have defined with $EDITOR, and defaults to vim.)

@jtru
Copy link
Contributor

jtru commented May 2, 2016

Oh, I see - sorry, that wasn't clear for me from the initial bug report. In that case, ansible-vault defaulting to vi (since it should be available everywhere where vim is installed, and is also part of LSB and POSIX) sure is the more sensible thing to do.

@bcoca
Copy link
Member

bcoca commented May 2, 2016

closed via 103ca98014da6eff0e18f1da92d54b1633302258

bcoca added a commit that referenced this issue May 2, 2016
@bcoca bcoca closed this as completed May 2, 2016
bcoca added a commit that referenced this issue May 3, 2016
@ansibot ansibot added feature This issue/PR relates to a feature request. bug This issue/PR relates to a bug. and removed feature_idea labels Mar 2, 2018
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. feature This issue/PR relates to a feature request.
Projects
None yet
Development

No branches or pull requests

5 participants