Skip to content

Commit

Permalink
fixing bug when there are multiple sessions detected when checking ca…
Browse files Browse the repository at this point in the history
…ll stack
  • Loading branch information
reubenmiller committed Jan 17, 2021
1 parent bae382b commit ac2226d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ No unreleased features

## Released

### v1.9.1

#### Bug fixes

* `Get-C8ySessionProperty` selects first matching Session parameter in the call stack if multiple matches are found

### v1.9.0

### New features
Expand Down
2 changes: 1 addition & 1 deletion tools/PSc8y/PSc8y.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = './PSc8y.psm1'

# Version number of this module.
ModuleVersion = '1.9.0'
ModuleVersion = '1.9.1'

# Supported PSEditions
CompatiblePSEditions = @(
Expand Down
8 changes: 5 additions & 3 deletions tools/PSc8y/Public-manual/Get-C8ySessionProperty.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ string
tenant = $env:C8Y_TENANT
}

# Is calling cmdlet using the session variable?
$Session = (Get-PSCallStack).InvocationInfo.BoundParameters.Session
$Values = Get-Session -Session:$Session
$Session = (Get-PSCallStack).InvocationInfo.BoundParameters.Session | Select-Object -First 1

if ($Session) {
$Values = Get-Session -Session:$Session
}
$Values | Select-Object -ExpandProperty $Name
}

0 comments on commit ac2226d

Please sign in to comment.