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

Windows: gems do not install on first kitchen run #562

Open
schubfre opened this issue May 2, 2017 · 0 comments
Open

Windows: gems do not install on first kitchen run #562

schubfre opened this issue May 2, 2017 · 0 comments

Comments

@schubfre
Copy link

schubfre commented May 2, 2017

When I try to install gems on a new instance via kitchen converge, the first time I get errors from successing steps, because the log says the gem was installed, but it actually wasn't. If I run it a second time via kitchen converge, it magically installs all dependent gems and the one specified.

Expected Behavior

sensu_gem 'sensu-transport-snssqs' do
version '2.0.4'
action :install
end

Should install all dependencies and the desired gem itself. Independent of the number of times the cookbook ran.

Current Behavior

I, [2017-04-27T08:58:16.813673 #8320] INFO -- default-windows-2012r2: Recipe: monitor::_transport_snssqs
I, [2017-04-27T08:58:16.829299 #8320] INFO -- default-windows-2012r2: * sensu_gem[sensu-transport-snssqs] action install[2017-04-27T06:58:14+00:00] INFO: Processing sensu_gem[sensu-transport-snssqs] action install (monitor::_transport_snssqs line 22)
I, [2017-04-27T08:58:16.829299 #8320] INFO -- default-windows-2012r2: (up to date)
I, [2017-04-27T08:58:16.844923 #8320] INFO -- default-windows-2012r2: * gem_package[sensu-transport-snssqs] action install[2017-04-27T06:58:14+00:00] INFO: Processing gem_package[sensu-transport-snssqs] action install (C:/Users/ADMINI~1/AppData/Local/Temp/kitchen/cache/cookbooks/sensu/providers/gem.rb line 2)
I, [2017-04-27T08:58:24.548652 #8320] INFO -- default-windows-2012r2: [2017-04-27T06:58:23+00:00] INFO: gem_package[sensu-transport-snssqs] installed sensu-transport-snssqs at 2.0.4
I, [2017-04-27T08:58:24.548652 #8320] INFO -- default-windows-2012r2:
I, [2017-04-27T08:58:24.564275 #8320] INFO -- default-windows-2012r2: - install version 2.0.4 of package sensu-transport-snssqs
I, [2017-04-27T08:58:24.564275 #8320] INFO -- default-windows-2012r2: * cookbook_file[C:\opt\sensu\embedded\lib\ruby\gems\2.3.0\gems\sensu-transport-snssqs-2.0.4\lib\sensu\transport\snssqs.rb] action create[2017-04-27T06:58:23+00:00] INFO: Processing cookbook_file[C:\opt\sensu\embedded\lib\ruby\gems\2.3.0\gems\sensu-transport-snssqs-2.0.4\lib\sensu\transport\snssqs.rb] action create (monitor::_transport_snssqs line 35)
I, [2017-04-27T08:58:24.579904 #8320] INFO -- default-windows-2012r2:
I, [2017-04-27T08:58:24.579904 #8320] INFO -- default-windows-2012r2: * Parent directory C:\opt\sensu\embedded\lib\ruby\gems\2.3.0\gems\sensu-transport-snssqs-2.0.4\lib\sensu\transport does not exist.
I, [2017-04-27T08:58:24.595528 #8320] INFO -- default-windows-2012r2: ================================================================================
I, [2017-04-27T08:58:24.611154 #8320] INFO -- default-windows-2012r2: Error executing action create on resource 'cookbook_file[C:\opt\sensu\embedded\lib\ruby\gems\2.3.0\gems\sensu-transport-snssqs-2.0.4\lib\sensu\transport\snssqs.rb]'
I, [2017-04-27T08:58:24.611154 #8320] INFO -- default-windows-2012r2: ================================================================================

When I look in the gem folder, there are no directories for the dependent gems or the actual one.
gem list command also shows it wasn't installed

Possible Solution

Using the following works, but as I want to write it for both Linux and Windows it would be nice if I didn't need to make a case for each family. The --force parameter is especially important, without that it's just the same result. Just like leaving out the binary, then it doesn't work either.

gem_package 'sensu-transport-snssqs' do
gem_binary('C:\opt\sensu\embedded\bin\gem.cmd')
options('--version 2.0.4 --force')
not_if { ::File.exists?('C:\opt\sensu\embedded\lib\ruby\gems\2.3.0\gems\sensu-transport-snssqs-2.0.4\lib\sensu\transport\snssqs.rb') }
end

Steps to Reproduce (for bugs)

  1. Write a cookbook for Windows
  2. Install sensu
  3. Try to install gems

Context

I didn't try this only with the sensu-transport-snssqs gem. I also tried others like aws-sdk and it always works only on the subsequent runs after the first.

Your Environment

  • Version of Sensu used: 4.0.0
  • Version of Chef used: Omnibus 12, Client 8.0.1
  • Operating System and version: Windows Server 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant