Chef provisioner creating invalid knife.rb in Windows?

24 views
Skip to first unread message

Stephen Opalenski

unread,
Sep 20, 2017, 4:38:38 PM9/20/17
to Packer
I think I'm running into a problem packing a Windows instance with a Chef provider where the knife.rb file being generated appears to be encoded as the standard Windows UTF-16 with a BOM which causes Chef to choke because Chef is expecting a UTF-8 encoded file. 

 amazon: [2017-09-20T13:38:54-04:00] INFO: Chef Run complete in 343.626122 seconds
    amazon: [2017-09-20T13:38:54-04:00] INFO: Running report handlers
    amazon: [2017-09-20T13:38:54-04:00] INFO: Report handlers complete
    amazon: Creating configuration file 'knife.rb'
==> amazon: Cleaning up chef node...
    amazon: ERROR: CONFIGURATION ERROR:You have invalid ruby syntax in your config file C:/Windows/Temp/packer-chef-client/knife.rb
    amazon:
    amazon: SyntaxError: C:/Windows/Temp/packer-chef-client/knife.rb:1: invalid multibyte char (UTF-8)
    amazon: Relevant file content:
    amazon:   1: ▒▒
==> amazon: Terminating the source AWS instance...
==> amazon: Cleaning up any extra volumes...
==> amazon: No volumes to clean up, skipping
==> amazon: Deleting temporary keypair...


I am running this with Packer 1.1.0, but with an older Chef of 12.19.36 due to various cookbook problems. 

I am assuming Packer is generating the knife.rb file. 

1. Is this correct? 
2. Any idea on how I could change the encoding of the knife file?

Regards,
Steve
Reply all
Reply to author
Forward
0 new messages