Skip to content

Commit fe2647c

Browse files
Fixes to resource
1 parent 85b0bec commit fe2647c

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/dsc/psresourceget.ps1

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,13 +542,18 @@ function SetOperation {
542542
'repository' {
543543
$rep = Get-PSResourceRepository -Name $inputObj.Name -ErrorAction SilentlyContinue
544544

545-
$properties = @('Name', 'Uri', 'Trusted', 'Priority', 'RepositoryType')
545+
$properties = @('name', 'uri', 'trusted', 'priority', 'repositoryType')
546546

547547
$splatt = @{}
548548

549549
foreach($property in $properties) {
550550
if ($null -ne $inputObj.PSObject.Properties[$property]) {
551-
$splatt[$property] = $inputObj.$property
551+
if ($property -eq 'repositoryType') {
552+
$splatt['ApiVersion'] = $inputObj.$property
553+
}
554+
else {
555+
$splatt[$property] = $inputObj.$property
556+
}
552557
}
553558
}
554559

@@ -568,8 +573,8 @@ function SetOperation {
568573
return GetOperation -ResourceType $ResourceType
569574
}
570575

571-
'repositorylist' { throw [System.NotImplementedException]::new("Get operation is not implemented for RepositoryList resource.") }
572-
'psresource' { throw [System.NotImplementedException]::new("Get operation is not implemented for PSResource resource.") }
576+
'repositorylist' { throw [System.NotImplementedException]::new("Set operation is not implemented for RepositoryList resource.") }
577+
'psresource' { throw [System.NotImplementedException]::new("Set operation is not implemented for PSResource resource.") }
573578
'psresourcelist' { return SetPSResourceList -inputObj $inputObj }
574579
default { throw "Unknown ResourceType: $ResourceType" }
575580
}
@@ -585,7 +590,7 @@ function DeleteOperation {
585590
$inputObj = $stdinput | ConvertFrom-Json -ErrorAction Stop
586591
switch ($ResourceType) {
587592
'repository' {
588-
if (-not $inputObj._exist -ne $false) {
593+
if ($inputObj._exist -ne $false) {
589594
throw "_exist property is not set to false for the repository. Cannot delete."
590595
}
591596

0 commit comments

Comments
 (0)