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:
Jordan Borean 2018-05-23 07:12:32 +10:00 committed by GitHub
parent 070a5557d1
commit f84f3de7c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 281 additions and 203 deletions

View file

@ -19,6 +19,7 @@
$params = Parse-Args -arguments $args -supports_check_mode $true
$check_mode = Get-AnsibleParam -obj $params "_ansible_check_mode" -type 'bool' -default $false
$_remote_tmp = Get-AnsibleParam $params "_ansible_remote_tmp" -type "path" -default $env:TMP
$location = Get-AnsibleParam -obj $params -name 'location' -type 'str'
$format = Get-AnsibleParam -obj $params -name 'format' -type 'str'
@ -98,7 +99,14 @@ Function Copy-RegistryKey($source, $target) {
Function Set-CultureLegacy($culture) {
# For when Set-Culture is not available (Pre Windows 8 and Server 2012)
$reg_key = 'HKCU:\Control Panel\International'
$original_tmp = $env:TMP
$original_temp = $env:TEMP
$env:TMP = $_remote_tmp
$env:TEMP = $_remote_tmp
Add-Type -TypeDefinition $lctype_util
$env:TMP = $original_tmp
$env:TEMP = $original_temp
$lookup = New-Object Ansible.LocaleHelper($culture)
# hex values are from http://www.pinvoke.net/default.aspx/kernel32/GetLocaleInfoEx.html