Can't use hash
Closed this issue · 7 comments
I am getting this error:
[2017-04-12T10:30:31-07:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-12T10:30:31-07:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 07 seconds
[2017-04-12T10:30:31-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2017-04-12T10:30:31-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-12T10:30:31-07:00] FATAL: SyntaxError: C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/test/recipes/_vs.rb:33: syntax error, unexpected =>, expecting '}'
...fff45bba7d2b7da09df55d16166" => "http://artifactory.test.net...
Hello @jessepiccolo, thanks for creating this issue.
Could you provide us the code of the recipe defining the ms_dotnet_framework
resource (_vs.rb)?
This seems to me a simple ruby syntax error, easily fixable using parenthesis. Having the code would help :)
@Annih I'm also hit this error.
ms_dotnet_framework '4.5.2' do
include_patches true
perform_reboot true
package_sources { '6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe' }
require_support true
action :install
end
Here is the output from kitchen converge
nstalling Cookbook Gems:
Compiling Cookbooks...
================================================================================
Recipe Compile Error in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb
================================================================================
SyntaxError
-----------
C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb:10: syntax error, unexpected =>, expecting '}'
...721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/M...
... ^
Platform:
---------
i386-mingw32
Running handlers:
[2017-04-13T15:39:55+04:00] ERROR: Running exception handlers
Running handlers complete
[2017-04-13T15:39:55+04:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 seconds
[2017-04-13T15:39:55+04:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
[2017-04-13T15:39:55+04:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-04-13T15:39:55+04:00] FATAL: SyntaxError: C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb:10: syntax error, unexpected =>, expecting '}'
...721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/M...
Here is cookstyle
Inspecting 1 file
E
Offenses:
recipes/v4.rb:10:88: E: unexpected token tASSOC
(Using Ruby 2.1 parser; configure using TargetRubyVersion parameter, under AllCops)
package_sources { '6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe' }
^^
1 file inspected, 1 offense detected
Ok as in #26 this is a ruby syntax error (not related to the cookbook) but I can understand that the README is missleading.
You have to surround the hash with parenthesis, to allow the ruby interpreter to determine that you are passing a Hash and not a block.
@jugatsu could you try with the following syntax:
ms_dotnet_framework '4.5.2' do
include_patches true
perform_reboot true
package_sources('6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe')
require_support true
action :install
end
ms_dotnet_framework '4.5.2' do
include_patches true
perform_reboot true
# package_sources { '6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe' }
package_sources ('6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe')
require_support true
action :install
end
Compiling Cookbooks...
================================================================================
Recipe Compile Error in C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb
================================================================================
SyntaxError
-----------
C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb:13: syntax error, unexpected =>, expecting ')'
...721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/M...
... ^
C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/cookbooks/gf_ms_dotnet/recipes/v4.rb:13: syntax error, unexpected ')', expecting keyword_end
Platform:
---------
i386-mingw32
@jugatsu you added a space between package_sources
and the parenthesis
Can you just copy paste what I gave you ? :)
@Annih sorry :)
Right now it works. Thanks.
ms_dotnet_framework '4.5.2' do
include_patches true
perform_reboot true
package_sources('6c2c589132e830a185c5f40f82042bee3022e721a216680bd9b3995ba86f3781' => 'http://192.168.0.253:8000/Microsoft/dotNet/4.5.2/NDP452-KB2901907-x86-x64-AllOS-ENU.exe')
require_support true
action :install
end