mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
powershell: Respect remote_tmp path set by the user (#40210)
* powershell: Respect remote_tmp path set by the user * Fixed up linting error and typo * Added changelog
This commit is contained in:
parent
070a5557d1
commit
f84f3de7c2
18 changed files with 281 additions and 203 deletions
|
@ -14,6 +14,7 @@ $ErrorActionPreference = "Stop"
|
|||
$params = Parse-Args -arguments $args -supports_check_mode $true
|
||||
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
|
||||
$diff_mode = Get-AnsibleParam -obj $params -name "_ansible_diff" -type "bool" -default $false
|
||||
$_remote_tmp = Get-AnsibleParam $params "_ansible_remote_tmp" -type "path" -default $env:TMP
|
||||
|
||||
$name = Get-AnsibleParam -obj $params -name "name" -type "str" -failifempty $true
|
||||
$path = Get-AnsibleParam -obj $params -name "path" -type "str" -default "\"
|
||||
|
@ -82,7 +83,7 @@ if ($diff_mode) {
|
|||
$result.diff = @{}
|
||||
}
|
||||
|
||||
Add-Type -TypeDefinition @"
|
||||
$task_enums = @"
|
||||
public enum TASK_ACTION_TYPE // https://msdn.microsoft.com/en-us/library/windows/desktop/aa383553(v=vs.85).aspx
|
||||
{
|
||||
TASK_ACTION_EXEC = 0,
|
||||
|
@ -136,6 +137,14 @@ public enum TASK_TRIGGER_TYPE2 // https://msdn.microsoft.com/en-us/library/windo
|
|||
}
|
||||
"@
|
||||
|
||||
$original_tmp = $env:TMP
|
||||
$original_temp = $env:TEMP
|
||||
$env:TMP = $_remote_tmp
|
||||
$env:TEMP = $_remote_tmp
|
||||
Add-Type -TypeDefinition $task_enums
|
||||
$env:TMP = $original_tmp
|
||||
$env:TEMP = $original_temp
|
||||
|
||||
########################
|
||||
### HELPER FUNCTIONS ###
|
||||
########################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue