Merge pull request #101 from ZertoPublic/master

Merge Current Master to Release Branch
This commit is contained in:
Wes Carroll
2020-07-08 13:14:52 -04:00
committed by GitHub
17 changed files with 367 additions and 334 deletions
+15
View File
@@ -5,6 +5,21 @@ 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 is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.4.3]
### Zerto Virtual Manager
#### Updated
* Updated `Connect-ZertoServer` with a `-AutoReconnect` switch to allow the auto reconnection of a session that has timed-out.
* Updated `New-ZertoVpg` to have a Default Parameter Set of `recoveryHostDatastore` should no parameters be passed when calling the function.
* Updated `New-ZertoVpg -recoverySite` parameter to be case-insensitive
#### Fixed
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/96) with `Set-ZertoLicense` so that ShouldProcess functions properly.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/95) when attempting to connect to an unlicensed site.
## [1.4.2]
### Zerto Virtual Manager
+11 -12
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll {
@@ -45,6 +45,16 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
{ Connect-ZertoServer -zertoServer -credential 1234 } | Should -Throw
{ Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString' }) } | Should -Throw
}
It "has a switch parameter to return the headers" {
Get-Command $global:function | Should -HaveParameter returnHeaders
Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch
}
It "has a switch parameter to auto reauthorize the session" {
Get-Command $global:function | Should -HaveParameter autoReconnect
Get-Command $global:function | Should -HaveParameter autoReconnect -Type Switch
}
}
InModuleScope -ModuleName ZertoApiWrapper {
@@ -57,10 +67,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
return $results
}
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite {
return (Get-Content -Path "$global:here\Mocks\LocalSiteInfo.json" -Raw | ConvertFrom-Json)
}
Context "$($global:function)::InModuleScope Function Unit Tests" {
BeforeAll {
@@ -96,12 +102,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$script:zvmHeaders['Accept'] | Should -BeOfType String
}
It "Module Scope zvmLocalInfo variable tests" {
$script:zvmLocalInfo | Should -Not -BeNullOrEmpty
$script:zvmLocalInfo | Should -BeOfType PSCustomObject
$script:zvmLocalInfo.SiteIdentifier | Should -BeOfType String
}
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
It "returns a Hashtable with 2 keys" {
$headers | Should -BeOfType Hashtable
@@ -134,7 +134,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
}
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite -Exactly 4
}
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '5.5.11'
Version = '5.6.0'
Tags = 'Bootstrap'
}
@@ -31,7 +31,7 @@
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.18.3'
Version = '1.19.0'
Tags = 'Bootstrap'
}
+44 -43
View File
@@ -1,23 +1,24 @@
#Requires -Modules 'InvokeBuild'
$version = "{0}" -f $(Get-Content .\version.txt)
$moduleOutPath = "{0}\publish\ZertoApiWrapper" -f $BuildRoot
#Define the default task
task . CreateArtifacts
task . build
#Region - Helper Functions
function ImportSourceModule() {
function ImportSourceModule {
If (Get-Module -Name ZertoApiWrapper) {
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
}
Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop
}
function ImportBuiltModule() {
function ImportBuiltModule {
If (Get-Module -Name ZertoApiWrapper) {
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
}
Import-Module "$BuildRoot\temp\ZertoApiWrapper.psd1" -ErrorAction Stop
Import-Module ("{0}\ZertoApiWrapper.psd1" -f $moduleOutPath) -ErrorAction Stop
}
#EndRegion
@@ -65,7 +66,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
$scriptAnalyzerParams = @{
Path = "$BuildRoot\temp\"
Path = $moduleOutPath
Severity = @('Error', 'Warning')
Recurse = $true
Verbose = $false
@@ -81,17 +82,13 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
#EndRegion
#Region - Clean Operations
task CleanTemp {
if (-not $(Test-Path "$BuildRoot\temp")) {
New-Item -Path $BuildRoot -Name "temp" -ItemType "Directory"
}
Remove-Item -Recurse -Path "$BuildRoot\temp\*"
}
task CleanPublish {
if ($(Test-Path "$BuildRoot\publish")) {
Remove-Item -Recurse -Path "$BuildRoot\publish\*"
} else {
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
}
New-Item -Path $moduleOutPath -ItemType "Directory"
}
#EndRegion
@@ -107,7 +104,7 @@ task SourceFileTests CheckPesterInstalled, {
task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
ImportBuiltModule
$testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml"
$script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails
$script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Failed
$FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
Assert ($results.FailedCount -eq 0) $FailureMessage
}
@@ -116,7 +113,7 @@ task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
#Region - Build Help System
$buildMamlParams = @{
Inputs = { Get-ChildItem docs\*.md }
Outputs = "$BuildRoot\temp\en-us\ZertoApiWrapper-help.xml"
Outputs = "{0}\en-us\ZertoApiWrapper-help.xml" -f $moduleOutPath
}
task BuildMamlHelp CheckPlatyPSInstalled, {
@@ -126,19 +123,19 @@ task BuildMamlHelp CheckPlatyPSInstalled, {
platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs
}
task UpdateMarkdownHelp CheckPlatyPSInstalled, {
ImportSourceModule
task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, {
ImportBuiltModule
Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder
}
#EndRegion
#Region - Build Module Files
task CreatePsd1ForRelease CleanTemp, {
task CreatePsd1ForRelease CleanPublish, {
$functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName }
$releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version
$ManifestParams = @{
Path = "$BuildRoot\temp\ZertoApiWrapper.psd1"
Path = "{0}\ZertoApiWrapper.psd1" -f $moduleOutPath
RootModule = 'ZertoApiWrapper.psm1'
ModuleVersion = $version
GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325'
@@ -161,43 +158,47 @@ task CreatePsd1ForRelease CleanTemp, {
task CreatePsm1ForRelease CreatePsd1ForRelease, {
$emptyLine = ""
$psm1Path = "$BuildRoot\temp\ZertoApiWrapper.psm1"
$psm1Path = "{0}\ZertoApiWrapper.psm1" -f $moduleOutPath
$lines = '#------------------------------------------------------------#'
$Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop )
$Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop )
Add-Content -Path $psm1Path -Value $lines
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#"
Add-Content -Path $psm1Path -Value $lines
Add-Content -Path $psm1Path -Value $emptyLine
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
foreach ($file in $private) {
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
Add-Content -Path $psm1Path -Value $emptyLine
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
}
Add-Content -Path $psm1Path -Value $lines
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#"
Add-Content -Path $psm1Path -Value $lines
Add-Content -Path $psm1Path -Value $emptyLine
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
foreach ($file in $public) {
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
Add-Content -Path $psm1Path -Value $emptyLine
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
}
# Add-Content -Path $psm1Path -Value $emptyLine
# Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString"
}
#EndRegion
#Region - Artifacts \ Publish
# Full Build Process - No Publishing
task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTests, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
if (-not $(Test-Path "$BuildRoot\publish")) {
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip
$MyMatches = Select-String -Path "$BuildRoot\CHANGELOG.md" "^##\s\["
$data = Get-Content "$BuildRoot\CHANGELOG.md"
$range = ($MyMatches[0].LineNumber - 1)..($MyMatches[1].LineNumber - 3)
foreach ($i in $range) {
Add-Content -Path "$BuildRoot\publish\ReleaseNotes.md" -Value ($data[$i]).replace("## ", "# ") -Encoding utf8
}
Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip
#ImportBuiltModule
#(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt
#(Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt
Copy-Item "$BuildRoot\ZertoApiWrapper.build.ps1" "$BuildRoot\publish\ZertoApiWrapper.build.ps1"
Copy-Item "$BuildRoot\ZertoApiWrapper.Depend.psd1" "$BuildRoot\publish\ZertoApiWrapper.Depend.psd1"
Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1"
}
#EndRegion
task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts
task quickBuild CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, {
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
ImportBuiltModule
}
task release build, {
Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf
}
+18 -7
View File
@@ -5,11 +5,18 @@ function Connect-ZertoServer {
param(
[Parameter(
Mandatory,
HelpMessage = "IP address or FQDN of your Zerto Management Server"
HelpMessage = "IP address or FQDN of your Zerto Management Server",
Position = 0
)]
[ValidateNotNullOrEmpty()]
[Alias("server", "zvm")]
[string]$zertoServer,
[Parameter(
Mandatory,
HelpMessage = "Valid credentials to connect to the Zerto Management Server",
Position = 1
)]
[System.Management.Automation.PSCredential]$credential,
[Parameter(
HelpMessage = "Zerto Virtual Manager management port. Default value is 9669."
)]
@@ -18,11 +25,14 @@ function Connect-ZertoServer {
[Alias("port")]
[string]$zertoPort = "9669",
[Parameter(
Mandatory,
HelpMessage = "Valid credentials to connect to the Zerto Management Server"
HelpMessage = "Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused"
)]
[switch]$AutoReconnect,
[Parameter(
HelpMessage = "Use this switch to return the headers to a specified variable or to the default output."
)]
[System.Management.Automation.PSCredential]$credential,
[switch]$returnHeaders
)
begin {
@@ -38,6 +48,10 @@ function Connect-ZertoServer {
"Accept" = "application/json"
"zerto-triggered-by" = "PowershellWes"
}
Set-Variable -Name Reconnect -Scope Script -Value $AutoReconnect.IsPresent
if ($Script:Reconnect) {
Set-Variable -Name CachedCredential -Scope Script -Value $credential
}
}
process {
@@ -48,9 +62,6 @@ function Connect-ZertoServer {
end {
# Build Headers Hashtable with Authorization Token
$Script:zvmHeaders['x-zerto-session'] = $results.Headers['x-zerto-session'][0].ToString()
# Set common Script Scope Variables to be used other functions (Headers and Local Site Info)
# Set-Variable -Name zvmHeaders -Scope Script -Value $zertoAuthorizationHeaders
Set-Variable -Name zvmLocalInfo -Scope Script -Value (Get-ZertoLocalSite)
# Have the option to return the headers to a variable
if ($returnHeaders) {
@@ -12,5 +12,4 @@ function Disconnect-ZertoServer {
Remove-Variable -Name zvmPort -Scope Script
Remove-Variable -Name zvmLastAction -Scope Script
Remove-Variable -Name zvmHeaders -Scope Script
Remove-Variable -Name zvmLocalInfo -Scope Script
}
@@ -2,6 +2,6 @@
function Get-ZertoUnprotectedVm {
[cmdletbinding()]
param()
$uri = "virtualizationsites/{0}/vms" -f $script:zvmLocalInfo.siteidentifier
$uri = "virtualizationsites/{0}/vms" -f (Get-ZertoLocalSite).siteIdentifier
Invoke-ZertoRestRequest -uri $uri
}
+1 -1
View File
@@ -111,7 +111,7 @@ function Install-ZertoVra {
# If the VRA does not exist, proceed with the installation. If it does exist, bypass and
if ( -not (Get-ZertoVra -vraName $vraName) ) {
# Get identifiers for each item provided by name.
$siteIdentifier = $script:zvmLocalInfo.SiteIdentifier
$siteIdentifier = (Get-ZertoLocalSite).SiteIdentifier
$hostIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -hosts | Where-Object { $_.VirtualizationHostName -eq $hostName } | Select-Object hostIdentifier -ExpandProperty hostIdentifier
$networkIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -networks | Where-Object { $_.VirtualizationNetworkName -eq $networkName } | Select-Object NetworkIdentifier -ExpandProperty NetworkIdentifier
$datastoreIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -datastores | Where-Object { $_.DatastoreName -eq $datastoreName } | Select-Object DatastoreIdentifier -ExpandProperty DatastoreIdentifier
@@ -41,10 +41,12 @@ function Invoke-ZertoRestRequest {
}
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) ) {
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) {
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
} else {
} elseif (( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) {
Write-Verbose "Authorization had expired. Attempting Reauthorization."
Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential
}# else {
# Build the URI to be submitted
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
try {
@@ -103,6 +105,6 @@ public class TrustAllCertsPolicy : ICertificatePolicy {
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders
return $apiRequestAndHeaderResults
}
#}
}
}
+9 -9
View File
@@ -1,6 +1,6 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function New-ZertoVpg {
[cmdletbinding(SupportsShouldProcess = $true)]
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "recoveryHostDatastore")]
param(
[Parameter(
HelpMessage = "Name of the VPG",
@@ -165,7 +165,7 @@ function New-ZertoVpg {
begin {
# Create an identifiers table, and start converting names to identifiers.
$identifiersTable = @{ }
$identifiersTable['recoverySiteIdentifier'] = $(Get-ZertoPeerSite -peerName $recoverySite).siteIdentifier
$identifiersTable['recoverySiteIdentifier'] = (Get-ZertoPeerSite).Where({$_.PeerSiteName -like $recoverySite}) | Select-Object -ExpandProperty SiteIdentifier
$peerSiteNetworks = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -networks)
$identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $recoveryNetwork } | Select-Object -ExpandProperty NetworkIdentifier
$identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $testNetwork } | Select-Object -ExpandProperty NetworkIdentifier
@@ -182,18 +182,18 @@ function New-ZertoVpg {
# Get identifiers based on parameter set name
switch ($PSCmdlet.ParameterSetName) {
"recoveryClusterDatastoreCluster" {
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
}
"recoveryClusterDatastore" {
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
$identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier
}
"recoveryHostDatastoreCluster" {
$identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object { $_.VirtualizationHostName -like $recoveryHost }).HostIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
}
"recoveryHostDatastore" {
@@ -202,12 +202,12 @@ function New-ZertoVpg {
}
"recoveryResourcePoolDatastoreCluster" {
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
}
"recoveryResourcePoolDatastore" {
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
$identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ function Set-ZertoLicense {
}
process {
if ($PSCmdlet.ShouldProcess()) {
if ($PSCmdlet.ShouldProcess("Applying License Key: $licenseKey to server: $($script:zvmServer)")) {
Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "PUT"
}
}
+24 -58
View File
@@ -11,6 +11,7 @@ trigger:
include:
- master
- PowerShellBackPort
- Refactor-Build
# Trigger CI on pull requests to master and develop branches
pr:
@@ -27,23 +28,15 @@ jobs:
# Run build.ps1 script in PowerShell Core
- powershell: |
.\build.ps1 -Verbose
displayName: 'Build and Test'
displayName: "Build and Test"
# Upload test results to Azure Pipeline
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/SourceTestResults.xml'
testRunTitle: 'PS_Win2016_Source'
displayName: 'Publish Test Results'
testRunner: "NUnit"
testResultsFiles: "**/BuiltTestResults.xml"
testRunTitle: "PS_Win2016_Built"
displayName: "Publish Test Results"
condition: always()
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/BuiltTestResults.xml'
testRunTitle: 'PS_Win2016_Built'
displayName: 'Publish Test Results'
condition: always()
# Windows PowerShell Core Build Job
- job: Build_PSCore_Windows
@@ -55,21 +48,14 @@ jobs:
# Run build.ps1 script in PowerShell Core
- pwsh: |
.\build.ps1 -Verbose
displayName: 'Build and Test'
displayName: "Build and Test"
# Upload test results to Azure Pipeline
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/SourceTestResults.xml'
testRunTitle: 'PSCore_Win2016_Source'
displayName: 'Publish Test Results'
condition: always()
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/BuiltTestResults.xml'
testRunTitle: 'PSCore_Win2016_Built'
displayName: 'Publish Test Results'
testRunner: "NUnit"
testResultsFiles: "**/BuiltTestResults.xml"
testRunTitle: "PSCore_Win2016_Built"
displayName: "Publish Test Results"
condition: always()
# Linux Build Job
@@ -82,32 +68,19 @@ jobs:
# Run build.ps1 script in PowerShell Core
- pwsh: |
.\build.ps1 -verbose
displayName: 'Build and Test'
displayName: "Build and Test"
# Upload test results to Azure Pipeline
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/SourceTestResults.xml'
testRunTitle: 'PSCore_Ubuntu_Source'
displayName: 'Publish Test Results'
testRunner: "NUnit"
testResultsFiles: "**/BuiltTestResults.xml"
testRunTitle: "PSCore_Ubuntu_Built"
displayName: "Publish Test Results"
condition: always()
- task: PublishTestResults@2
- task: PublishPipelineArtifact@1
displayName: "Publish Data"
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/BuiltTestResults.xml'
testRunTitle: 'PSCore_Ubuntu_Built'
displayName: 'Publish Test Results'
condition: always()
- task: PublishPipelineArtifact@0
displayName: 'Publish compiled module Artifact'
inputs:
artifactName: 'ZertoApiWrapper'
targetPath: ./temp
condition: always()
- task: PublishPipelineArtifact@0
displayName: 'Publish Data'
inputs:
artifactName: 'ReleaseData'
artifactName: "ReleaseData"
targetPath: ./publish
condition: always()
@@ -121,19 +94,12 @@ jobs:
# Run build.ps1 script in PowerShell Core
- pwsh: |
.\build.ps1 -verbose
displayName: 'Build and Test'
displayName: "Build and Test"
# Upload test results to Azure Pipeline
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/SourceTestResults.xml'
testRunTitle: 'PSCore_MacOS1013_Source'
displayName: 'Publish Test Results'
condition: always()
- task: PublishTestResults@2
inputs:
testRunner: 'NUnit'
testResultsFiles: '**/BuiltTestResults.xml'
testRunTitle: 'PSCore_MacOS1013_Built'
displayName: 'Publish Test Results'
testRunner: "NUnit"
testResultsFiles: "**/BuiltTestResults.xml"
testRunTitle: "PSCore_MacOS1013_Built"
displayName: "Publish Test Results"
condition: always()
+5 -2
View File
@@ -1,3 +1,5 @@
param([validateSet("build", "release")]$operation = "build")
# Bootstrap the environment
$null = Get-PackageProvider -Name NuGet -ForceBootstrap
@@ -11,6 +13,7 @@ Invoke-PSDepend `
-Force `
-Import `
-Install `
-Tags 'Bootstrap'
-Tags 'Bootstrap' `
-ErrorAction Continue
Invoke-Build .
Invoke-Build $operation
+2 -2
View File
@@ -31,10 +31,10 @@ Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP addre
### Example 2
```powershell
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -token "GeneratedFromTargetZVM"
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -targetPort "9071" -token "GeneratedFromTargetZVM"
```
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100 over Port 9071. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
## PARAMETERS
+26 -3
View File
@@ -13,7 +13,7 @@ Establishes a connection to a ZVM.
## SYNTAX
```
Connect-ZertoServer [-zertoServer] <String> [[-zertoPort] <String>] [-credential] <PSCredential>
Connect-ZertoServer [-zertoServer] <String> [-credential] <PSCredential> [-zertoPort <String>] [-AutoReconnect]
[-returnHeaders] [<CommonParameters>]
```
@@ -29,8 +29,31 @@ PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -cred
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
### Example 2
```powershell
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -AutoReconnect
```
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. Adding the `-AutoReconnect` switch
will cache the PSCredential object should the session need to be reauthorized due to an expired token.
## PARAMETERS
### -AutoReconnect
Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -credential
Valid credentials to connect to the Zerto Management Server
@@ -40,7 +63,7 @@ Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
@@ -71,7 +94,7 @@ Parameter Sets: (All)
Aliases: port
Required: False
Position: 1
Position: Named
Default value: "9669"
Accept pipeline input: False
Accept wildcard characters: False
+15 -1
View File
@@ -66,13 +66,27 @@ PS C:\> Get-ZertoEvent -eventId "Need an eventID"
Returns information for each -eventID specified.
### Example 1
### Example 3
```powershell
PS C:\> Get-ZertoEvent -startDate "2019-01-01" -endDate "2019-01-07" -vpg "My Vpg"
```
Returns all events between Jan. 01, 2019 and Jan. 07, 2019 (inclusive) for the vpg "My Vpg"
### Example 4
```powershell
PS C:\> Get-ZertoEvent -userName "Domain.tld\MyUser
```
Returns all events associated with the username passed into the command.
### Example 5
```powershell
PS C:\> Get-ZertoEvent -startDate "2019-01-01T12:30:00" -endDate "2019-01-01T13:30:00" -vpg "My Vpg"
```
Returns all events between Jan. 01, 2019 12:30 PM and Jan. 01, 2019 1:30 PM (inclusive) for the vpg "My Vpg"
## PARAMETERS
### -alertIdentifier
+1 -1
View File
@@ -1 +1 @@
1.4.2
1.4.3