From 02fd75b6a1fa092f24b4d2e093340b002ec61855 Mon Sep 17 00:00:00 2001 From: Brian Wuchner Date: Wed, 23 Feb 2022 15:32:31 -0500 Subject: [PATCH] Updates to SaltStackConfig module Updates to function names and parameters to ensure consistency as discussed in PR 543. Signed-off-by: Brian Wuchner --- Modules/SaltStackConfig/SaltStackConfig.psd1 | 6 +++--- Modules/SaltStackConfig/SaltStackConfig.psm1 | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Modules/SaltStackConfig/SaltStackConfig.psd1 b/Modules/SaltStackConfig/SaltStackConfig.psd1 index c9fab93..5af29d0 100644 --- a/Modules/SaltStackConfig/SaltStackConfig.psd1 +++ b/Modules/SaltStackConfig/SaltStackConfig.psd1 @@ -17,7 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause RootModule = 'SaltStackConfig.psm1' # Version number of this module. -ModuleVersion = '0.0.7' +ModuleVersion = '0.0.8' # Supported PSEditions # CompatiblePSEditions = @() @@ -75,8 +75,8 @@ FormatsToProcess = @('SaltStackConfig.Format.ps1xml') # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. FunctionsToExport = @('Connect-SscServer', 'Disconnect-SscServer', 'Get-SscActivity', 'Get-SscData', 'Get-SscJob', 'Get-SscMaster', 'Get-SscMinionCache', 'Get-SscReturn', - 'Get-SscSchedule','Get-SscFile','Set-SscFile','New-SscFile','Remove-SscFile','Get-SscLicense','Get-SscvRALicense','Get-SscMinionKeyState','Set-SscMinionKeyState', - 'Remove-SscMinionKeyState') + 'Get-SscSchedule','Get-SscFile','Set-SscFile','New-SscFile','Remove-SscFile','Get-SscLicense','Get-SscvRALicense','Get-SscMinionKey','Set-SscMinionKey', + 'Remove-SscMinionKey') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @() diff --git a/Modules/SaltStackConfig/SaltStackConfig.psm1 b/Modules/SaltStackConfig/SaltStackConfig.psm1 index 904106a..cf16c19 100644 --- a/Modules/SaltStackConfig/SaltStackConfig.psm1 +++ b/Modules/SaltStackConfig/SaltStackConfig.psm1 @@ -515,7 +515,7 @@ Function Get-SscvRALicense { Get-SscData license get_vra_license } -Function Get-SscMinionKeyState { +Function Get-SscMinionKey { <# .NOTES =========================================================================== @@ -545,7 +545,7 @@ Function Get-SscMinionKeyState { } -Function Set-SscMinionKeyState { +Function Set-SscMinionKey { <# .NOTES =========================================================================== @@ -567,7 +567,8 @@ Function Set-SscMinionKeyState { param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)][string]$master, [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)][string]$minion, - [Parameter(Mandatory=$true)][ValidateSet('accept','reject')][string]$state + [Parameter(Mandatory, ParameterSetName='accept')][switch]$accept, + [Parameter(Mandatory, ParameterSetName='reject')][switch]$reject ) begin { @@ -575,6 +576,9 @@ Function Set-SscMinionKeyState { } process { + if ($PSCmdlet.ParameterSetName -eq 'accept') { $state = 'accept'} + if ($PSCmdlet.ParameterSetName -eq 'reject') { $state = 'reject'} + if ($PSCmdlet.ShouldProcess("$master : $minion" , $state)) { $collection += ,@($master, $minion) } @@ -592,7 +596,7 @@ Function Set-SscMinionKeyState { } } -Function Remove-SscMinionKeyState { +Function Remove-SscMinionKey { <# .NOTES ===========================================================================