summaryrefslogtreecommitdiff
path: root/lib/ansible/module_utils/powershell
diff options
context:
space:
mode:
authorJordan Borean <jborean93@gmail.com>2018-04-24 10:06:47 +1000
committerGitHub <noreply@github.com>2018-04-24 10:06:47 +1000
commitb6afe6946d388bae6617387b23306f169cd5916a (patch)
tree7c99b344a4c6320de4c498a90d376a7ea404c9ce /lib/ansible/module_utils/powershell
parent19d229a8e06a5cae95926c89b26044372df6964f (diff)
downloadansible-b6afe6946d388bae6617387b23306f169cd5916a.tar.gz
Ansible.ModuleUtils.FileUtil - Add ability to test non file system provider paths (#39200)
Diffstat (limited to 'lib/ansible/module_utils/powershell')
-rw-r--r--lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm14
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1 b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1
index 727da967f6..857bd1bfdf 100644
--- a/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1
+++ b/lib/ansible/module_utils/powershell/Ansible.ModuleUtils.FileUtil.psm1
@@ -19,6 +19,10 @@ Function Test-AnsiblePath {
$file_attributes = [System.IO.File]::GetAttributes($Path)
} catch [System.IO.FileNotFoundException], [System.IO.DirectoryNotFoundException] {
return $false
+ } catch [NotSupportedException] {
+ # When testing a path like Cert:\LocalMachine\My, System.IO.File will
+ # not work, we just revert back to using Test-Path for this
+ return Test-Path -Path $Path
}
if ([Int32]$file_attributes -eq -1) {