Code works with hosted chef but fails on Chef Zero


#1

Hi Everyone,

I’ve been messing around with test kitchen on windows using the windows_chef_zero gem. I’m not sure why the following piece of the recipe fails on chef zero but not hosted chef. It says that it can’t convert nil into String but I can’t see where. Can you help me out?

Thanks,

David

================================================================================
Error executing action run on resource ‘batch[Install Microsoft KB2842230]’

   TypeError

   ---------
   can't convert nil into String

   Resource Declaration:
   ---------------------
   # In C:/Windows/Temp/kitchen/cache/cookbooks/operations/recipes/bootstrap.rb

    63:     batch "Install Microsoft #{kb.chomp('-v2')}" do
    64:       code <<-EOH
    65
   :       dism /Online /add-package /PackagePath:"#{Chef::Config[:file_cache_path]}\\#{kb.chomp('-v2')}\\Windows8-RT-#{kb}-x64.cab" /NoRestart /quiet
    66:       IF %ERRORLEVEL% EQU 3010 SET ERRORLEVEL=0
    67:       EOH
    68:       notifies :request, "windows
   _reboot[60]"
    69:     end
    70:   end

   Compiled Resource:
   ------------------
   # Declared in C:/Windows/Temp/kitchen/cache/cookbooks/operations/recipes/bootstrap.rb:63:in `block in from_file'

   batch("Install Microsoft KB2842230") do
     action "run"

   retries 0
     retry_delay 2
     guard_interpreter :default
     command "Install Microsoft KB2842230"
     backup 5
     returns 0
     code "      dism /Online /add-package /PackagePath:\"C:\\Windows\\Temp\\kitchen\\cache\\KB2842230\\Windows8-RT-KB2842230-x64.cab\"
   /NoRestart /quiet\n      IF %ERRORLEVEL% EQU 3010 SET ERRORLEVEL=0\n"
     interpreter "cmd.exe"
     cookbook_name "operations"
     recipe_name "bootstrap"
   end

CONFIDENTIALITY NOTICE: This electronic mail may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic mail or its contents by persons other than the intended recipient(s) is strictly prohibited. If you have received this communication in error, please notify the sender immediately by reply e-mail so that we may correct our internal records. Please then delete the original message. Thank you.


#2

There should be a line past that where it says it wrote the stack trace to
a file. If you put that file in here, it will be easier for people to help
for sure.

On Tue, Apr 29, 2014 at 6:42 AM, David A. Williams dwilliams@daxko.comwrote:

Hi Everyone,

I’ve been messing around with test kitchen on windows using the
windows_chef_zero gem. I’m not sure why the following piece of the recipe
fails on chef zero but not hosted chef. It says that it can’t convert nil
into String but I can’t see where. Can you help me out?

Thanks,

David

================================================================================
Error executing action run on resource ‘batch[Install Microsoft
KB2842230]’

================================================================================

   TypeError

   ---------
   can't convert nil into String

   Resource Declaration:
   ---------------------
   # In

C:/Windows/Temp/kitchen/cache/cookbooks/operations/recipes/bootstrap.rb

    63:     batch "Install Microsoft #{kb.chomp('-v2')}" do
    64:       code <<-EOH
    65
   :       dism /Online /add-package

/PackagePath:"#{Chef::Config[:file_cache_path]}\#{kb.chomp(’-v2’)}\Windows8-RT-#{kb}-x64.cab"
/NoRestart /quiet
66: IF %ERRORLEVEL% EQU 3010 SET ERRORLEVEL=0
67: EOH
68: notifies :request, "windows
_reboot[60]"
69: end
70: end

   Compiled Resource:
   ------------------
   # Declared in

C:/Windows/Temp/kitchen/cache/cookbooks/operations/recipes/bootstrap.rb:63:in
`block in from_file’

   batch("Install Microsoft KB2842230") do
     action "run"

   retries 0
     retry_delay 2
     guard_interpreter :default
     command "Install Microsoft KB2842230"
     backup 5
     returns 0
     code "      dism /Online /add-package

/PackagePath:“C:\Windows\Temp\kitchen\cache\KB2842230\Windows8-RT-KB2842230-x64.cab”
/NoRestart /quiet\n IF %ERRORLEVEL% EQU 3010 SET
ERRORLEVEL=0\n"
interpreter "cmd.exe"
cookbook_name "operations"
recipe_name "bootstrap"
end


CONFIDENTIALITY NOTICE: This electronic mail may contain information that
is privileged, confidential, and/or otherwise protected from disclosure to
anyone other than its intended recipient(s). Any dissemination or use of
this electronic mail or its contents by persons other than the intended
recipient(s) is strictly prohibited. If you have received this
communication in error, please notify the sender immediately by reply
e-mail so that we may correct our internal records. Please then delete the
original message. Thank you.