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

nil exception thrown when installing plugins immediately after gauge engine installs in test kitchen #2

Open
galacticgumshoe opened this issue Aug 2, 2016 · 1 comment
Labels

Comments

@galacticgumshoe
Copy link

galacticgumshoe commented Aug 2, 2016

I am trying to include this cookbook inside my test kitchen, which is installing on top of ubuntu15.04 vagrant image. Eventually this would be part of a bootstrap to a ubuntu openstack server so I can run my system tests automated as part of my CICD process. I have added this to my .kitchen.yml to be able to install the 0.6.0 version of gauge:

run_list:
  - recipe[gauge::default]
attributes:
    gauge:
        version: "0.6.0"
        checksum: "507f234e40b5fd6ae2236828a9e353bc9f729808393564da6a92661b7fc0f313"

My metadata.rb includes this:

depends 'gauge'

My recipe.rb includes this:

include_recipe 'gauge'

gauge_plugin 'python' do
    user 'gauge'
    group 'gauge'
    version '0.1.5'
end

Now, when I converge this on a freshly created test kitchen ('kitchen destroy'/'kitchen create'/'kitchen converge') I receive an exception at the point it wants to install the python plugin:

     * gauge_plugin[python] action install

       ================================================================================
       Error executing action `install` on resource 'gauge_plugin[python]'
       ================================================================================

       NoMethodError
       -------------
       undefined method `[]' for nil:NilClass

       Cookbook Trace:
       ---------------
       /tmp/kitchen/cache/cookbooks/gauge/providers/plugin.rb:91:in `shellout_options'
       /tmp/kitchen/cache/cookbooks/gauge/providers/plugin.rb:100:in `existing_plugin_version'
       /tmp/kitchen/cache/cookbooks/gauge/providers/plugin.rb:4:in `block in class_from_file'
       /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

What's strange, is that if I simply re-run 'kitchen converge' it installs the python plugin successfully. The nil is set in the 'existing_plugin_version' method when it can't get the HOME environment variable set properly. So it seems there's a dependency between this cookbook and the step previously that if done in the same pass, results in a failure, but done on separate passes, works great.

@sriv sriv added the bug label Aug 5, 2016
@ketan
Copy link
Collaborator

ketan commented Aug 24, 2016

Are you reloading ohai after creating the gauge user?

user 'gauge' do
  ...
  notifies :reload, 'ohai[reload_passwd]', :immediately
end

ohai 'reload_passwd' do
  action :nothing
  plugin 'etc'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants