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

knife vault - TypeError: no implicit conversion of String into Array #219

Closed
4-20ma opened this issue Aug 7, 2016 · 2 comments · Fixed by #352
Closed

knife vault - TypeError: no implicit conversion of String into Array #219

4-20ma opened this issue Aug 7, 2016 · 2 comments · Fixed by #352
Assignees

Comments

@4-20ma
Copy link

4-20ma commented Aug 7, 2016

Firstly, chef-vault is a great tool and works better than my previous method using chef-sugar (another great tool) and encrypted data bag secrets. Thanks for creating it.

I ran into the following error when attempting to create a new vault from the command line (using manage.chef.io). Strangely, I had been able to previously create a vault and successfully edit this vault.

$ knife vault create secrets password
ERROR: TypeError: no implicit conversion of String into Array

Versions

$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

$ knife --version
Chef: 12.9.41

$ gem list chef-vault

*** LOCAL GEMS ***

chef-vault (2.9.0)
chef-vault-testfixtures (0.5.2)

Contents of configuration ~/.chef/config.rb

...
knife[:vault_mode] = 'client'
knife[:vault_admins] = '4-20ma'
...

I finally figured out that knife[:vault_admins] requires an array--not a string. I had been able to create the vault before I added the vault admins to my config and it is not used during a vault edit.

SOLVED: Contents of configuration ~/.chef/config.rb

...
knife[:vault_mode] = 'client'
knife[:vault_admins] = ['4-20ma']
...

This issue has been created partly to document the issue/resolution for others as well as request a change. Is it possible to either create a better warning for this, be more explicit in the documentation, or better yet, accept a string and convert it to an array on-the-fly? If you'd accept a PR for converting on the fly, I'll dig into the code and submit a PR.

@thommay
Copy link
Contributor

thommay commented Apr 10, 2017

Hi, sorry - I missed this issue. Yes, we'd totally accept a PR to convert a string into an Array in that case (or a PR to just make the warning useful)

@dheerajd-msys
Copy link

Yes @thommay It would be better to add a warning rather than converting a string to an Array. Because converting the string to array would lead to handle several scenarios of string inputs and that will add up complexity. We would be coming with a PR for user warnings.

Thanks

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

Successfully merging a pull request may close this issue.

4 participants