Skip to content

Commit

Permalink
Merge pull request #482 from rubrikinc/jaap-480
Browse files Browse the repository at this point in the history
Fixed -Verbose incomplete message - Resolves #480
  • Loading branch information
mwpreston authored Oct 28, 2019
2 parents 93922c9 + e99c865 commit 8276a41
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## 2019-10-28

### Added [Function property to Get-RubrikAPIData]

* Added a new property `Function` to the output of Get-RubrikAPIData, this fixes an issue with verbose output as indicated in [Issue 480](https://github.com/rubrikinc/rubrik-sdk-for-powershell/issues/480)

## 2019-10-24

### Added [Added Availability Group parameters to Get-RubrikDatabase]
Expand Down
2 changes: 2 additions & 0 deletions Rubrik/Private/Get-RubrikAPIData.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2538,5 +2538,7 @@ function Get-RubrikAPIData($endpoint) {
}

Write-Verbose -Message "Selected $key API Data for $endpoint"
# Add the function name to resolve issue #480
$api.$endpoint.$key.Add('Function',$endpoint)
return $api.$endpoint.$key
} # End of function
2 changes: 1 addition & 1 deletion Rubrik/Rubrik.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'Rubrik.psm1'

# Version number of this module.
ModuleVersion = '4.0.511'
ModuleVersion = '4.0.512'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
13 changes: 13 additions & 0 deletions Tests/Get-RubrikAPIData.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@ Describe -Name 'Private/Get-RubrikAPIData' -Tag 'Private', 'Get-RubrikAPIData' -
$uriresult | Should -Contain $true
}
}

Context -Name "Should contain Function property as output" {
It -Name 'Verify property exists' -Test {
$functions = ( Get-ChildItem -Path './Rubrik/Public' |
Where-Object extension -eq '.ps1').Name.Replace('.ps1','')
$ignorelist = @('Invoke-RubrikRESTCall','Move-RubrikMountVMDK','Sync-RubrikAnnotation','Sync-RubrikTag','Get-RubrikObject')
$functions = $functions | Where-Object {$ignorelist -notcontains $_}
$functions | ForEach-Object {
(Get-RubrikAPIData -Endpoint $_).Function |
Should -BeExactly $_
}
}
}

Context -Name "Failure tests, validate incorrect input" -Fixture {
It -Name 'Get-RubrikAPIData - Incorrect version number, should fail' -Test {
Expand Down
40 changes: 39 additions & 1 deletion azure-pipelines/azure-pipelines-devel-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@ trigger:
pr: none

jobs:
- job: Verify_Skip_CI_Not_Present
displayname: 'Verify is [skip ci] is not specified'
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true
- script: |
gitlog=$(git log --oneline -1)
regex="\[skip ci\]"
if [[ $gitlog =~ $regex ]]
then
exit 1
fi
- job: Build_Using_Windows_PowerShell_on_Server_2019
displayName: 'Build Using Windows PowerShell on Server 2019'
dependsOn: Verify_Skip_CI_Not_Present
condition: in(dependencies.Verify_Skip_CI_Not_Present.result, 'Succeeded')
pool:
vmImage: 'windows-2019'
steps:
Expand All @@ -27,9 +44,30 @@ jobs:
TargetBranch: $(system.pullRequest.targetBranch)
PRNumber: $(system.pullRequest.pullRequestNumber)
LocalPath: $(Build.Repository.LocalPath)
GalleryAPIKey: $(PowerShellGalleryAPIKey)
- task: PublishPipelineArtifact@0
displayName: 'Publish Repository as artifact'
inputs:
artifactName: 'PipelinesScripts'
targetPath: .
condition: failed()
condition: failed()

- job: Commit_Changes_From_DevOps_To_GitHub
displayname: 'Commit Changes From DevOps To GitHub'
dependsOn: Build_Using_Windows_PowerShell_on_Server_2019
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true
- script: |
git config --global user.email "[email protected]"
git config --global user.name "jaapbrasser"
git branch devel
git checkout devel
git status
git branch
git add *
git commit -m "[skip ci] Adding changes from Azure DevOps Pipelines"
git push -u origin devel
4 changes: 2 additions & 2 deletions azure-pipelines/azure-pipelines-master-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pr: none

jobs:
- job: Verify_Skip_CI_Not_Present
displayname: "Verify is [skip ci] is not specified"
displayname: 'Verify is [skip ci] is not specified'
pool:
vmImage: 'ubuntu-latest'
steps:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
condition: failed()

- job: Commit_Changes_From_DevOps_To_GitHub
displayname: "Commit Changes From DevOps To GitHub"
displayname: 'Commit Changes From DevOps To GitHub'
dependsOn: Build_Using_Windows_PowerShell_on_Server_2019
pool:
vmImage: 'ubuntu-latest'
Expand Down

0 comments on commit 8276a41

Please sign in to comment.