mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49389 from gtmanfred/2017.7
make file envs compatible with fileclient formats
This commit is contained in:
commit
7099164fa8
4 changed files with 26 additions and 1 deletions
|
@ -490,6 +490,15 @@ class Fileserver(object):
|
|||
return ret
|
||||
return list(ret)
|
||||
|
||||
def file_envs(self, load=None):
|
||||
'''
|
||||
Return environments for all backends for requests from fileclient
|
||||
'''
|
||||
if load is None:
|
||||
load = {}
|
||||
load.pop('cmd', None)
|
||||
return self.envs(**load)
|
||||
|
||||
def init(self, back=None):
|
||||
'''
|
||||
Initialize the backend, only do so if the fs supports an init function
|
||||
|
|
|
@ -963,7 +963,7 @@ class AESFuncs(object):
|
|||
self._file_list_emptydirs = self.fs_.file_list_emptydirs
|
||||
self._dir_list = self.fs_.dir_list
|
||||
self._symlink_list = self.fs_.symlink_list
|
||||
self._file_envs = self.fs_.envs
|
||||
self._file_envs = self.fs_.file_envs
|
||||
|
||||
def __verify_minion(self, id_, token):
|
||||
'''
|
||||
|
|
|
@ -296,6 +296,19 @@ def get_file(path,
|
|||
gzip)
|
||||
|
||||
|
||||
def envs():
|
||||
'''
|
||||
List available environments for fileserver
|
||||
|
||||
CLI Example
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' cp.envs
|
||||
'''
|
||||
return _client().envs()
|
||||
|
||||
|
||||
def get_template(path,
|
||||
dest,
|
||||
template='jinja',
|
||||
|
|
|
@ -614,3 +614,6 @@ class CPModuleTest(ModuleCase):
|
|||
self.assertTrue(os.path.isfile(tgt_cache_file), 'File was not cached on the master')
|
||||
finally:
|
||||
os.unlink(tgt_cache_file)
|
||||
|
||||
def test_envs(self):
|
||||
self.assertEqual(self.run_function('cp.envs'), ['base', 'prod'])
|
||||
|
|
Loading…
Add table
Reference in a new issue