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

Issue with DSC and Chocolaty install #579

Closed
sernone opened this issue May 17, 2018 · 9 comments
Closed

Issue with DSC and Chocolaty install #579

sernone opened this issue May 17, 2018 · 9 comments
Milestone

Comments

@sernone
Copy link

sernone commented May 17, 2018

System Details

  • posh-git version/path:
  • PowerShell version: 5.0.10586.117
  • Git version: 2.17.0.windows.1
  • Operating system name and version: Microsoft Windows NT 6.3.9600.0

Issue Description

I am experiencing a problem with installing this package via chocolaty and azure dsc. The logs are below

2018-05-17 13:10:06,452 6308 [DEBUG] - 7zip found at 'C:\Choco\tools\7z.exe'
2018-05-17 13:10:06,452 6308 [DEBUG] - Executing command ['C:\Choco\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools\poshgit" -y "C:\Windows\SysNative\config\systemprofile\AppData\Local\Temp\poshgit\0.7.3\dahlbyk-posh-git-v0.7.3-0-g6eb84bd.zip"]
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 7-Zip 18.05 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Scanning the drive for archives:
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 1 file, 74677 bytes (73 KiB)
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Extracting archive: C:\Windows\SysNative\config\systemprofile\AppData\Local\Temp\poshgit\0.7.3\dahlbyk-posh-git-v0.7.3-0-g6eb84bd.zip
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: --
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Path = C:\Windows\SysNative\config\systemprofile\AppData\Local\Temp\poshgit\0.7.3\dahlbyk-posh-git-v0.7.3-0-g6eb84bd.zip
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Type = zip
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Physical Size = 74677
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: Comment = 6eb84bdff7d18411d76493ab5e0b025371339723
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: 
2018-05-17 13:10:06,936 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.editorconfig
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.gitattributes
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.gitignore
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.vscode
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.vscode\extensions.json
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.vscode\launch.json
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.vscode\settings.json
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\.vscode\tasks.json
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\CHANGELOG.md
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\ISSUE_TEMPLATE.md
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\LICENSE.txt
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\PSScriptAnalyzerSettings.psd1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\README.md
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\appveyor.yml
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\packAndLocalInstall.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\poshgit.nuspec
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tests
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tests\InstallChocolatey.Tests.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tests\dahlbyk-posh-git-60be436.zip
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tools
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tools\chocolateyInstall.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\chocolatey\tools\chocolateyUninstall.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\install.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\profile.example.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\CheckVersion.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\GitParamTabExpansion.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\GitPrompt.ps1
2018-05-17 13:10:06,952 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\GitTabExpansion.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\GitUtils.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\TortoiseGit.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\Utils.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\en-US
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\en-US\about_posh-git.help.txt
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\posh-git.psd1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\src\posh-git.psm1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\DefaultPrompt.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Get-GitBranch.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Get-GitDirectory.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Get-GitStatus.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\GitParamTabExpansion.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\ModuleManifest.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Shared.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Ssh.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\TabExpansion.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\Utils.Tests.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\git-help.txt
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: - dahlbyk-posh-git-4184928\test\testDebugHarness.ps1
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: Everything is Ok
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: 
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: Folders: 8
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: Files: 43
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: Size:       214756
2018-05-17 13:10:06,967 6308 [INFO ] - VERBOSE: Compressed: 74677
2018-05-17 13:10:06,983 6308 [DEBUG] - $exitCode was passed null
2018-05-17 13:10:06,983 6308 [DEBUG] - Command ['C:\Choco\tools\7z.exe' x -aoa -bd -bb1 -o"C:\tools\poshgit" -y "C:\Windows\SysNative\config\systemprofile\AppData\Local\Temp\poshgit\0.7.3\dahlbyk-posh-git-v0.7.3-0-g6eb84bd.zip"] exited with '0'.
2018-05-17 13:10:06,999 6308 [DEBUG] - 7z exit code: 0
2018-05-17 13:10:07,014 6308 [ERROR] - ERROR: Cannot bind argument to parameter 'Path' because it is null.
2018-05-17 13:10:07,014 6308 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'c:\\Choco\helpers\chocolateyInstaller.psm1'; & 'c:\\Choco\helpers\chocolateyScriptRunner.ps1' -packageScript 'c:\\Choco\lib\poshgit\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '-1'.
2018-05-17 13:10:07,030 6308 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
@dahlbyk
Copy link
Owner

dahlbyk commented May 17, 2018

Interesting... this is similar to #381 and http://disq.us/p/1fqmw4q. I assume you're installing the latest version (0.7.3) with the latest version of Chocolatey?

Unfortunately that stack trace doesn't reveal where we're trying to bind null to Path. Are you

Can you tell me anything else about environment where you're trying to install? I'm afraid I've never used Azure DSC. Are you able to manually run C:\tools\poshgit\dahlbyk-posh-git-v0.7.3-0-g6eb84bd\install.ps1 to see if we can get a better error message?

@sernone
Copy link
Author

sernone commented May 17, 2018

If i manually run the chocolatey install it runs fine it seems that its only via dsc that is having the issue maybe because via the end user process it assumes the path because its the user logged in running it vs the nt authority user. I would maybe see in your code where you are calling a Path variable and see what it normally calls and make sure it has a value ?

yes i have the latest version of chocolatey and trying to install poshgit 0.7.3

@dahlbyk dahlbyk added this to the v0.7.4 milestone May 17, 2018
@sernone
Copy link
Author

sernone commented May 17, 2018

For now while this gets looked into i created a work around in my dsc configration for anyone else that is having this issue with chocolately right now.

		#Some packages are broken in Choco but we have the PSGallery
		PackageManagementSource PSGallery {
			Ensure = "Present"
			Name = "psgallery"
			ProviderName = "PowerShellGet"
			SourceLocation = "https://www.powershellgallery.com/api/v2/"
			InstallationPolicy = "Trusted"
		}

		PackageManagement InstallPoshGit {
			Name = "posh-git"
			DependsOn = "[PackageManagementSource]PSGallery"
			Ensure = "Present"
			Source = "PSGallery"
		}

@dahlbyk
Copy link
Owner

dahlbyk commented May 17, 2018

@sernone I just pushed v0.7.3.1 to the Chocolatey gallery. Please let me know if this doesn't resolve your issue. (I added more diagnostic messages, too, so please post a new log if there's a failure.

@dahlbyk
Copy link
Owner

dahlbyk commented May 17, 2018

Note also that PSGallery has a prerelease for a more current version of posh-git: https://www.powershellgallery.com/packages/posh-git/1.0.0-beta2.

I'd still appreciate confirmation that installing v0.7.3.1 is fixed, but you might stick with PSGallery to get access to our new features sooner.

@sernone
Copy link
Author

sernone commented May 17, 2018

I am testing it now just had to update the dsc config and apply it to my test machine. I'll will update you soon with if it fixed the issue and if it not what the logs look like. I still prefer chocolately so i'd much rather use that.

	cChocoPackageInstaller InstallPoshGit {
		Name = "poshgit"
		DependsOn = "[cChocoInstaller]Install"
		Ensure = "Present"
		Version = "0.7.3.1"
	}

@sernone
Copy link
Author

sernone commented May 17, 2018

@dahlbyk Thanks for the fix it did install this time however it seems that it didn't properly load the module, if i try to list that module in powershell after a refreshenv it doesn't show up but according to choco it installed perfectly with 1 warning about the psmodulepath which might be why its not showing up

2018-05-17 17:09:54,558 4676 [WARN ] - WARNING: posh-git repository structure is incompatible with %PSModulePath%.
2018-05-17 17:09:54,558 4676 [WARN ] - WARNING: Importing with absolute path instead.
2018-05-17 17:09:54,574 4676 [DEBUG] - Built-in PowerShell host called with ['[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'c:\\Choco\helpers\chocolateyInstaller.psm1'; & 'c:\\Choco\helpers\chocolateyScriptRunner.ps1' -packageScript 'c:\\Choco\lib\poshgit\tools\chocolateyInstall.ps1' -installArguments '' -packageParameters '''] exited with '0'.
2018-05-17 17:09:54,590 4676 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2018-05-17 17:09:54,621 4676 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
2018-05-17 17:09:54,652 4676 [WARN ] - Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
2018-05-17 17:09:54,652 4676 [DEBUG] - Logging of values is not turned on by default because it 
 could potentially expose sensitive data. If you understand the risk,
 please see `choco feature -h` for information to turn it on.
2018-05-17 17:09:54,652 4676 [DEBUG] - The following values have been added/changed (may contain sensitive data):
2018-05-17 17:09:54,652 4676 [DEBUG] -   * ChocolateyLastPathUpdate='[REDACTED]' (User)
2018-05-17 17:09:54,824 4676 [DEBUG] - Capturing package files in 'c:\\Choco\lib\poshgit'
2018-05-17 17:09:54,824 4676 [DEBUG] -  Found 'c:\\Choco\lib\poshgit\dahlbyk-posh-git-v0.7.3.1-0-g9c34bb9.zip.txt'
  with checksum '635C68F00E1D3E4AEB2C93136CEACA58'
2018-05-17 17:09:54,824 4676 [DEBUG] -  Found 'c:\\Choco\lib\poshgit\poshgit.nupkg'
  with checksum 'B38C54472161B74CFF709CBB40750236'
2018-05-17 17:09:54,824 4676 [DEBUG] -  Found 'c:\\Choco\lib\poshgit\poshgit.nuspec'
  with checksum '41E6FC39DCBF0410621E623C0DC7F4DA'
2018-05-17 17:09:54,824 4676 [DEBUG] -  Found 'c:\\Choco\lib\poshgit\tools\chocolateyInstall.ps1'
  with checksum '4F708620DF6AE863B015722E3D611CB4'
2018-05-17 17:09:54,824 4676 [DEBUG] -  Found 'c:\\Choco\lib\poshgit\tools\chocolateyUninstall.ps1'
  with checksum 'E93B4B009C93C15D2D98F0C8B75B2656'
2018-05-17 17:09:54,840 4676 [DEBUG] - Attempting to create directory "c:\Choco\.chocolatey\poshgit.0.7.3.1".
2018-05-17 17:09:54,855 4676 [DEBUG] - There was no original file at 'c:\\Choco\.chocolatey\poshgit.0.7.3.1\.files'
2018-05-17 17:09:54,855 4676 [DEBUG] - Attempting to delete file "c:\\Choco\.chocolatey\poshgit.0.7.3.1\.extra".
2018-05-17 17:09:54,855 4676 [DEBUG] - Attempting to delete file "c:\\Choco\.chocolatey\poshgit.0.7.3.1\.version".
2018-05-17 17:09:54,855 4676 [DEBUG] - Attempting to delete file "c:\\Choco\.chocolatey\poshgit.0.7.3.1\.sxs".
2018-05-17 17:09:54,855 4676 [DEBUG] - Attempting to delete file "c:\\Choco\.chocolatey\poshgit.0.7.3.1\.pin".
2018-05-17 17:09:54,855 4676 [DEBUG] - Attempting to delete directory "c:\Choco\lib-bad\poshgit".
2018-05-17 17:09:54,871 4676 [DEBUG] - Sending message 'HandlePackageResultCompletedMessage' out if there are subscribers...
2018-05-17 17:09:54,871 4676 [DEBUG] - Attempting to delete file "c:\\Choco\lib\poshgit\.chocolateyPending".
2018-05-17 17:09:54,871 4676 [INFO ] -  The install of poshgit was successful.
2018-05-17 17:09:54,871 4676 [INFO ] -   Software installed to 'C:\tools\poshgit'

@dahlbyk
Copy link
Owner

dahlbyk commented May 17, 2018

Thanks for the fix it did install this time however it seems that it didn't properly load the module, if i try to list that module in powershell after a refreshenv it doesn't show up but according to choco it installed perfectly with 1 warning about the psmodulepath which might be why its not showing up

Correct. Chocolatey install currently uses Get-ToolsLocation, though we are discussing changing that: #473. You can adjust tools location with $env:ChocolateyToolsLocation, though setting that to a path from PSModulePath probably won't work either due to the path structure.

In the meantime you'll need to import the psd1 by path.

@sernone
Copy link
Author

sernone commented May 17, 2018

@dahlbyk Thanks for all this , that has fixed the issue it might have fixed others as well but as for now dsc doesn't have a great way to import a psd1 file without a bunch of config that seems unnecessary for now since the psgallery one its working. i'll keep an eye out for upcoming choco releases though for sure. Thanks again

@sernone sernone closed this as completed May 17, 2018
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