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

Chocolatey fails to install in PowerShell v2 with PowerShell Module 1.x #128

Closed
gruffled opened this issue Jun 7, 2016 · 10 comments
Closed

Comments

@gruffled
Copy link

gruffled commented Jun 7, 2016

Powershell plug in is 1.06
Chocolatey plug in is 1.2.4
Chocolatey package is 0.9.10-beta-2016032

The main choco install is failing as below. we are using the beta 9.10 package installed from a private repo.

        my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Mode                LastWriteTime     Length Name                              
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: ----                -------------     ------ ----                              
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: d----        07/06/2016     13:13            chocInstall                       
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Downloading http://myserver/NuGet/api/v2/package/chocolatey/0.9.10-beta-2016032
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 3 to C:\Users\puppet\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Installing chocolatey on this machine
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: The term 'else' is not recognized as the name of a cmdlet, function, script fil
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: e, or operable program. Check the spelling of the name, or if a path was includ
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: ed, verify that the path is correct and try again.
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: At line:1 char:5
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: + else <<<<  {
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:     + CategoryInfo          : ObjectNotFound: (else:String) [], ParentContains 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:    ErrorRecordException
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:     + FullyQualifiedErrorId : CommandNotFoundException
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:  
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Ensuring chocolatey commands are on the path
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Ensuring chocolatey.nupkg is in the lib folder
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Mode                LastWriteTime     Length Name                              
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: ----                -------------     ------ ----                              
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: d----        07/06/2016     13:14            chocolatey                        
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: executed successfully
    my_machine: Debug: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]: The container Class[Chocolatey::Install] will propagate my refresh event
    my_machine: Debug: Exec[install_chocolatey_official](provider=powershell): Executing 'cmd.exe /c ""C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - < "C:\Users\puppet\AppData\Local\Temp\puppet-powershell20160607-668-12s53an.ps1""'
    my_machine: Debug: Executing 'cmd.exe /c ""C:\Windows\system32\WindowsPowershell\v1.0\powershell.exe" -NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass -Command - < "C:\Users\puppet\AppData\Local\Temp\puppet-powershell20160607-668-12s53an.ps1""'
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Downloading http://myserver/NuGet/api/v2/package/chocolatey/0.9.10-beta-2016032
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: 3 to C:\Users\puppet\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Installing chocolatey on this machine
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: The term 'else' is not recognized as the name of a cmdlet, function, script fil
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: e, or operable program. Check the spelling of the name, or if a path was includ
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: ed, verify that the path is correct and try again.
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: At line:1 char:5
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: + else <<<<  {
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:     + CategoryInfo          : ObjectNotFound: (else:String) [], ParentContains 
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:    ErrorRecordException
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:     + FullyQualifiedErrorId : CommandNotFoundException
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns:  
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Ensuring chocolatey commands are on the path
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]/returns: Ensuring chocolatey.nupkg is in the lib folder
    my_machine: Notice: /Stage[setup]/Chocolatey::Install/Exec[install_chocolatey_official]: Triggered 'refresh' from 2 events
@gruffled
Copy link
Author

gruffled commented Jun 7, 2016

Should note this only started since the chocolatey module went from 1.2.3 to 1.2.4

@ferventcoder
Copy link
Contributor

ferventcoder commented Jun 7, 2016

And Puppet version is? :)

@ferventcoder
Copy link
Contributor

@ferventcoder
Copy link
Contributor

ferventcoder commented Jun 7, 2016

side note: I also recommend upgrading your beta.

@ferventcoder
Copy link
Contributor

It seems the try/catch is likely causing this error later. Perhaps if you can help me adjust that - we can try to determine what is causing it - I tested this scenario with the older PowerShell provider on Windows 2008 R2 and didn't see this issue, so I missed getting this to happen.

@ferventcoder
Copy link
Contributor

ferventcoder commented Jun 7, 2016

Let's try changing that line to } else { (the } is on the line above it, so just remove the line break).

@gruffled
Copy link
Author

gruffled commented Jun 7, 2016

Puppet version is 3.8.4

I've made the change, running a build now to see what happens.

@gruffled
Copy link
Author

gruffled commented Jun 7, 2016

That seems to have done the trick :)

@ferventcoder
Copy link
Contributor

ugh, fun times - let's fix that.

@ferventcoder
Copy link
Contributor

Do you want to follow up with a pull request or do you just want me to fix it?

gruffled pushed a commit to gruffled/puppet-chocolatey that referenced this issue Jun 7, 2016
gruffled pushed a commit to gruffled/puppet-chocolatey that referenced this issue Jun 7, 2016
gruffled pushed a commit to gruffled/puppet-chocolatey that referenced this issue Jun 7, 2016
gruffled pushed a commit to gruffled/puppet-chocolatey that referenced this issue Jun 7, 2016
…allation issues with

older versuions of the powershell module.
ferventcoder pushed a commit that referenced this issue Jun 20, 2016
Removed a line break which was causing installation issues with
1.x versions of the PowerShell provider  module. Older versions of
PowerShell, such as PowerShell v2, and the 1.x module do not
handle line breaks with else statements very well.
ferventcoder added a commit that referenced this issue Jun 20, 2016
* pr129:
  (GH-128) PowerShell 1.x provider fixes for "else"
@ferventcoder ferventcoder changed the title Chocolatey fails to install on Windows 2008r2 Chocolatey fails to install in PowerShell v2 with PowerShell Module 1.x Jun 20, 2016
ferventcoder added a commit to ferventcoder/puppet-chocolatey that referenced this issue Jul 6, 2016
* master:
  (version) 1.2.5
  (maint) prep for release of 1.2.5
  (chocolatey-archiveGH-128) PowerShell 1.x provider fixes for "else"
  (chocolatey-archiveGH-133) Feature list update for  0.9.10
  (version) 1.2.4
  (chocolatey-archiveGH-125) Compatible Up to PowerShell Provider 3.x
  (chocolatey-archiveGH-125) Wrap PowerShell Redirect in Try/Catch
  (chocolatey-archiveGH-69) Fix - default provider example
  (doc) make that text a bit more prominent
  (version) 1.2.3 for real
  (version) 1.2.3
  (doc) add editions of Chocolatey
  (chocolatey-archiveGH-100) Do not call choco with --debug --verbose
  (version) 1.2.2
  Sign the installer script template
  (chocolatey-archiveGH-119) Implement PowerShell Redirection Fix
ferventcoder added a commit to ferventcoder/puppet-chocolatey that referenced this issue Jul 11, 2016
* master:
  (version) 1.2.6
  (MODULES-3536) modsync update
  (maint) Remove travis and metadata-json-lint gems
  (chocolatey-archiveGH-134) Only Enable AutoUninstaller in 0.9.9.x
  (version) 1.2.5
  (maint) prep for release of 1.2.5
  (chocolatey-archiveGH-128) PowerShell 1.x provider fixes for "else"
  (chocolatey-archiveGH-133) Feature list update for  0.9.10
  (version) 1.2.4
  (chocolatey-archiveGH-125) Compatible Up to PowerShell Provider 3.x
  (chocolatey-archiveGH-125) Wrap PowerShell Redirect in Try/Catch
  (chocolatey-archiveGH-69) Fix - default provider example
  (doc) make that text a bit more prominent
  (version) 1.2.3 for real
  (version) 1.2.3
  (doc) add editions of Chocolatey
  (chocolatey-archiveGH-100) Do not call choco with --debug --verbose
  (version) 1.2.2
  Sign the installer script template
  (chocolatey-archiveGH-119) Implement PowerShell Redirection Fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants