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

Integration with molecule test 'object has no attribute 'code' #72

Closed
snoby opened this issue Mar 23, 2018 · 2 comments
Closed

Integration with molecule test 'object has no attribute 'code' #72

snoby opened this issue Mar 23, 2018 · 2 comments

Comments

@snoby
Copy link

snoby commented Mar 23, 2018

Hi,
I'm certain that I'm doing something wrong...
I'm using Molecule V2 to run on one of my roles inside my playbook. This particular role calls into vault to obtain a value. My issue is that I'm getting a cryptic python error and I'm stuck on where to debug the issue.
In molecule you can create a config file where you can customize certain configs such as a mock up ansible.cfg for example my molecule.yml file looks like this:

---
dependency:
  name: galaxy
driver:
  name: docker
lint:
  name: yamllint
platforms:
  - name: instance
    image: centos:7
provisioner:
  name: ansible
  config_options:
    defaults:
      lookup_plugins : ../../../../../lookup_plugins
  lint:
    name: ansible-lint
scenario:
  name: default
verifier:
  name: testinfra
  lint:
    name: flake8

Now if I do not set the lookup_plugin line above then I get an error that the playbook can't find vault... so I know ansible is able to find the plugin, however I'm getting this error when I run the converge command which is equivalent to running the playbook on just this role:

  TASK [common : Obtain from vault the private ssh key for user ansible] *********
    task path: /Users/snoby/work/Official/tropo-ops-proxy-ansible/roles/common/tasks/main.yml:36
    fatal: [instance]: FAILED! => {
        "msg": "An unhandled exception occurred while running the lookup plugin 'vault'. Error was a <type 'exceptions.AttributeError'>, original message: 'exceptions.AttributeError' object has no attribute 'code'"
    }

It seems like something can't dereference in the path where the code is for the plugin. Any suggestions?

@snoby
Copy link
Author

snoby commented Mar 23, 2018

One additional factoid which may simplify the test here as well. I tried to just run the whole playbook with the vault lookup plugin and I was returned with the same result of:

TASK [common : Obtain from vault the private ssh key for user ansible] *********************************************************************
fatal: [proxy1b.int.tropo.com]: FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'vault'. Error was a <type 'exceptions.AttributeError'>, original message: 'exceptions.AttributeError' object has no attribute 'code'"}

PLAY RECAP *********************************************************************************************************************************

So this has nothing to do with molecule. I install the plugin by making it a git submodule.

@snoby
Copy link
Author

snoby commented Mar 27, 2018

decided to go with hashivault as it works right out of the box...

@snoby snoby closed this as completed Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant