Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provisioning - Install.ps1 file has syntax errors #528

Open
kalapakim opened this issue Jul 7, 2016 · 5 comments
Open

Provisioning - Install.ps1 file has syntax errors #528

kalapakim opened this issue Jul 7, 2016 · 5 comments

Comments

@kalapakim
Copy link

I created an issue in teh Chef Forum, but I"m not sure if it's something that is being caused by this cookbook or by a change that was made on Chef's side..

Here is the link to the issue in the forum..
https://discourse.chef.io/t/provisioning-install-ps1-file-has-syntax-errors/8884

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 and 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:

https://github.com/chef/chef-provisioning/blob/73858aff021dd1830b38ff33b693c5f7f5c3825b/lib/chef/provisioning/convergence_strategy/install_msi.rb

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

@smurawski
Copy link

Adding context from the Discourse thread -
install.ps1 that was generated - https://gist.github.com/kalapakim/9c1fe6ed587f769d6a50c105d10c1419 - has a bunch of mangled/overwritten function definitions.

@kalapakim what OS and version are you using for your workstation and what OS and version are you using chef provisioning against?

@kalapakim
Copy link
Author

kalapakim commented Jul 7, 2016

my workstation is windows 7, the server is windows 2012...weird thing is, I was testing this in test kitchen and I had no issues...and I just got done running a provisioning run and built out 11 servers, no issue...but soon as I attempted this recipe, it started getting the error

@kalapakim
Copy link
Author

I checked another server's install.ps1 file, which was done just a few minutes before I attempted to run the new recipe on these and it doesn't have the same syntax errors..

Function Install-Chef($msi) {
  Log "Installing Chef Omnibus package $msi"
  $p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/qn /i $msi" -Passthru -Wait
  $p.WaitForExit()

  if ($p.ExitCode -ne 0) { throw "msiexec was not successful. Received exit code $($p.ExitCode)" }

  Remove-Item $msi -Force
  Log "Installation complete"
}

@smurawski
Copy link

@kalapakim what provisioning driver are you using? Where the 11 successful servers built from the same base image as the failing 12th?

@kalapakim
Copy link
Author

update, the next day, I no longer got that error...seems to be fine now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants