-
Notifications
You must be signed in to change notification settings - Fork 10
(#63) Add -MachineContactTimeout parameter for New-CcmDeploymentStep #65
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
Open
vexx32
wants to merge
3
commits into
chocolatey:develop
Choose a base branch
from
vexx32:63-add-missing-param
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,8 +15,12 @@ function New-CCMDeploymentStep { | |||||||||||||||||
| .PARAMETER TargetGroup | ||||||||||||||||||
| The group(s) the step will target | ||||||||||||||||||
|
|
||||||||||||||||||
| .PARAMETER ExecutionTimeoutSeconds | ||||||||||||||||||
| How long to wait for the step to timeout. Defaults to 14400 (4 hours) | ||||||||||||||||||
| .PARAMETER ExecutionTimeout | ||||||||||||||||||
| How long to wait, in seconds, for the step to timeout. Defaults to 14400 (4 hours) | ||||||||||||||||||
|
|
||||||||||||||||||
| .PARAMETER MachineContactTimeout | ||||||||||||||||||
| How long to wait, in minutes, for computers to check in to start the deployment before timing out. | ||||||||||||||||||
| Defaults to 0 (no timeout). | ||||||||||||||||||
|
|
||||||||||||||||||
| .PARAMETER FailOnError | ||||||||||||||||||
| Fail the step if there is an error. Defaults to True | ||||||||||||||||||
|
|
@@ -98,8 +102,14 @@ function New-CCMDeploymentStep { | |||||||||||||||||
| $TargetGroup = @(), | ||||||||||||||||||
|
|
||||||||||||||||||
| [Parameter()] | ||||||||||||||||||
| [Alias('ExecutionTimeoutSeconds', 'ExecutionTimeoutInSeconds')] | ||||||||||||||||||
| [string] | ||||||||||||||||||
| $ExecutionTimeout = '14400', | ||||||||||||||||||
|
|
||||||||||||||||||
| [Parameter()] | ||||||||||||||||||
| [Alias('MachineContactTimeoutInMinutes', 'MachineContactTimeoutMinutes')] | ||||||||||||||||||
| [string] | ||||||||||||||||||
| $ExecutionTimeoutSeconds = '14400', | ||||||||||||||||||
| $MachineContactTimeout = 0, | ||||||||||||||||||
|
|
||||||||||||||||||
| [Parameter()] | ||||||||||||||||||
| [switch] | ||||||||||||||||||
|
|
@@ -144,18 +154,20 @@ function New-CCMDeploymentStep { | |||||||||||||||||
| switch ($PSCmdlet.ParameterSetName) { | ||||||||||||||||||
| 'Basic' { | ||||||||||||||||||
| $Body = @{ | ||||||||||||||||||
| Name = "$Name" | ||||||||||||||||||
| DeploymentPlanId = "$(Get-CCMDeployment -Name $Deployment | Select-Object -ExpandProperty Id)" | ||||||||||||||||||
| DeploymentStepGroups = @( | ||||||||||||||||||
| Get-CCMGroup -Group $TargetGroup | Select-Object Name, Id | ForEach-Object { | ||||||||||||||||||
| [pscustomobject]@{ groupId = $_.id; groupName = $_.name } | ||||||||||||||||||
| } | ||||||||||||||||||
| name = $Name | ||||||||||||||||||
| deploymentPlanId = (Get-CCMDeployment -Name $Deployment).id | ||||||||||||||||||
| deploymentStepGroups = @( | ||||||||||||||||||
| Get-CCMGroup -Group $TargetGroup | Select-Object -Property @( | ||||||||||||||||||
| @{ Name = "groupId"; Expression = { $_.id } } | ||||||||||||||||||
| @{ Name = "groupName"; Expression = { $_.name } } | ||||||||||||||||||
| ) | ||||||||||||||||||
| ) | ||||||||||||||||||
| ExecutionTimeoutInSeconds = "$ExecutionTimeoutSeconds" | ||||||||||||||||||
| RequireSuccessOnAllComputers = "$RequireSuccessOnAllComputers" | ||||||||||||||||||
| failOnError = "$FailOnError" | ||||||||||||||||||
| validExitCodes = "$($validExitCodes -join ',')" | ||||||||||||||||||
| script = "$($ChocoCommand.ToLower())|$($PackageName)" | ||||||||||||||||||
| executionTimeoutInSeconds = $ExecutionTimeout | ||||||||||||||||||
| machineContactTimeoutInMinutes = $MachineContactTimeout | ||||||||||||||||||
| requireSuccessOnAllComputers = $RequireSuccessOnAllComputers | ||||||||||||||||||
| failOnError = $FailOnError | ||||||||||||||||||
|
||||||||||||||||||
| executionTimeoutInSeconds = $ExecutionTimeout | |
| machineContactTimeoutInMinutes = $MachineContactTimeout | |
| requireSuccessOnAllComputers = $RequireSuccessOnAllComputers | |
| failOnError = $FailOnError | |
| executionTimeoutInSeconds = $ExecutionTimeout | |
| machineContactTimeoutInMinutes = $MachineContactTimeout | |
| requireSuccessOnAllComputers = $RequireSuccessOnAllComputers.IsPresent | |
| failOnError = $FailOnError.IsPresent |
JSON serialization doesn't handle these well, it treats a [switch] parameter object as an object with the form { IsPresent: true } rather than a raw boolean, make sure we take the inner property explicitly (this should be fixed below for consistency as well)
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cast ensures the collection is always preserved during json serialization; it seems some versions of powershell unwrap a one-element array, but leave other collection types intact.