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

ansible-vault: 'tuple' object has no attribute 'append' when multiple password files are configured #57172

Closed
Kami-no opened this issue May 30, 2019 · 4 comments · Fixed by #57186
Assignees
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. verified This issue has been verified/reproduced by maintainer

Comments

@Kami-no
Copy link

Kami-no commented May 30, 2019

SUMMARY

Unable to encrypt string.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

vault

ANSIBLE VERSION
ansible 2.8.0
CONFIGURATION
ANSIBLE_PIPELINING(/Users/user/.ansible.cfg) = True
ANSIBLE_SSH_ARGS(/Users/user/.ansible.cfg) = -C -o ControlMaster=auto -o ControlPersist=60s
DEFAULT_GATHER_SUBSET(/Users/user/.ansible.cfg) = ['all', '!ohai', '!hardware']
DEFAULT_LOG_PATH(/Users/user/.ansible.cfg) = /Users/user/Projects/ansible.log
DEFAULT_STDOUT_CALLBACK(/Users/user/.ansible.cfg) = yaml
DEFAULT_VAULT_PASSWORD_FILE(/Users/user/.ansible.cfg) = /Users/user/.ansible/vault
DIFF_ALWAYS(/Users/user/.ansible.cfg) = True
INVENTORY_ENABLED(/Users/user/.ansible.cfg) = ['ini', 'yaml', 'script', 'auto']
RETRY_FILES_ENABLED(/Users/user/.ansible.cfg) = False
OS / ENVIRONMENT

OS X 10.14.5
python version = 3.7.3 (default, Mar 27 2019, 09:23:15) [Clang 10.0.1 (clang-1001.0.46.3)]

STEPS TO REPRODUCE
ansible-vault encrypt_string --vault-password-file a_password_file 'foobar' --name 'the_secret'
EXPECTED RESULTS

encrypted string

ACTUAL RESULTS
ERROR! Unexpected Exception, this is probably a bug: 'tuple' object has no attribute 'append'
to see the full traceback, use -vvv
@ansibot
Copy link
Contributor

ansibot commented May 30, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. labels May 30, 2019
@samdoran
Copy link
Contributor

Verified this affects 2.8 and not earlier versions.

@samdoran samdoran added the verified This issue has been verified/reproduced by maintainer label May 30, 2019
@sivel
Copy link
Member

sivel commented May 30, 2019

The full traceback:

Traceback (most recent call last):
  File "/Users/matt/projects/ansibledev/ansible/bin/ansible-vault", line 110, in <module>
    exit_code = cli.run()
  File "/Users/matt/projects/ansibledev/ansible/lib/ansible/cli/vault.py", line 181, in run
    create_new_password=True)
  File "/Users/matt/projects/ansibledev/ansible/lib/ansible/cli/__init__.py", line 176, in setup_vault_secrets
    vault_password_files.append(C.DEFAULT_VAULT_PASSWORD_FILE)
AttributeError: 'tuple' object has no attribute 'append'

To clarify, this happens when there is a config/env already specifying the vault password file, and then another is specified from the CLI.

@samdoran
Copy link
Contributor

samdoran commented May 30, 2019

I was just about to add that. 😄

I've been going through the tests trying to figure out why this wasn't failing. That would be the reason.

@samdoran samdoran changed the title 'tuple' object has no attribute 'append' ansible-vault: 'tuple' object has no attribute 'append' when multiple password files are configured May 30, 2019
@goneri goneri removed the needs_triage Needs a first human triage before being processed. label May 30, 2019
@samdoran samdoran added the has_pr This issue has an associated PR. label May 30, 2019
@ansible ansible locked and limited conversation to collaborators Aug 5, 2019
amfranz added a commit to updox/ansible that referenced this issue Nov 16, 2020
This is a backport of ansible#57186
which fixes ansible#57172.

The issue is that when ansible-vault is called when a vault password file is set
in the configuration file _and_ a vault password file is set via command line
argument, it fails with the error message "'tuple' object has no attribute
'append'". This affects some editors with Ansible integration that always pass
the vault password file via command line argument when calling ansible-vault
(eg. Emacs).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. traceback This issue/PR includes a traceback. verified This issue has been verified/reproduced by maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants