mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Ansible.ModuleUtils.FileUtil - Add ability to test non file system provider paths (#39200)
This commit is contained in:
parent
19d229a8e0
commit
b6afe6946d
2 changed files with 17 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue