Ansible.ModuleUtils.FileUtil: catch DirectoryNotFoundException when testing a path (#37968)

This commit is contained in:
Jordan Borean 2018-03-27 16:19:45 +10:00 committed by GitHub
parent 63da50e1d8
commit 68e44e082e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View file

@ -17,7 +17,7 @@ Function Test-AnsiblePath {
# Replacement for Test-Path
try {
$file_attributes = [System.IO.File]::GetAttributes($Path)
} catch [System.IO.FileNotFoundException] {
} catch [System.IO.FileNotFoundException], [System.IO.DirectoryNotFoundException] {
return $false
}