Skip to content

Commit a4004dc

Browse files
committed
Corrected a bug and better parameter handling for Get-NSSystemFile
1 parent 32df3ac commit a4004dc

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

NetScaler/Private/_InvokeNSRestApiGet.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function _InvokeNSRestApiGet {
4646

4747
if ($Name.Count -gt 0) {
4848
foreach ($item in $Name) {
49-
$response = _InvokeNSRestApi -Session $Session -Method Get -Type $Type -Resource $item -Action Get -Filters $Filters
49+
$response = _InvokeNSRestApi -Session $Session -Method Get -Type $Type -Resource $item -Action Get -Filters $Filters -Arguments $Arguments
5050
if ($response.errorcode -ne 0) { throw $response }
5151
if ($Response.psobject.properties.name -contains $Type) {
5252
$response.$Type

NetScaler/Public/Get-NSSystemFile.ps1

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ function Get-NSSystemFile {
5252
param(
5353
$Session = $Script:Session,
5454

55-
[Parameter(Position=0, ParameterSetName='get')]
55+
[Parameter(Position=0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
5656
[string[]]$Name = @(),
5757

5858
[Parameter(ParameterSetName='search')]
59-
6059
[string]$Filename,
6160

62-
[Parameter(ParameterSetName='search')]
63-
61+
[Parameter(Mandatory)]
6462
[string]$FileLocation
6563
)
6664

@@ -70,13 +68,12 @@ function Get-NSSystemFile {
7068

7169
process {
7270
# Contruct a filter hash if we specified any filters
73-
$Filters = @{}
71+
$Filters = @{
72+
filelocation = $FileLocation
73+
}
7474
if ($PSBoundParameters.ContainsKey('Filename')) {
7575
$Filters['filename'] = $Filename
7676
}
77-
if ($PSBoundParameters.ContainsKey('FileLocation')) {
78-
$Filters['filelocation'] = $FileLocation
79-
}
8077
_InvokeNSRestApiGet -Session $Session -Type systemfile -Name $Name -Arguments $Filters
8178
}
82-
}
79+
}

0 commit comments

Comments
 (0)