0
votes

I use knife bootstrap on windows 2008 x86 server is silent fail. It created windows batch file, but the batch file not executed and return code is 0.

the version info is

knife-windows version:1.4.1 winrm version:1.8.1

and after digging, I think found that. on knife-windows source code lib/chef/knife/winrm_session.rb "relay_command" method

remote_id = @winrm_session.open_shell
command_id = @winrm_session.run_command(remote_id, command)

=> it's not run batch file. just exit code is 0, and run other command is OK

@winrm_session.create_executor do |executor|
  executor.run_cmd(cmd) do |stdout, stderr|
     Chef::Log.info(cmdstdout)
     Chef::Log.error(cmdstderr)
  end
end

=> it's ok to run batch file. but lt's bad idea because can't get real time log

sound like the it is winrm_session run_command bug. but I'm not sure. how to fix this?

thanks.

1

1 Answers

0
votes

It was fixed via https://github.com/chef/knife-windows/pull/389 so when update knife-windows to newest version, It will be OK.