Provisioning - Install.ps1 file has syntax errors


#1

When I run a chef-run, I see the error as:

[Rel92-Test-agt1] At C:\chef\install.ps1:56 char:13
                  +   if ($pA256($src) {
                  +             ~
                  Unexpected token '(' in expression or statement.
                  At C:\chef\install.ps1:56 char:13
                  +   if ($pA256($src) {
                  +             ~
                  Missing closing ')' after expression in 'if' statement.
                  At C:\chef\install.ps1:56 char:20
                  +   if ($pA256($src) {
                  +                    ~
                  Unexpected token '{' in expression or statement.
                  At C:\chef\install.ps1:51 char:29
                  + Function Install-Chef($msi) {
                  +                             ~
                  Missing closing '}' in statement block.
                      + CategoryInfo          : ParserError: (:) [], ParseException
                      + FullyQualifiedErrorId : UnexpectedToken

I Check the script locally on the node adn the syntax is in fact bad, I deleted it and ran it again, and the same script is downloaded. This script is generated via the Chef-Provisioning cookbook:

but I’m not sure this is because of that cookbook or the generator for the scrpt that is run on line 39

install_command = Mixlib::Install::ScriptGenerator.new(chef_version, true, opts).install_command


#2

Looks to be an issue with the script_generator…


#3

Could you gist up the actual install.ps1 that was generated and also reply with output of chef --version and chef gem list winrm? That’ll let me know what version of the winrm and winrm-fs gems to check against.

The location the error is generated doesn’t look to be part of the normal install.ps1 template.


#4
PS C:\GIT Repositories\cookbook-relativity_scaled-automation> chef --version
Chef Development Kit Version: 0.14.25
chef-client version: 12.10.24
berks version: 4.3.3
kitchen version: 1.8.0
PS C:\GIT Repositories\cookbook-relativity_scaled-automation> chef gem list winrm

*** LOCAL GEMS ***

winrm (1.8.1, 1.6.0, 1.5.0)
winrm-elevated (0.4.0)
winrm-fs (0.4.2)
winrm-s (0.3.6, 0.3.4)
winrm-transport (1.0.3)
PS C:\GIT Repositories\cookbook-relativity_scaled-automation>


#5

That install.ps1 is getting mangled somehow/somewhere. It seems that some functions are duplicated and overwriting other functions…

I see you’ve got a bug opened - https://github.com/chef/chef-provisioning/issues/528

We can follow up further there.


#6

Great, thanks…