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

Fixes #45 and #12 by adding support for choco install switch paramete… #50

Closed
wants to merge 1 commit into from

Conversation

javydekoning
Copy link
Collaborator

@javydekoning javydekoning commented Aug 25, 2016

Fixes #45 and #12 by adding support for choco install switch parameters, Also cleans up InstallPackage function

Example config:

cChocoPackageInstaller skype
{
    Name = "skype"
    chocoSwitchParams = 'allowdowngrade','allowemptychecksum','allowemptychecksumsecure'
    Ensure = 'Present'
    Version = '7.25.0.106'
    PsDscRunAsCredential = $Credential
    DependsOn = "[cChocoInstaller]installChoco"
}    

Example output:

VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoPackageInstaller]skype] Install command: 'choco install skype -y --version="7.2
5.0.106" --allowdowngrade --allowemptychecksum --allowemptychecksumsecure'
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoPackageInstaller]skype] Package output Chocolatey v0.10.0 Installing the follow
ing packages: skype By installing you accept licenses for the packages.  skype v7.25.0.106 [Approved] Downloading skype    from 'http://downlo
ad.skype.com/msi/SkypeSetup_7.25.0.106.msi'  Progress: 3% - Saving 1.26 MB of 37.93 MB (1322154/39772160) Progress: 5% - Saving 2.07 MB of 37.
93 MB (2165334/39772160) Progress: 7% - Saving 2.87 MB of 37.93 MB (3009894/39772160) Progress: 9% - Saving 3.78 MB of 37.93 MB (3966234/39772
160) Progress: 12% - Saving 4.66 MB of 37.93 MB (4889454/39772160) Progress: 15% - Saving 5.78 MB of 37.93 MB (6061074/39772160) Progress: 18%
 - Saving 7 MB of 37.93 MB (7343094/39772160) Progress: 21% - Saving 8.19 MB of 37.93 MB (8586474/39772160) Progress: 24% - Saving 9.24 MB of 
37.93 MB (9689094/39772160) Progress: 26% - Saving 9.98 MB of 37.93 MB (10467414/39772160) Progress: 29% - Saving 11.28 MB of 37.93 MB (118294
74/39772160) Progress: 30% - Saving 11.55 MB of 37.93 MB (12115134/39772160) Progress: 32% - Saving 12.27 MB of 37.93 MB (12867234/39772160) P
rogress: 37% - Saving 14.19 MB of 37.93 MB (14877894/39772160) Progress: 40% - Saving 15.43 MB of 37.93 MB (16175094/39772160) Progress: 43% -
 Saving 16.36 MB of 37.93 MB (17152134/39772160) Progress: 44% - Saving 16.77 MB of 37.93 MB (17579934/39772160) Progress: 45% - Saving 17.34 
MB of 37.93 MB (18185754/39772160) Progress: 51% - Saving 19.38 MB of 37.93 MB (20324754/39772160) Progress: 53% - Saving 20.24 MB of 37.93 MB
 (21218994/39772160) Progress: 55% - Saving 21.13 MB of 37.93 MB (22156014/39772160) Progress: 60% - Saving 22.97 MB of 37.93 MB (24088014/397
72160) Progress: 61% - Saving 23.34 MB of 37.93 MB (24477174/39772160) Progress: 64% - Saving 24.41 MB of 37.93 MB (25593594/39772160) Progres
s: 64% - Saving 24.53 MB of 37.93 MB (25717794/39772160) Progress: 65% - Saving 24.94 MB of 37.93 MB (26151114/39772160) Progress: 67% - Savin
g 25.68 MB of 37.93 MB (26926674/39772160) Progress: 70% - Saving 26.84 MB of 37.93 MB (28142454/39772160) Progress: 71% - Saving 26.99 MB of 
37.93 MB (28303914/39772160) Progress: 73% - Saving 27.72 MB of 37.93 MB (29062914/39772160) Progress: 73% - Saving 28.06 MB of 37.93 MB (2942
5854/39772160) Progress: 76% - Saving 28.9 MB of 37.93 MB (30300774/39772160) Progress: 78% - Saving 29.65 MB of 37.93 MB (31092894/39772160) 
Progress: 79% - Saving 30.09 MB of 37.93 MB (31548294/39772160) Progress: 81% - Saving 30.85 MB of 37.93 MB (32344554/39772160) Progress: 84% 
- Saving 32.06 MB of 37.93 MB (33622434/39772160) Progress: 85% - Saving 32.57 MB of 37.93 MB (34152354/39772160) Progress: 87% - Saving 33.36
 MB of 37.93 MB (34984494/39772160) Progress: 88% - Saving 33.49 MB of 37.93 MB (35114214/39772160) Progress: 90% - Saving 34.19 MB of 37.93 M
