Merge pull request #47508 from gtmanfred/2017.7

allow pulling the mysql_query.run_file to pull from the fileserver
This commit is contained in:
Nicole Thomas 2018-05-10 14:12:27 -04:00 committed by GitHub
commit 82fb6ba366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,10 +56,13 @@ def run_file(name,
grain=None,
key=None,
overwrite=True,
saltenv=None,
**connection_args):
'''
Execute an arbitrary query on the specified database
.. versionadded:: 2017.7.0
name
Used only as an ID
@ -84,13 +87,17 @@ def run_file(name,
overwrite:
The file or grain will be overwritten if it already exists (default)
.. versionadded:: 2017.7.0
saltenv:
The saltenv to pull the query_file from
'''
ret = {'name': name,
'changes': {},
'result': True,
'comment': 'Database {0} is already present'.format(database)}
if any([query_file.startswith(proto) for proto in ['http://', 'https://', 'salt://', 's3://', 'swift://']]):
query_file = __salt__['cp.cache_file'](query_file, saltenv=saltenv or __env__)
if not os.path.exists(query_file):
ret['comment'] = 'File {0} does not exist'.format(query_file)
ret['result'] = False