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

(GH-61) Fix choco install package result #103

Open
wants to merge 25 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
13dc62b
add Invoke-Chocolatey cmdlet which throws error on choco failure
bassedball Dec 4, 2017
c2e80c6
Merge branch 'development' into feature/chocoinstallResult
bassedball Dec 4, 2017
e3d87fb
removed typo
bassedball Dec 4, 2017
b5e589e
removed alias, ensured LASTEXITCODE powershell is set same as choco e…
esiebes Dec 13, 2017
f8ad82e
add lastexitcode after invoke-chocolatey, included valid exit codes
esiebes Dec 15, 2017
cfb4fad
some fixes
esiebes Dec 15, 2017
db65157
removed unused variable
esiebes Dec 15, 2017
edd29ac
invoke-chocolatey now returns object array (same as chocolatey
esiebes Dec 15, 2017
2285eed
inovke chocolatey now returning output
esiebes Dec 15, 2017
60b5c52
change to output
esiebes Dec 15, 2017
119a7e3
some minor symantic changes
esiebes Oct 7, 2019
1b84d8c
reverted some changes
esiebes Oct 14, 2019
5ce77a1
mergeconflicts
esiebes May 25, 2020
36cbc0f
typo
esiebes May 25, 2020
a31199b
missed some bracket
esiebes May 25, 2020
f918292
add missing function
esiebes May 25, 2020
a765b4a
else block added, gone after merge
esiebes May 25, 2020
c62705e
should process with test not used
esiebes May 25, 2020
6f99ed1
add shouldprocess to Invoke chocolatey
esiebes May 25, 2020
ff013ba
add verbose to scriptstest
esiebes May 25, 2020
8d1c67f
shouldprocess thing error
esiebes May 25, 2020
d6c73a3
no error local found with shouldprocess
esiebes May 25, 2020
7270d0a
mm
esiebes May 25, 2020
93afb73
Created function invoke-chocolatey to ensure powershell exitcode equals
esiebes May 25, 2020
7b4d50c
Merge branch 'feature/chocoinstallresult' of https://github.com/esieb…
esiebes Jul 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Copyright (c) 2017 Chocolatey Software, Inc.
# Copyright (c) 2013 - 2017 Lawrence Gripper & original authors/contributors from https://github.com/chocolatey/cChoco
# Copyright (c) 2013 - 2017 Lawrence Gripper & original authors/contributors from https://github.com/chocolatey/cChoco
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -240,7 +239,7 @@ function InstallPackage
$chocoinstallparams += " $cParams"
}
Write-Verbose -Message "Install command: 'choco install $pName $chocoinstallparams'"
$packageInstallOuput = Invoke-ChocoLatey "install $pName $chocoinstallparams"
$packageInstallOuput = Invoke-Chocolatey "install $pName $chocoinstallparams"
Write-Verbose -Message "Package output $packageInstallOuput "

#refresh path varaible in powershell, as choco doesn"t, to pull in git
Expand Down Expand Up @@ -325,7 +324,7 @@ Function Test-LatestVersionInstalled {

Write-Verbose -Message "Testing if $pName can be upgraded: 'choco upgrade $pName $chocoupgradeparams'"

$packageUpgradeOuput = Invoke-Chocolatey "upgrade $pName $chocoupgradeparams"
$packageUpgradeOuput = Invoke-Chocolatey "choco upgrade $pName $chocoupgradeparams"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The choco command shouldn't be passed to Invoke-Chocolatey.

$packageUpgradeOuput | ForEach-Object {Write-Verbose -Message $_}

if ($packageUpgradeOuput -match "$pName.*is the latest version available based on your source") {
Expand Down Expand Up @@ -396,7 +395,7 @@ Function Upgrade-Package {
}

function Get-ChocoInstalledPackage {
Return (choco list -lo -r | ConvertFrom-Csv -Header 'Name', 'Version' -Delimiter "|")
(choco list -lo -r | ConvertFrom-Csv -Header 'Name', 'Version' -Delimiter "|")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your thinking behind running this every time rather than caching it for 60 seconds?
The Return isn't needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some instances of DSC configuratioin 60 seconds is to long if a small package is installed, so the test will fail I will remove the Return

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comment around this.



Expand Down