B (35851134/39772160) Progress: 92% - Saving 35.03 MB of 37.93 MB (36735714/39772160) Progress: 93% - Saving 35.46 MB of 37.93 MB (37180074/39
772160) Progress: 95% - Saving 36.27 MB of 37.93 MB (38032914/39772160) Progress: 96% - Saving 36.64 MB of 37.93 MB (38423454/39772160) Progre
ss: 97% - Saving 37.09 MB of 37.93 MB (38891274/39772160) Progress: 100% - Saving 37.93 MB of 37.93 MB (39772160/39772160) Progress: 100% - Co
mpleted download of C:\Users\jdekoning\AppData\Local\Temp\chocolatey\skype\7.25.0.106\SkypeSetup_7.25.0.106.msi (37.93 MB). Download of SkypeS
etup_7.25.0.106.msi (37.93 MB) completed. Installing skype... skype has been installed. Environment Vars (like PATH) have changed. Close/reope
n your shell to  see the changes (or in powershell/cmd.exe just type `refreshenv`).  The install of skype was successful.   Software installed
 to 'C:\Program Files (x86)\Skype\'  Chocolatey installed 1/1 packages. 0 packages failed.  See the log for details (c:\choco\logs\chocolatey.
log).
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Set      ]  [[cChocoPackageInstaller]skype]  in 13.2470 seconds.
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Resource ]  [[cChocoPackageInstaller]skype]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Set      ]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Set      ]    in  15.4040 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 15.646 seconds

PS C:\Users\jdekoning> Start-DscConfiguration -Verbose -Path $home\Win10 -Wait -Force
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalCon
figurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer DESKTOP-2QT9BLA with user sid S-1-5-21-4175619033-4048704004-132096340-1001.
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Start  Set      ]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Start  Resource ]  [[cChocoInstaller]installChoco]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Start  Test     ]  [[cChocoInstaller]installChoco]
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoInstaller]installChoco]  Start Test-TargetResource
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoInstaller]installChoco]  Is choco installed?
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoInstaller]installChoco]  YES - Choco is Installed
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Test     ]  [[cChocoInstaller]installChoco]  in 0.0150 seconds.
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Skip   Set      ]  [[cChocoInstaller]installChoco]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Resource ]  [[cChocoInstaller]installChoco]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Start  Resource ]  [[cChocoPackageInstaller]skype]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Start  Test     ]  [[cChocoPackageInstaller]skype]
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoPackageInstaller]skype] Start Test-TargetResource
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoPackageInstaller]skype] Start IsPackageInstalled skype
VERBOSE: [DESKTOP-2QT9BLA]:                            [[cChocoPackageInstaller]skype] Start IsPackageInstalled skype
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Test     ]  [[cChocoPackageInstaller]skype]  in 2.0160 seconds.
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ Skip   Set      ]  [[cChocoPackageInstaller]skype]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Resource ]  [[cChocoPackageInstaller]skype]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Set      ]
VERBOSE: [DESKTOP-2QT9BLA]: LCM:  [ End    Set      ]    in  2.1250 seconds.
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 2.214 seconds

…rs. Also cleans up InstallPackage function
@@ -6,4 +6,5 @@ class cChocoPackageInstall : OMI_BaseResource
[write] string Params;
[write] string Version;
[write] string Source;
[Write,ValueMap{"allowunofficial","prerelease","forcex86","allowdowngrade","sidebyside","ignoredependencies","ignorechecksums","allowemptychecksum","allowemptychecksumsecure"},Values{"allowunofficial","prerelease","forcex86","allowdowngrade","sidebyside","ignoredependencies","ignorechecksums","allowemptychecksum","allowemptychecksumsecure"}] String chocoSwitchParams[];
Copy link
Member

Choose a reason for hiding this comment

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

I'd almost prefer the longest version of these.

Copy link
Member

Choose a reason for hiding this comment

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

And as we talked about in #52 - probably removing the value maps entirely and let Chocolatey do the validation of the arguments.

@javydekoning
Copy link
Collaborator Author

Closing as discussed in #52 . Will implement in a different way.

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

Successfully merging this pull request may close these issues.

None yet

2 participants