sous-chefs/rvm

cannot load such file -- chef/mixin/command

zl4bv opened this issue · 6 comments

zl4bv commented
================================================================================
Recipe Compile Error in /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb
================================================================================

LoadError
---------
cannot load such file -- chef/mixin/command

Cookbook Trace:
---------------
  /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:22:in `<top (required)>'

Relevant File Content:
----------------------
/tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:

 15:  # Unless required by applicable law or agreed to in writing, software
 16:  # distributed under the License is distributed on an "AS IS" BASIS,
 17:  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 18:  # See the License for the specific language governing permissions and
 19:  # limitations under the License.
 20:  #
 21:
 22>> require 'chef/mixin/command'
 23:
 24:  class Chef
 25:    module RVM
 26:      module ShellHelpers
 27:        # stub to satisfy StringCache (library load order not guarenteed)
 28:      end
 29:
 30:      class StringCache
 31:        class << self

System Info:
------------
chef_version=13.0.118
platform=ubuntu
platform_version=16.04
ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
program_name=chef-client worker: ppid=1772;start=02:58:05;
executable=/opt/chef/bin/chef-client

This was with rvm cookbook version 0.9.4.

The mixin was removed in chef/chef@9c0a6a3 which was released in Chef version 13.0.84.

the replacement for this is mixlib::shellout or chef::mixin::shellout which is a wrapper for mixlib::shellout.
unfortunately, these don't allow you to explicitly declare what shell to use so conversion is not simple.

for commands that require a bash shell, the solution right now would be either:

shell_out("bash -c \"some command\"")
or
shell_out("absolute_path_to_script")
where the script has a shebang that declares the shell

The issue is still happening with the recent unreleased version of the rvm cookbook. Leaving this post so the issue remains active.

rvm cookbook version 0.10.1
Chef version 13.2.20

================================================================================
       Recipe Compile Error in /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb
       ================================================================================

       LoadError
       ---------
       cannot load such file -- chef/mixin/command

       Cookbook Trace:
       ---------------
         /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:22:in `<top (required)>'

       Relevant File Content:
       ----------------------
       /tmp/kitchen/cache/cookbooks/rvm/libraries/chef_rvm_string_cache.rb:

        15:  # Unless required by applicable law or agreed to in writing, software
        16:  # distributed under the License is distributed on an "AS IS" BASIS,
        17:  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        18:  # See the License for the specific language governing permissions and
        19:  # limitations under the License.
        20:  #
        21:
        22>> require 'chef/mixin/command'
        23:
        24:  class Chef
        25:    module RVM
        26:      module ShellHelpers
        27:        # stub to satisfy StringCache (library load order not guarenteed)
        28:      end
        29:
        30:      class StringCache
        31:        class << self

       System Info:
       ------------
       chef_version=13.2.20
       platform=ubuntu
       platform_version=14.04
       ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
       program_name=chef-client worker: ppid=2303;start=22:56:10;
       executable=/opt/chef/bin/chef-client

Verified bug is still present in 0.10.1 with commit d522bc2 from latest master.

Tested with Chef: 13.4.19

yi-le commented

Same problem, but It will work with Chef: 12.x.x and cookbook version 0.9.4.

zl4bv commented

I spoke to @martinisoft at ChefConf earlier this year and it's likely this issue will only get fixed if someone else is willing to lend a hand. Meanwhile, I'm going to close this issue.

lock commented

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.