chef / knife-windows

Plugin for Chef's knife tool for working with Windows nodes
Apache License 2.0
152 stars 110 forks source link

Bootstrap template (`-t`) does not work #449

Closed spuder closed 6 years ago

spuder commented 6 years ago

Chef Development Kit Version: 1.6.11 chef-client version: 12.21.26 delivery version: master (73ebb72a6c42b3d2ff5370c476be800fee7e5427) berks version: 5.6.4 kitchen version: 1.16.0 inspec version: 1.25.1

knife-windows (1.9.0)

If you use the -t option for a bootstrap template, the bootstrap option is completely ignored. If you use the --bootstrap-template option, the bootstrap option works as expected.

Steps to reproduce

  1. Put dummy data in a text file

c:\users\foobar.chef\bootstrap\foo.erb

@rem stuff
@echo ######################
@echo ######################
  1. boostrap using the -t option

--bootstrap-template gives expected result of garbage template (#####)

knife bootstrap windows winrm 192.0.2.0 --bootstrap-template 'c:/users/foobar/.chef/bootstrap/foobar.erb'
Creating new client for foobar
Creating new node for foobar

Waiting for remote response before bootstrap.192.0.2.0 .
192.0.2.0 Response received.
Remote node responded after 0.53 minutes.
Bootstrapping Chef on 192.0.2.0
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
4.bat" chunk 1
192.0.2.0 ##########################################################################
192.0.2.0 ##########################################################################

-t gives unexpected result of using default template

knife bootstrap windows winrm 192.0.2.0 -t 'c:/users/foobar/.chef/bootstrap/foobar.erb'
Creating new client for foobar
Creating new node for foobar

Waiting for remote response before bootstrap.192.0.2.0 .
192.0.2.0 Response received.
Remote node responded after 0.01 minutes.
Bootstrapping Chef on 192.0.2.0
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 1
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 2
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 3
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 4
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 5
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 6
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 7
192.0.2.0 Rendering "C:\Users\vagrant\AppData\Local\Temp\bootstr
6.bat" chunk 8
192.0.2.0 Checking for existing directory "C:\chef"...
192.0.2.0 Existing directory found, skipping creation.
192.0.2.0
192.0.2.0 C:\Users\vagrant>(
192.0.2.0 echo.url = WScript.Arguments.Named("url")
192.0.2.0  echo.path = WScript.Arguments.Named("path")
192.0.2.0  echo.proxy = null
192.0.2.0  echo.'* Vaguely attempt to handle file:// scheme urls
 and switching all
dheerajd-msys commented 6 years ago

@spuder Thanks for pointing this issue, I've reproduced this issue. -t is short-name for both the options --bootstrap-template as well as --winrm-transport as

          option :winrm_transport,
            :short => "-t TRANSPORT",
            :long => "--winrm-transport TRANSPORT",

and

          option :bootstrap_template,
            :short => "-t TEMPLATE",
            :long => "--bootstrap-template TEMPLATE",

So we may remove this short-name from --bootstrap-template and have it working properly. We will work on it.

Thanks

dheerajd-msys commented 6 years ago

@spuder This issue is fixed in https://github.com/chef/knife-windows/pull/457. Could you please close this now?

Thanks