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)
Write a cookbook for Windows
Install sensu
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.
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)
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