File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 72
72
}
73
73
74
74
# Resolve implicit artifact references
75
- foreach ($pair in $Parameters.GetEnumerator ( )) {
76
- if ($pair .Value -notlike ' %!*!%' ) { continue }
75
+ foreach ($key in $ ( $ Parameters.Keys )) {
76
+ if ($Parameters . $key -notlike ' %!*!%' ) { continue }
77
77
78
- $artifactName = $pair .Value -replace ' ^%!(.+?)!%$' , ' $1'
79
- $Parameters [$pair . Key ] = (Get-PSMDBuildArtifact - Name $artifactName ).Value
78
+ $artifactName = $Parameters . $key -replace ' ^%!(.+?)!%$' , ' $1'
79
+ $Parameters [$Key ] = (Get-PSMDBuildArtifact - Name $artifactName ).Value
80
80
}
81
81
82
82
$Parameters
Original file line number Diff line number Diff line change 2
2
param (
3
3
$Parameters
4
4
)
5
+
6
+ trap {
7
+ if ($workingDirectory ) {
8
+ Remove-Item - Path $workingDirectory - Recurse - Force - ErrorAction SilentlyContinue
9
+ }
10
+ throw $_
11
+ }
5
12
6
13
$rootPath = $Parameters.RootPath
7
14
$actualParameters = $Parameters.Parameters
11
18
throw " No Sessions specified!"
12
19
}
13
20
14
- if ($actualParameters.Session | Where-Object State -NE Open ) {
21
+ if ($actualParameters.Session | Where-Object State -NE Opened ) {
15
22
throw " Sessions not open!"
16
23
}
17
24
if ($actualParameters.Repository -and (-not (Get-PSRepository - Name $actualParameters.Repository - ErrorAction Ignore))) {
29
36
# region Prepare modules to transfer
30
37
$workingDirectory = Join-Path - Path (Get-PSFPath - Name temp) - ChildPath " psmd_action_$ ( Get-Random ) "
31
38
$null = New-Item - Path $workingDirectory - ItemType Directory - Force - ErrorAction Stop
32
- trap {
33
- Remove-Item - Path $workingDirectory - Recurse - Force - ErrorAction SilentlyContinue
34
- throw $_
35
- }
36
39
37
40
$saveModuleParam = @ {
38
41
Path = $workingDirectory
64
67
if (-not $actualParameters.NoDelete ) {
65
68
Invoke-Command - Session $actualParameters.Session - ScriptBlock {
66
69
param ($Name )
70
+ if (-not (Test-Path - Path " $env: ProgramFiles \WindowsPowerShell\Modules\$Name " )) { return }
67
71
Remove-Item - Path " $env: ProgramFiles \WindowsPowerShell\Modules\$Name " - Recurse - Force
68
72
} - ArgumentList $moduleFolder.Name
69
73
}
You can’t perform that action at this time.
0 commit comments