1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

now dataloader checkis that you get at least a valid string as a file name

This commit is contained in:
Brian Coca 2015-07-21 08:47:13 -04:00
parent 7124504ccf
commit 827b0443c8

View file

@ -137,6 +137,8 @@ class DataLoader():
Reads the file contents from the given file name, and will decrypt them Reads the file contents from the given file name, and will decrypt them
if they are found to be vault-encrypted. if they are found to be vault-encrypted.
''' '''
if not file_name or not isinstance(file_name, basestring):
raise AnsibleParserError("Invalid filename: '%s'" % str(file_name))
if not self.path_exists(file_name) or not self.is_file(file_name): if not self.path_exists(file_name) or not self.is_file(file_name):
raise AnsibleParserError("the file_name '%s' does not exist, or is not readable" % file_name) raise AnsibleParserError("the file_name '%s' does not exist, or is not readable" % file_name)