cp.get_url: add note and test for https:// URL with `dest=None`

This commit is contained in:
Denys Havrysh 2016-10-17 17:23:03 +03:00
parent ff55f77179
commit c7cf79e959
2 changed files with 23 additions and 1 deletions

View file

@ -322,7 +322,13 @@ def get_url(path, dest='', saltenv='base', env=None):
destination path. If this parameter is omitted or set as empty string
(``''``), the function places the file on the local filesystem inside
the Minion cache directory and will return the path to that file.
To simply return the file contents instead, set destination to ``None``.
.. note::
To simply return the file contents instead, set destination to
``None``. This works with ``salt://``, ``http://`` and ``https://``
URLs. The files fetched by ``http://`` and ``https://`` will not be
cached.
saltenv : base
Salt fileserver envrionment from which to retrieve the file. Ignored if

View file

@ -220,6 +220,22 @@ class CPModuleTest(integration.ModuleCase):
self.assertIn('Windows', data)
self.assertNotIn('AYBABTU', data)
def test_get_url_https_no_dest(self):
'''
cp.get_url with https:// source given and destination set as None
'''
tgt = None
ret = self.run_function(
'cp.get_url',
[
'https://repo.saltstack.com/index.html',
tgt,
])
self.assertIn('Bootstrap', ret)
self.assertIn('Debian', ret)
self.assertIn('Windows', ret)
self.assertNotIn('AYBABTU', ret)
def test_cache_file(self):
'''
cp.cache_file