Skip to content

Commit

Permalink
2.3.1rc
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Sep 15, 2021
1 parent 2011603 commit 138aa5e
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 26 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ name: Publish Module to PowerShell Gallery

# Only trigger on published releases
on:
push:
release:
types: [published]
release:
types: [published]

jobs:
publish-to-gallery:
Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.3.0]()
## [2.3.1]() - 2021-09-14
### Added
- Migrated scripts from https://github.com/dell/OpenManage-Enterprise/tree/master/PowerShell
- Get-OMEAuditLog
Expand Down Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Changed Invoke-OMETemplateDeploy to use SecureString for -NetworkBootSharePassword
- Added -UseAllProtocols parameter to New-OMEDiscovery ([Issue #4](https://github.com/dell/OpenManage-PowerShell-Modules/issues/4))

### Fixed
- Fixed Set-CertPolicy to allow multiple Connect-OME within script ([Issue #2](https://github.com/dell/OpenManage-PowerShell-Modules/issues/2))
Expand Down
1 change: 1 addition & 0 deletions DellOpenManage/Classes/SessionAuth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ Class SessionAuth {
[String]$Id
[String]$Host
[String]$Token
[System.Version]$Version
[Boolean]$IgnoreCertificateWarning
}
6 changes: 3 additions & 3 deletions DellOpenManage/DellOpenManage.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Generated by: Trevor Squillario <[email protected]>
#
# Generated on: 9/3/2021
# Generated on: 9/14/2021
#

@{
Expand All @@ -12,7 +12,7 @@
RootModule = 'DellOpenManage.psm1'

# Version number of this module.
ModuleVersion = '2.3.0'
ModuleVersion = '2.3.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -27,7 +27,7 @@ Author = 'Trevor Squillario <[email protected]>'
CompanyName = 'Dell EMC'

# Copyright statement for this module
Copyright = '(c) 2020 Dell EMC. All rights reserved.'
Copyright = '(c) 2021 Dell EMC. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Dell OpenManage Enterprise PowerShell Module'
Expand Down
19 changes: 18 additions & 1 deletion DellOpenManage/Public/OME/Connect-OMEServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,29 @@ param(
$SessResponse = Invoke-WebRequest -Uri $SessionUrl -Method Post -Body $UserDetails -ContentType $Type
if ($SessResponse.StatusCode -eq 200 -or $SessResponse.StatusCode -eq 201) {
$SessResponseData = $SessResponse.Content | ConvertFrom-Json

$Token = [String]$SessResponse.Headers["X-Auth-Token"]
$Headers = @{}
$Headers."X-Auth-Token" = $Token

# Get Appliance Version
$AppInfoUrl = "https://$($OMEHost)/api/ApplicationService/Info"
$AppInfoResponse = Invoke-WebRequest -Uri $AppInfoUrl -UseBasicParsing -Method Get -Headers $Headers -ContentType $Type
$AppVersion = [System.Version]"1.0.0"
if ($AppInfoResponse.StatusCode -eq 200 -or $AppInfoResponse.StatusCode -eq 201) {
$AppInfoResponseData = $AppInfoResponse.Content | ConvertFrom-Json
Write-Verbose $($AppInfoResponseData)
$AppVersion = [System.Version]$AppInfoResponseData.Version
}

$Script:SessionAuth = [SessionAuth]@{
Host = $OMEHost
Token = $SessResponse.Headers["X-Auth-Token"]
Token = $Token
Id = $SessResponseData.Id
Version = $AppVersion
IgnoreCertificateWarning = $IgnoreCertificateWarning
}

} else {
Write-Error "Unable to create a session with appliance $($OMEHost)"
}
Expand Down
6 changes: 6 additions & 0 deletions DellOpenManage/Public/OME/Edit-OMESupportAssistGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ Begin {
Break
Return
}
# Add version check for SupportAssist commandlets
if ($SessionAuth.Version -lt [System.Version]"3.5.0") {
Write-Error "SupportAssist API not supported in version $($SessionAuth.Version) of OpenManage Enterprise"
Break
Return
}
}
Process {
Try {
Expand Down
6 changes: 6 additions & 0 deletions DellOpenManage/Public/OME/Get-OMESupportAssistCase.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Begin {
Break
Return
}
# Add version check for SupportAssist commandlets
if ($SessionAuth.Version -lt [System.Version]"3.5.0") {
Write-Error "SupportAssist API not supported in version $($SessionAuth.Version) of OpenManage Enterprise"
Break
Return
}
}
Process {

Expand Down
6 changes: 6 additions & 0 deletions DellOpenManage/Public/OME/Get-OMESupportAssistGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ Begin {
Break
Return
}
# Add version check for SupportAssist commandlets
if ($SessionAuth.Version -lt [System.Version]"3.5.0") {
Write-Error "SupportAssist API not supported in version $($SessionAuth.Version) of OpenManage Enterprise"
Break
Return
}
}

Process {
Expand Down
19 changes: 13 additions & 6 deletions DellOpenManage/Public/OME/New-OMEDiscovery.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUserName, [SecureString] $DiscoveryPassword, $Email, $SetTrapDestination, $Schedule, $ScheduleCron) {
function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUserName, [SecureString] $DiscoveryPassword, $Email, $SetTrapDestination, $UseAllProtocols, $Schedule, $ScheduleCron) {
$DiscoveryConfigPayload = '{
"DiscoveryConfigGroupName":"Server Discovery",
"DiscoveryStatusEmailRecipient":"",
Expand Down Expand Up @@ -70,6 +70,10 @@ function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUser
$DiscoveryConfigPayload.DiscoveryStatusEmailRecipient.PSObject.Properties.Remove("DiscoveryConfigTargets")
}
$DiscoveryConfigPayload.TrapDestination = $SetTrapDestination
# Add version check for UseAllProfiles
if ($SessionAuth.Version -ge [System.Version]"3.7.0") {
$DiscoveryConfigPayload | Add-Member -NotePropertyName UseAllProfiles -NotePropertyValue $UseAllProtocols
}
$DiscoveryConfigPayload.DiscoveryConfigModels[0].PSObject.Properties.Remove("DiscoveryConfigTargets")
$DiscoveryConfigPayload.DiscoveryConfigModels[0]| Add-Member -MemberType NoteProperty -Name 'DiscoveryConfigTargets' -Value @()
foreach ($DiscoveryHost in $HostList) {
Expand Down Expand Up @@ -166,6 +170,8 @@ limitations under the License.
Email upon completion
.PARAMETER SetTrapDestination
Set trap destination of iDRAC to OpenManage Enterprise upon discovery
.PARAMETER UseAllProtocols
Execute all selected protocols when discovering devices. This will increase this discovery task's execution time.
.PARAMETER Schedule
Determines when the discovery job will be executed. (Default="RunNow", "RunLater")
.PARAMETER ScheduleCron
Expand Down Expand Up @@ -232,6 +238,9 @@ param(
[String[]] $Protocol = @("wsman", "redfish"),
#>

[Parameter(Mandatory=$false)]
[Switch]$UseAllProtocols,

[Parameter(Mandatory=$false)]
[Switch]$Wait,

Expand All @@ -256,9 +265,9 @@ Process {

$DiscoverUrl = $BaseUri + "/api/DiscoveryConfigService/DiscoveryConfigGroups"
if ($Hosts.Count -gt 0) {
$Payload = Get-DiscoverDevicePayload -Name $Name -HostList $Hosts -DeviceType $DeviceType -DiscoveryUserName $DiscoveryUserName -DiscoveryPassword $DiscoveryPassword -Email $Email -SetTrapDestination $SetTrapDestination.IsPresent -Schedule $Schedule -ScheduleCron $ScheduleCron
$Payload = Get-DiscoverDevicePayload -Name $Name -HostList $Hosts -DeviceType $DeviceType -DiscoveryUserName $DiscoveryUserName -DiscoveryPassword $DiscoveryPassword -Email $Email -SetTrapDestination $SetTrapDestination -UseAllProtocols $UseAllProtocols -Schedule $Schedule -ScheduleCron $ScheduleCron
$Payload = $Payload | ConvertTo-Json -Depth 6
$DiscoverResponse = Invoke-WebRequest -Uri $DiscoverUrl -UseBasicParsing -Method Post -Body $Payload -Headers $Headers -ContentType $Type
$DiscoverResponse = Invoke-WebRequest -Uri $DiscoverUrl -UseBasicParsing -Method Post -Body $Payload -Headers $Headers -ContentType $Type
if ($DiscoverResponse.StatusCode -eq 201) {
Write-Verbose "Discovering devices...."
Start-Sleep -Seconds 10
Expand All @@ -280,9 +289,7 @@ Process {
}
}
Catch {
Write-Error ($_.ErrorDetails)
Write-Error ($_.Exception | Format-List -Force | Out-String)
Write-Error ($_.InvocationInfo | Format-List -Force | Out-String)
Resolve-Error $_
}
}

Expand Down
16 changes: 11 additions & 5 deletions DellOpenManage/Public/OME/New-OMESupportAssistGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,17 @@ param(

## Script that does the work
Begin {
if(!$SessionAuth.Token){
Write-Error "Please use Connect-OMEServer first"
Break
Return
}
if(!$SessionAuth.Token){
Write-Error "Please use Connect-OMEServer first"
Break
Return
}
# Add version check for SupportAssist commandlets
if ($SessionAuth.Version -lt [System.Version]"3.5.0") {
Write-Error "SupportAssist API not supported in version $($SessionAuth.Version) of OpenManage Enterprise"
Break
Return
}
}

Process {
Expand Down
6 changes: 6 additions & 0 deletions DellOpenManage/Public/OME/Remove-OMESupportAssistGroup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ Begin {
Break
Return
}
# Add version check for SupportAssist commandlets
if ($SessionAuth.Version -lt [System.Version]"3.5.0") {
Write-Error "SupportAssist API not supported in version $($SessionAuth.Version) of OpenManage Enterprise"
Break
Return
}
}
Process {
Try {
Expand Down
4 changes: 4 additions & 0 deletions DellOpenManage/Public/OME/Set-OMEPowerState.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,14 @@ Process {
if($PowerState){
if($PowerControlStateMap[$State] -eq $PowerState ){
Write-Verbose "Device is already in the desired state."
return "Completed"
}elseif(($State -eq "On") -and ($PowerState -eq $PowerStateMap["PoweringOn"])){
Write-Verbose "Device is already in the desired state."
return "Completed"
}
elseif(($State -eq "Off") -and ($PowerState -eq $PowerStateMap["PoweringOff"])){
Write-Verbose "Device is already in the desired state. "
return "Completed"
}
else{
$JobServicePayload = Get-JobServicePayload
Expand All @@ -173,6 +176,7 @@ Process {
else {
Write-Error "Unable to $($State) device..."
Write-Error $JobResponse
return "Failed"
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Release Process

## Run Pester Tests
```
.\Tests\Main.Tests.ps1 -Server "192.168.1.100"
```

## Run PSScriptAnalyzer
```
.\Tests\Invoke-PSScriptAnalyzer.ps1
```

## Bump Version
```
.\Build-Module.ps1 -Version 2.3.1
```

## Commit Changes
```
git checkout main
git merge devel
git commit -m 'Release 2.3.1'
# Only tag releases as this triggers a git workflow (.github/workflows/create-release.yml)
git tag v2.3.1
git push origin v2.3.1
git push origin main
```
2 changes: 1 addition & 1 deletion Tests/Device.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Describe "Device Tests" {
}

It "Should submit job to power on device" {
$TestDeviceServiceTags | Set-OMEPowerState -State "On" | Should -BeOfType System.Int64
$TestDeviceServiceTags | Set-OMEPowerState -State "On" | Should -Be "Completed"
}
}
}
2 changes: 1 addition & 1 deletion Tests/Firmware.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Describe "Firmware Tests" {

It "Should try to update firmware from DUP with preview only" -Tag "DUP" {
$devices = $($DeviceServiceTag | Get-OMEDevice -FilterBy "ServiceTag")
Update-OMEFirmwareDUP -Device $devices -UpdateSchedule "Preview" -DupFile "C:\Temp\BIOS_92RFG_WN64_2.11.2.EXE" | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterThan 0
Update-OMEFirmwareDUP -Device $devices -UpdateSchedule "Preview" -DupFile "C:\Temp\BIOS_92RFG_WN64_2.11.2.EXE" | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterOrEqual 0
}

#It ("Should try to update firmware from DUP") {
Expand Down
8 changes: 4 additions & 4 deletions Tests/Group.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ Describe "Group Tests" {
}

It "Should create new Group" {
New-OMEGroup -Name $TestNewGroup -Verbose
$TestNewGroup | Get-OMEGroup -Verbose | Select-Object -ExpandProperty Name | Should -Be $TestNewGroup
New-OMEGroup -Name $TestNewGroup
$TestNewGroup | Get-OMEGroup | Select-Object -ExpandProperty Name | Should -Be $TestNewGroup
}

It "Should edit Group name" {
$TestNewGroup | Get-OMEGroup | Edit-OMEGroup -Name $TestNewGroupEdit -Description "This is a test" -Verbose
$TestNewGroupEdit | Get-OMEGroup -Verbose | Select-Object -ExpandProperty Name | Should -Be $TestNewGroupEdit
$TestNewGroup | Get-OMEGroup | Edit-OMEGroup -Name $TestNewGroupEdit -Description "This is a test"
$TestNewGroupEdit | Get-OMEGroup | Select-Object -ExpandProperty Name | Should -Be $TestNewGroupEdit
}

It "Should added Devices to Group" {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SupportAssist.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Describe "Support Assist Tests" {
It "Should add devices to support assist group" {
$devices = $($Script:DeviceServiceTag | Get-OMEDevice -FilterBy "ServiceTag")
$Script:TestSupportAssistGroupName | Get-OMEGroup | Edit-OMESupportAssistGroup -Devices $devices
Get-OMEDevice -Group $("Support Assist Group 1" | Get-OMEGroup) | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterThan 0
Get-OMEDevice -Group $($Script:TestSupportAssistGroupName | Get-OMEGroup) | Measure-Object | Select-Object -ExpandProperty Count | Should -BeGreaterThan 0
}

It "Should edit support assist group" {
Expand Down

0 comments on commit 138aa5e

Please sign in to comment.