Replaces a open/close to validate access with os.access in azure storageblob. (#65608)
This commit is contained in:
parent
52f2081e62
commit
3dd4b3c8a3
2 changed files with 6 additions and 7 deletions
2
changelogs/fragments/65608.yml
Normal file
2
changelogs/fragments/65608.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- azure_storageblob - use os.access to check for read rights.
|
|
@ -412,13 +412,10 @@ class AzureRMStorageBlob(AzureRMModuleBase):
|
|||
def src_is_valid(self):
|
||||
if not os.path.isfile(self.src):
|
||||
self.fail("The source path must be a file.")
|
||||
try:
|
||||
fp = open(self.src, 'r')
|
||||
fp.close()
|
||||
except IOError:
|
||||
self.fail("Failed to access {0}. Make sure the file exists and that you have "
|
||||
"read access.".format(self.src))
|
||||
return True
|
||||
if os.access(self.src, os.R_OK):
|
||||
return True
|
||||
self.fail("Failed to access {0}. Make sure the file exists and that you have "
|
||||
"read access.".format(self.src))
|
||||
|
||||
def dest_is_valid(self):
|
||||
if not self.check_mode:
|
||||
|
|
Loading…
Reference in a new issue