Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Hashie Error in ChefDK 1.2.22 #1157

Closed
damacus opened this issue Feb 5, 2017 · 10 comments
Closed

Hashie Error in ChefDK 1.2.22 #1157

damacus opened this issue Feb 5, 2017 · 10 comments

Comments

@damacus
Copy link

damacus commented Feb 5, 2017

Description

Hashie Error in ChefDK 1.2.22

W, [2017-02-05T12:36:43.953659 #5597]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-05T12:36:43.953841 #5597]  WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-05T12:36:43.953988 #5597]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-05T12:36:43.954132 #5597]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-05T12:36:43.959371 #5597]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-02-05T12:36:43.959530 #5597]  WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.

See Travis jobs run since ChefDK 1.2.22 came out.
https://travis-ci.org/sous-chefs/samba/jobs/198444465
https://travis-ci.org/sous-chefs/haproxy/jobs/198174545

I get the same errors running from my laptop.
Update:
I've updated my local machine to use 1.3.6, and the error is still occurring

ChefDK Version

1.2.22

Platform Version

OSX 10.12.3
Travis

Replication Case

Install chefdk 1.2.22 and run a kitchen command

@cheeseplus
Copy link
Contributor

It's an issue that Berkshelf pulls in - berkshelf/berkshelf#1668

@damacus
Copy link
Author

damacus commented Feb 5, 2017

berkshelf/berkshelf#1665

Duplicate of #1155

@damacus
Copy link
Author

damacus commented Feb 5, 2017

Work around until Berks 5.6.1 is part of ChefDK.
chef gem install berkshelf

@lamont-granquist
Copy link
Contributor

closing as dup

tkalus added a commit to NunaInc/harden_macos that referenced this issue Mar 2, 2017
- Add Travis CI Build Status Icon
- Add .ruby-version file (2.2)
- Add cross-platform user-detection for Travis CI testing in Linux
- Work around for a berkshelf-related issue:
    chef-boneyard/chef-dk#1157
tkalus added a commit to NunaInc/harden_macos that referenced this issue Mar 3, 2017
- Add Travis CI Build Status Icon
- Add .ruby-version file (2.2)
- Add cross-platform user-detection for Travis CI testing in Linux
- Work around for a berkshelf-related issue:
    chef-boneyard/chef-dk#1157
@fernandoaleman
Copy link

@damacus I just tried running chef gem install berkshelf but I still get the Hashie errors above. Is this still working for you?

@sarkis
Copy link

sarkis commented Mar 9, 2017

@fernandoaleman the problem is when you run chef gem install berkshelf it puts the binary here: /opt/chefdk/embedded/bin/ or $HOME/.chefdk/gem/ruby/2.3.0/bin.

If you run a which berks and berks -v you will see that you are still running 5.6.0. You will need to make sure that berks is evaluated to the one installed via chef gem - so either alias it or add to your PATH.

I work around the above by setting the following in my $PATH in bash_profile:

$HOME/.chefdk/gem/ruby/2.3.0/bin

This will ensure that anytime I run a gem binary it will first use the ones installed via chefdk (NOTE: this may not be something you always want - so be aware)

@fernandoaleman
Copy link

@sarkis Thank you very much for the help. That worked perfectly. 👍

@sarkis
Copy link

sarkis commented Mar 10, 2017

@fernandoaleman the only catch with my solution is that later versions of chefdk will likely use a different ruby version - so I have to from time to time go in and change 2.3.0 to the proper ruby version of the new chefdk.

I just changed my PATH to use /opt/chefdk/embedded/bin as there is the right version of berks in there and there is less chance that this directory will change on upgrade. Hopefully someone here will see this and correct me if I am doing something stupid here 😄

@Mister-Meeseeks
Copy link

Mister-Meeseeks commented Mar 15, 2017

@sarkis 's solution wasn't working for me. I kept getting errors reading find_spec_for_exe': can't find gem berkshelf (>= 0.a) (Gem::GemNotFoundException).

Here's an alternative solution that worked for me, in case anyone runs into the same problem:

  1. If you tried the previous solution, remove $HOME/.chefdk/gem/ruby/2.3.0/bin from your path.
  2. sudo chef gem uninstall berkshelf (This removes berkshelf from /opt/chef). If prompted with multiple versions remove them all.
  3. sudo chef gem install berkshelf (This install berkshelf to /opt/chef).
  4. Fire up your favorite editor and open /opt/chef/Gemfile. Fine and replace all instances of 5.6.0 with 5.6.4
  5. Do the same with /opt/chef/bin/berks

That should completely replace 5.6.0 Berkshelf with 5.6.4 in your /opt/chef/ directory.

@tastycheesewhiz
Copy link

tastycheesewhiz commented Jun 5, 2017

yea, I'm still having this problem with chefdk -

laptop:devops$ knife node list
W, [2017-06-05T10:19:21.932077 #15679] WARN -- : You are setting a key that conflicts with a built-in method Hashie::Mash#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-06-05T10:19:21.932217 #15679] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-06-05T10:19:21.932248 #15679] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#frozen? defined in Kernel. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-06-05T10:19:21.937688 #15679] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
W, [2017-06-05T10:19:21.937752 #15679] WARN -- : You are setting a key that conflicts with a built-in method VariaModel::Attributes#default defined in Hash. This can cause unexpected behavior when accessing the key via as a property. You can still access the key via the #[] method.
node-name-here

laptop:devops$ knife -v
Chef: 12.19.36
laptop:devops$ chef -v
Chef Development Kit Version: 1.4.3
chef-client version: 12.19.36
delivery version: master (41b94ffb5efd33723cf72a89bf4d273c8151c9dc)
berks version: 5.6.4
kitchen version: 1.16.0
inspec version: 1.25.1

@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

7 participants