mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
commit
b40c611d0d
@ -132,7 +132,7 @@ built in ``__opts__`` data can be passed:
|
||||
|
||||
import salt.minion
|
||||
|
||||
def get_file(path, dest, env='base'):
|
||||
def get_file(path, dest, saltenv='base'):
|
||||
'''
|
||||
Used to get a single file from the Salt master
|
||||
|
||||
@ -142,7 +142,7 @@ built in ``__opts__`` data can be passed:
|
||||
# Create the FileClient object
|
||||
client = salt.minion.FileClient(__opts__)
|
||||
# Call get_file
|
||||
return client.get_file(path, dest, False, env)
|
||||
return client.get_file(path, dest, False, saltenv)
|
||||
|
||||
Using the FileClient class outside of a minion module where the ``__opts__``
|
||||
data is not available, it needs to be generated:
|
||||
@ -152,7 +152,7 @@ data is not available, it needs to be generated:
|
||||
import salt.minion
|
||||
import salt.config
|
||||
|
||||
def get_file(path, dest, env='base'):
|
||||
def get_file(path, dest, saltenv='base'):
|
||||
'''
|
||||
Used to get a single file from the Salt master
|
||||
'''
|
||||
@ -161,4 +161,4 @@ data is not available, it needs to be generated:
|
||||
# Create the FileClient object
|
||||
client = salt.minion.FileClient(opts)
|
||||
# Call get_file
|
||||
return client.get_file(path, dest, False, env)
|
||||
return client.get_file(path, dest, False, saltenv)
|
||||
|
@ -146,7 +146,7 @@ Here is a simple YAML renderer example:
|
||||
.. code-block:: python
|
||||
|
||||
import yaml
|
||||
def render(yaml_data, env='', sls='', **kws):
|
||||
def render(yaml_data, saltenv='', sls='', **kws):
|
||||
if not isinstance(yaml_data, basestring):
|
||||
yaml_data = yaml_data.read()
|
||||
data = yaml.load(yaml_data)
|
||||
|
@ -255,7 +255,7 @@ instance:
|
||||
context=None,
|
||||
replace=True,
|
||||
defaults=None,
|
||||
env=None,
|
||||
saltenv=None,
|
||||
backup='',
|
||||
**kwargs):
|
||||
|
||||
|
@ -81,9 +81,9 @@ Arguments are formatted as YAML:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' cmd.run 'echo "Hello: $FIRST_NAME"' env='{FIRST_NAME: "Joe"}'
|
||||
salt '*' cmd.run 'echo "Hello: $FIRST_NAME"' saltenv='{FIRST_NAME: "Joe"}'
|
||||
|
||||
Note: dictionaries must have curly braces around them (like the ``env``
|
||||
Note: dictionaries must have curly braces around them (like the ``saltenv``
|
||||
keyword argument above). This was changed in 0.15.1: in the above example,
|
||||
the first argument used to be parsed as the dictionary
|
||||
``{'echo "Hello': '$FIRST_NAME"'}``. This was generally not the expected
|
||||
@ -94,7 +94,7 @@ If you want to test what parameters are actually passed to a module, use the
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' test.arg_repr 'echo "Hello: $FIRST_NAME"' env='{FIRST_NAME: "Joe"}'
|
||||
salt '*' test.arg_repr 'echo "Hello: $FIRST_NAME"' saltenv='{FIRST_NAME: "Joe"}'
|
||||
|
||||
Finding available minion functions
|
||||
``````````````````````````````````
|
||||
|
@ -18,6 +18,9 @@ Grains Changes
|
||||
|
||||
{% set on_vmware = grains['virtual'].lower() == 'vmware' %}
|
||||
|
||||
Beacons Changes
|
||||
===============
|
||||
|
||||
- The ``loadavg`` beacon now outputs averages as integers instead of strings.
|
||||
(Via :issuse:`31124`.)
|
||||
|
||||
@ -37,6 +40,63 @@ Functionality Changes
|
||||
Deprecations
|
||||
============
|
||||
|
||||
- ``env`` to ``saltenv``
|
||||
|
||||
All occurrences of ``env`` and some occurrences of ``__env__`` marked for
|
||||
deprecation in Salt Carbon have been removed. The new way to use the salt
|
||||
environment setting is with a variable called ``saltenv``:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def fcn(msg='', env='base', refresh=True, saltenv='base', **kwargs):
|
||||
|
||||
has been changed to
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def fcn(msg='', refresh=True, saltenv='base', **kwargs):
|
||||
|
||||
- If ``env`` (or ``__env__``) is supplied as a keyword argument to a function
|
||||
that also accepts arbitrary keyword arguments, then a new warning informs the
|
||||
user that ``env`` is no longer used if it is found. This new warning will be
|
||||
removed in Salt Nitrogen.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def fcn(msg='', refresh=True, saltenv='base', **kwargs):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# will result in a warning log message
|
||||
fcn(msg='add more salt', env='prod', refresh=False)
|
||||
|
||||
- If ``env`` (or ``__env__``) is supplied as a keyword argument to a function
|
||||
that does not accept arbitrary keyword arguments, then python will issue an
|
||||
error.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def fcn(msg='', refresh=True, saltenv='base'):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# will result in a python TypeError
|
||||
fcn(msg='add more salt', env='prod', refresh=False)
|
||||
|
||||
- If ``env`` (or ``__env__``) is supplied as a positional argument to a
|
||||
function, then undefined behavior will occur, as the removal of ``env`` and
|
||||
``__env__`` from the function's argument list changes the function's
|
||||
signature.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def fcn(msg='', refresh=True, saltenv='base'):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# will result in refresh evaluating to True and saltenv likely not being a string at all
|
||||
fcn('add more salt', 'prod', False)
|
||||
|
||||
- The ``boto_vpc`` execution module had two functions removed,
|
||||
``boto_vpc.associate_new_dhcp_options_to_vpc`` and
|
||||
``boto_vpc.associate_new_network_acl_to_subnet`` in favor of more concise function
|
||||
@ -55,7 +115,8 @@ Deprecations
|
||||
the ``local_cache`` returner. ``jid_load`` data is now retreived from the
|
||||
``master_job_cache``
|
||||
|
||||
reg execution module
|
||||
- ``reg`` execution module
|
||||
|
||||
Functions in the ``reg`` execution module had misleading and confusing names
|
||||
for dealing with the Windows registry. They failed to clearly differentiate
|
||||
between hives, keys, and name/value pairs. Keys were treated like value names.
|
||||
@ -79,7 +140,8 @@ reg execution module
|
||||
- for ``delete_key`` use ``delete_key_recursive``. To delete a value, use
|
||||
``delete_value``.
|
||||
|
||||
reg state module
|
||||
- ``reg`` state module
|
||||
|
||||
The ``reg`` state module was modified to work with the new functions in the
|
||||
execution module. Some logic was left in the ``reg.present`` and the
|
||||
``reg.absent`` functions to handle existing state files that used the final
|
||||
|
@ -43,20 +43,20 @@ def _merge_extra_filerefs(*args):
|
||||
return ','.join(ret)
|
||||
|
||||
|
||||
def sls(mods, saltenv='base', test=None, exclude=None, env=None, **kwargs):
|
||||
def sls(mods, saltenv='base', test=None, exclude=None, **kwargs):
|
||||
'''
|
||||
Create the seed file for a state.sls run
|
||||
'''
|
||||
st_kwargs = __salt__.kwargs
|
||||
__opts__['grains'] = __grains__
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
__pillar__.update(kwargs.get('pillar', {}))
|
||||
st_ = salt.client.ssh.state.SSHHighState(
|
||||
@ -469,7 +469,7 @@ def show_lowstate():
|
||||
return st_.compile_low_chunks()
|
||||
|
||||
|
||||
def show_sls(mods, saltenv='base', test=None, env=None, **kwargs):
|
||||
def show_sls(mods, saltenv='base', test=None, **kwargs):
|
||||
'''
|
||||
Display the state data from a specific sls or list of sls files on the
|
||||
master
|
||||
@ -482,14 +482,14 @@ def show_sls(mods, saltenv='base', test=None, env=None, **kwargs):
|
||||
'''
|
||||
__pillar__.update(kwargs.get('pillar', {}))
|
||||
__opts__['grains'] = __grains__
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
opts = copy.copy(__opts__)
|
||||
if salt.utils.test_mode(test=test, **kwargs):
|
||||
|
@ -106,20 +106,10 @@ class Client(object):
|
||||
return filelist
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _cache_loc(self, path, saltenv='base', env=None):
|
||||
def _cache_loc(self, path, saltenv='base'):
|
||||
'''
|
||||
Return the local location to cache the file, cache dirs will be made
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
dest = salt.utils.path_join(self.opts['cachedir'],
|
||||
'files',
|
||||
saltenv,
|
||||
@ -140,52 +130,31 @@ class Client(object):
|
||||
dest='',
|
||||
makedirs=False,
|
||||
saltenv='base',
|
||||
gzip=None,
|
||||
env=None):
|
||||
gzip=None):
|
||||
'''
|
||||
Copies a file from the local files or master depending on
|
||||
implementation
|
||||
'''
|
||||
raise NotImplementedError
|
||||
|
||||
def file_list_emptydirs(self, saltenv='base', prefix='', env=None):
|
||||
def file_list_emptydirs(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the empty dirs
|
||||
'''
|
||||
raise NotImplementedError
|
||||
|
||||
def cache_file(self, path, saltenv='base', env=None):
|
||||
def cache_file(self, path, saltenv='base'):
|
||||
'''
|
||||
Pull a file down from the file server and store it in the minion
|
||||
file cache
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return self.get_url(path, '', True, saltenv)
|
||||
|
||||
def cache_files(self, paths, saltenv='base', env=None):
|
||||
def cache_files(self, paths, saltenv='base'):
|
||||
'''
|
||||
Download a list of files stored on the master and put them in the
|
||||
minion file cache
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
if isinstance(paths, str):
|
||||
paths = paths.split(',')
|
||||
@ -193,40 +162,20 @@ class Client(object):
|
||||
ret.append(self.cache_file(path, saltenv))
|
||||
return ret
|
||||
|
||||
def cache_master(self, saltenv='base', env=None):
|
||||
def cache_master(self, saltenv='base'):
|
||||
'''
|
||||
Download and cache all files on a master in a specified environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
for path in self.file_list(saltenv):
|
||||
ret.append(self.cache_file(salt.utils.url.create(path), saltenv))
|
||||
return ret
|
||||
|
||||
def cache_dir(self, path, saltenv='base', include_empty=False,
|
||||
include_pat=None, exclude_pat=None, env=None):
|
||||
include_pat=None, exclude_pat=None):
|
||||
'''
|
||||
Download all of the files in a subdir of the master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
|
||||
path = self._check_proto(sdecode(path))
|
||||
@ -290,20 +239,10 @@ class Client(object):
|
||||
shutil.copyfile(path, dest)
|
||||
return dest
|
||||
|
||||
def file_local_list(self, saltenv='base', env=None):
|
||||
def file_local_list(self, saltenv='base'):
|
||||
'''
|
||||
List files in the local minion files and localfiles caches
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
filesdest = os.path.join(self.opts['cachedir'], 'files', saltenv)
|
||||
localfilesdest = os.path.join(self.opts['cachedir'], 'localfiles')
|
||||
|
||||
@ -311,69 +250,29 @@ class Client(object):
|
||||
ldest = self._file_local_list(localfilesdest)
|
||||
return sorted(fdest.union(ldest))
|
||||
|
||||
def file_list(self, saltenv='base', prefix='', env=None):
|
||||
def file_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
This function must be overwritten
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return []
|
||||
|
||||
def dir_list(self, saltenv='base', prefix='', env=None):
|
||||
def dir_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
This function must be overwritten
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return []
|
||||
|
||||
def symlink_list(self, saltenv='base', prefix='', env=None):
|
||||
def symlink_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
This function must be overwritten
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return {}
|
||||
|
||||
def is_cached(self, path, saltenv='base', env=None):
|
||||
def is_cached(self, path, saltenv='base'):
|
||||
'''
|
||||
Returns the full path to a file if it is cached locally on the minion
|
||||
otherwise returns a blank string
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
if path.startswith('salt://'):
|
||||
path, senv = salt.utils.url.parse(path)
|
||||
if senv:
|
||||
@ -464,20 +363,10 @@ class Client(object):
|
||||
return {'source': path, 'dest': dest}
|
||||
return {}
|
||||
|
||||
def get_dir(self, path, dest='', saltenv='base', gzip=None, env=None):
|
||||
def get_dir(self, path, dest='', saltenv='base', gzip=None):
|
||||
'''
|
||||
Get a directory recursively from the salt-master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
# Strip trailing slash
|
||||
path = self._check_proto(path).rstrip('/')
|
||||
@ -485,7 +374,8 @@ class Client(object):
|
||||
# (the one being recursively copied) and the directories preceding it
|
||||
separated = path.rsplit('/', 1)
|
||||
if len(separated) != 2:
|
||||
# No slashes in path. (This means all files in env will be copied)
|
||||
# No slashes in path. (This means all files in saltenv will be
|
||||
# copied)
|
||||
prefix = ''
|
||||
else:
|
||||
prefix = separated[0]
|
||||
@ -531,20 +421,10 @@ class Client(object):
|
||||
ret.sort()
|
||||
return ret
|
||||
|
||||
def get_url(self, url, dest, makedirs=False, saltenv='base', env=None, no_cache=False):
|
||||
def get_url(self, url, dest, makedirs=False, saltenv='base', no_cache=False):
|
||||
'''
|
||||
Get a single file from a URL.
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
url_data = urlparse(url)
|
||||
|
||||
if url_data.scheme in ('file', ''):
|
||||
@ -713,20 +593,18 @@ class Client(object):
|
||||
template='jinja',
|
||||
makedirs=False,
|
||||
saltenv='base',
|
||||
env=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Cache a file then process it as a template
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
kwargs['saltenv'] = saltenv
|
||||
url_data = urlparse(url)
|
||||
@ -817,43 +695,22 @@ class LocalClient(Client):
|
||||
dest='',
|
||||
makedirs=False,
|
||||
saltenv='base',
|
||||
gzip=None,
|
||||
env=None):
|
||||
gzip=None):
|
||||
'''
|
||||
Copies a file from the local files directory into :param:`dest`
|
||||
gzip compression settings are ignored for local files
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
path = self._check_proto(path)
|
||||
fnd = self._find_file(path, saltenv)
|
||||
if not fnd['path']:
|
||||
return ''
|
||||
return fnd['path']
|
||||
|
||||
def file_list(self, saltenv='base', prefix='', env=None):
|
||||
def file_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
Return a list of files in the given environment
|
||||
with optional relative prefix path to limit directory traversal
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
if saltenv not in self.opts['file_roots']:
|
||||
return ret
|
||||
@ -867,21 +724,11 @@ class LocalClient(Client):
|
||||
ret.append(sdecode(relpath))
|
||||
return ret
|
||||
|
||||
def file_list_emptydirs(self, saltenv='base', prefix='', env=None):
|
||||
def file_list_emptydirs(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the empty dirs in the file_roots
|
||||
with optional relative prefix path to limit directory traversal
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
prefix = prefix.strip('/')
|
||||
if saltenv not in self.opts['file_roots']:
|
||||
@ -894,21 +741,11 @@ class LocalClient(Client):
|
||||
ret.append(sdecode(os.path.relpath(root, path)))
|
||||
return ret
|
||||
|
||||
def dir_list(self, saltenv='base', prefix='', env=None):
|
||||
def dir_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the dirs in the file_roots
|
||||
with optional relative prefix path to limit directory traversal
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = []
|
||||
if saltenv not in self.opts['file_roots']:
|
||||
return ret
|
||||
@ -920,22 +757,12 @@ class LocalClient(Client):
|
||||
ret.append(sdecode(os.path.relpath(root, path)))
|
||||
return ret
|
||||
|
||||
def hash_file(self, path, saltenv='base', env=None):
|
||||
def hash_file(self, path, saltenv='base'):
|
||||
'''
|
||||
Return the hash of a file, to get the hash of a file in the file_roots
|
||||
prepend the path with salt://<file on server> otherwise, prepend the
|
||||
file with / for a local file.
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = {}
|
||||
try:
|
||||
path = self._check_proto(path)
|
||||
@ -959,20 +786,10 @@ class LocalClient(Client):
|
||||
ret['hash_type'] = self.opts['hash_type']
|
||||
return ret
|
||||
|
||||
def list_env(self, saltenv='base', env=None):
|
||||
def list_env(self, saltenv='base'):
|
||||
'''
|
||||
Return a list of the files in the file server's specified environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return self.file_list(saltenv)
|
||||
|
||||
def master_opts(self):
|
||||
@ -1030,8 +847,7 @@ class RemoteClient(Client):
|
||||
dest='',
|
||||
makedirs=False,
|
||||
saltenv='base',
|
||||
gzip=None,
|
||||
env=None):
|
||||
gzip=None):
|
||||
'''
|
||||
Get a single file from the salt-master
|
||||
path must be a salt server location, aka, salt://path/to/file, if
|
||||
@ -1054,16 +870,6 @@ class RemoteClient(Client):
|
||||
)
|
||||
return False
|
||||
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Hash compare local copy with master and skip download
|
||||
# if no difference found.
|
||||
dest2check = dest
|
||||
@ -1185,65 +991,35 @@ class RemoteClient(Client):
|
||||
|
||||
return dest
|
||||
|
||||
def file_list(self, saltenv='base', prefix='', env=None):
|
||||
def file_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the files on the master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
load = {'saltenv': saltenv,
|
||||
'prefix': prefix,
|
||||
'cmd': '_file_list'}
|
||||
|
||||
return [sdecode(fn_) for fn_ in self.channel.send(load)]
|
||||
|
||||
def file_list_emptydirs(self, saltenv='base', prefix='', env=None):
|
||||
def file_list_emptydirs(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the empty dirs on the master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
load = {'saltenv': saltenv,
|
||||
'prefix': prefix,
|
||||
'cmd': '_file_list_emptydirs'}
|
||||
self.channel.send(load)
|
||||
|
||||
def dir_list(self, saltenv='base', prefix='', env=None):
|
||||
def dir_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List the dirs on the master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
load = {'saltenv': saltenv,
|
||||
'prefix': prefix,
|
||||
'cmd': '_dir_list'}
|
||||
return self.channel.send(load)
|
||||
|
||||
def symlink_list(self, saltenv='base', prefix='', env=None):
|
||||
def symlink_list(self, saltenv='base', prefix=''):
|
||||
'''
|
||||
List symlinked files and dirs on the master
|
||||
'''
|
||||
@ -1252,22 +1028,12 @@ class RemoteClient(Client):
|
||||
'cmd': '_symlink_list'}
|
||||
return self.channel.send(load)
|
||||
|
||||
def hash_file(self, path, saltenv='base', env=None):
|
||||
def hash_file(self, path, saltenv='base'):
|
||||
'''
|
||||
Return the hash of a file, to get the hash of a file on the salt
|
||||
master file server prepend the path with salt://<file on server>
|
||||
otherwise, prepend the file with / for a local file.
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
try:
|
||||
path = self._check_proto(path)
|
||||
except MinionError:
|
||||
@ -1287,20 +1053,10 @@ class RemoteClient(Client):
|
||||
'cmd': '_file_hash'}
|
||||
return self.channel.send(load)
|
||||
|
||||
def list_env(self, saltenv='base', env=None):
|
||||
def list_env(self, saltenv='base'):
|
||||
'''
|
||||
Return a list of the files in the file server's specified environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
load = {'saltenv': saltenv,
|
||||
'cmd': '_file_list'}
|
||||
return self.channel.send(load)
|
||||
|
@ -505,16 +505,18 @@ class Fileserver(object):
|
||||
continue
|
||||
args = comp.split('=', 1)
|
||||
kwargs[args[0]] = args[1]
|
||||
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
saltenv = kwargs.pop('env')
|
||||
elif 'saltenv' in kwargs:
|
||||
kwargs.pop('env')
|
||||
if 'saltenv' in kwargs:
|
||||
saltenv = kwargs.pop('saltenv')
|
||||
|
||||
if not isinstance(saltenv, six.string_types):
|
||||
saltenv = six.text_type(saltenv)
|
||||
|
||||
@ -533,14 +535,15 @@ class Fileserver(object):
|
||||
'''
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'path' not in load or 'loc' not in load or 'saltenv' not in load:
|
||||
return ret
|
||||
@ -561,12 +564,12 @@ class Fileserver(object):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'path' not in load or 'saltenv' not in load:
|
||||
return ''
|
||||
@ -588,12 +591,12 @@ class Fileserver(object):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = set()
|
||||
if 'saltenv' not in load:
|
||||
@ -619,12 +622,12 @@ class Fileserver(object):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = set()
|
||||
if 'saltenv' not in load:
|
||||
@ -650,12 +653,12 @@ class Fileserver(object):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = set()
|
||||
if 'saltenv' not in load:
|
||||
@ -681,12 +684,12 @@ class Fileserver(object):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {}
|
||||
if 'saltenv' not in load:
|
||||
|
@ -69,18 +69,18 @@ def __virtual__():
|
||||
return True
|
||||
|
||||
|
||||
def find_file(path, saltenv='base', env=None, **kwargs):
|
||||
def find_file(path, saltenv='base', **kwargs):
|
||||
'''
|
||||
Search the environment for the relative path
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
fnd = {'path': '',
|
||||
'rel': ''}
|
||||
@ -115,11 +115,12 @@ def serve_file(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
|
@ -699,11 +699,12 @@ def serve_file(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
@ -729,11 +730,12 @@ def file_hash(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if not all(x in load for x in ('path', 'saltenv')):
|
||||
return ''
|
||||
@ -762,11 +764,12 @@ def _file_lists(load, form):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
list_cachedir = os.path.join(__opts__['cachedir'], 'file_lists/hgfs')
|
||||
if not os.path.isdir(list_cachedir):
|
||||
@ -809,11 +812,12 @@ def _get_file_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'saltenv' not in load or load['saltenv'] not in envs():
|
||||
return []
|
||||
@ -853,11 +857,12 @@ def _get_dir_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'saltenv' not in load or load['saltenv'] not in envs():
|
||||
return []
|
||||
|
@ -154,13 +154,15 @@ def file_hash(load, fnd):
|
||||
'''
|
||||
path = fnd['path']
|
||||
ret = {}
|
||||
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if load['saltenv'] not in envs():
|
||||
return {}
|
||||
@ -225,11 +227,12 @@ def file_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if load['saltenv'] not in envs():
|
||||
return []
|
||||
@ -308,11 +311,12 @@ def dir_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if load['saltenv'] not in envs():
|
||||
return []
|
||||
|
@ -31,18 +31,18 @@ import salt.ext.six as six
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def find_file(path, saltenv='base', env=None, **kwargs):
|
||||
def find_file(path, saltenv='base', **kwargs):
|
||||
'''
|
||||
Search the environment for the relative path
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
path = os.path.normpath(path)
|
||||
fnd = {'path': '',
|
||||
@ -89,11 +89,12 @@ def serve_file(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
@ -176,11 +177,12 @@ def file_hash(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'path' not in load or 'saltenv' not in load:
|
||||
return ''
|
||||
@ -255,11 +257,13 @@ def _file_lists(load, form):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if load['saltenv'] not in __opts__['file_roots']:
|
||||
return []
|
||||
|
||||
@ -351,11 +355,12 @@ def symlink_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {}
|
||||
if load['saltenv'] not in __opts__['file_roots']:
|
||||
|
@ -117,20 +117,20 @@ def update():
|
||||
log.info('Sync local cache from S3 completed.')
|
||||
|
||||
|
||||
def find_file(path, saltenv='base', env=None, **kwargs):
|
||||
def find_file(path, saltenv='base', **kwargs):
|
||||
'''
|
||||
Look through the buckets cache file for a match.
|
||||
If the field is found, it is retrieved from S3 only if its cached version
|
||||
is missing, or if the MD5 does not match.
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
fnd = {'bucket': None,
|
||||
'path': None}
|
||||
@ -167,11 +167,12 @@ def file_hash(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {}
|
||||
|
||||
@ -199,11 +200,12 @@ def serve_file(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
@ -240,11 +242,12 @@ def file_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = []
|
||||
|
||||
@ -280,11 +283,12 @@ def dir_list(load):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = []
|
||||
|
||||
|
@ -593,11 +593,12 @@ def serve_file(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
@ -623,11 +624,12 @@ def file_hash(load, fnd):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if not all(x in load for x in ('path', 'saltenv')):
|
||||
return ''
|
||||
@ -680,11 +682,12 @@ def _file_lists(load, form):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if 'saltenv' not in load or load['saltenv'] not in envs():
|
||||
return []
|
||||
|
@ -1863,7 +1863,6 @@ def script(source,
|
||||
quiet=False,
|
||||
timeout=None,
|
||||
reset_system_locale=True,
|
||||
__env__=None,
|
||||
saltenv='base',
|
||||
use_vt=False,
|
||||
bg=False,
|
||||
@ -1998,14 +1997,14 @@ def script(source,
|
||||
)
|
||||
)
|
||||
|
||||
if isinstance(__env__, six.string_types):
|
||||
if '__env__' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'__env__\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'__env__\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = __env__
|
||||
kwargs.pop('__env__')
|
||||
|
||||
path = salt.utils.mkstemp(dir=cwd, suffix=os.path.splitext(source)[1])
|
||||
|
||||
@ -2072,7 +2071,6 @@ def script_retcode(source,
|
||||
umask=None,
|
||||
timeout=None,
|
||||
reset_system_locale=True,
|
||||
__env__=None,
|
||||
saltenv='base',
|
||||
output_loglevel='debug',
|
||||
log_callback=None,
|
||||
@ -2200,6 +2198,15 @@ def script_retcode(source,
|
||||
|
||||
salt '*' cmd.script_retcode salt://scripts/runme.sh stdin='one\\ntwo\\nthree\\nfour\\nfive\\n'
|
||||
'''
|
||||
if '__env__' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'__env__\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('__env__')
|
||||
|
||||
return script(source=source,
|
||||
args=args,
|
||||
cwd=cwd,
|
||||
@ -2212,7 +2219,6 @@ def script_retcode(source,
|
||||
umask=umask,
|
||||
timeout=timeout,
|
||||
reset_system_locale=reset_system_locale,
|
||||
__env__=__env__,
|
||||
saltenv=saltenv,
|
||||
output_loglevel=output_loglevel,
|
||||
log_callback=log_callback,
|
||||
|
@ -184,12 +184,13 @@ def set_file(path, saltenv='base', **kwargs):
|
||||
'''
|
||||
if '__env__' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'__env__\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'__env__\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = kwargs['__env__']
|
||||
kwargs.pop('__env__')
|
||||
|
||||
path = __salt__['cp.cache_file'](path, saltenv)
|
||||
if path:
|
||||
_set_file(path)
|
||||
|
@ -2154,7 +2154,6 @@ def _script(status,
|
||||
stdin=None,
|
||||
runas=None,
|
||||
shell=cmdmod.DEFAULT_SHELL,
|
||||
env=None,
|
||||
template='jinja',
|
||||
umask=None,
|
||||
timeout=None,
|
||||
@ -2171,15 +2170,14 @@ def _script(status,
|
||||
rpath = get_container_root(container)
|
||||
tpath = os.path.join(rpath, 'tmp')
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
path = salt.utils.mkstemp(dir=tpath)
|
||||
if template:
|
||||
@ -2222,7 +2220,6 @@ def script(container,
|
||||
stdin=None,
|
||||
runas=None,
|
||||
shell=cmdmod.DEFAULT_SHELL,
|
||||
env=None,
|
||||
template='jinja',
|
||||
umask=None,
|
||||
timeout=None,
|
||||
@ -2272,16 +2269,6 @@ def script(container,
|
||||
'''
|
||||
status = base_status.copy()
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
return _script(status,
|
||||
container,
|
||||
source,
|
||||
@ -2304,7 +2291,6 @@ def script_retcode(container,
|
||||
stdin=None,
|
||||
runas=None,
|
||||
shell=cmdmod.DEFAULT_SHELL,
|
||||
env=None,
|
||||
template='jinja',
|
||||
umask=None,
|
||||
timeout=None,
|
||||
@ -2331,17 +2317,6 @@ def script_retcode(container,
|
||||
|
||||
salt '*' docker.script_retcode <container id> salt://docker_script.py
|
||||
'''
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
status = base_status.copy()
|
||||
|
||||
return _script(status,
|
||||
|
@ -3979,7 +3979,6 @@ def check_file_meta(
|
||||
def get_diff(
|
||||
minionfile,
|
||||
masterfile,
|
||||
env=None,
|
||||
saltenv='base'):
|
||||
'''
|
||||
Return unified diff of file compared to file on master
|
||||
@ -3994,15 +3993,6 @@ def get_diff(
|
||||
|
||||
ret = ''
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
if not os.path.exists(minionfile):
|
||||
ret = 'File {0} does not exist on the minion'.format(minionfile)
|
||||
return ret
|
||||
|
@ -366,7 +366,6 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
|
||||
allow_external=None,
|
||||
allow_unverified=None,
|
||||
process_dependency_links=False,
|
||||
__env__=None,
|
||||
saltenv='base',
|
||||
env_vars=None,
|
||||
use_vt=False,
|
||||
@ -580,16 +579,6 @@ def install(pkgs=None, # pylint: disable=R0912,R0913,R0914
|
||||
'that virtualenv before using pip to install packages in it.'
|
||||
)
|
||||
|
||||
if isinstance(__env__, string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'__env__\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = __env__
|
||||
|
||||
pip_bin = _get_pip_bin(bin_env)
|
||||
|
||||
cmd = [pip_bin, 'install']
|
||||
@ -862,7 +851,6 @@ def uninstall(pkgs=None,
|
||||
user=None,
|
||||
no_chown=False,
|
||||
cwd=None,
|
||||
__env__=None,
|
||||
saltenv='base',
|
||||
use_vt=False):
|
||||
'''
|
||||
@ -918,16 +906,6 @@ def uninstall(pkgs=None,
|
||||
|
||||
cmd = [pip_bin, 'uninstall', '-y']
|
||||
|
||||
if isinstance(__env__, string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'__env__\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = __env__
|
||||
|
||||
cleanup_requirements, error = _process_requirements(
|
||||
requirements=requirements, cmd=cmd, saltenv=saltenv, user=user,
|
||||
cwd=cwd
|
||||
|
@ -105,13 +105,12 @@ def parse_targets(name=None,
|
||||
'''
|
||||
if '__env__' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'__env__\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'__env__\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = kwargs['__env__']
|
||||
kwargs.pop('__env__')
|
||||
|
||||
if __grains__['os'] == 'MacOS' and sources:
|
||||
log.warning('Parameter "sources" ignored on MacOS hosts.')
|
||||
|
@ -362,8 +362,7 @@ def auth_keys(user=None, config='.ssh/authorized_keys'):
|
||||
def check_key_file(user,
|
||||
source,
|
||||
config='.ssh/authorized_keys',
|
||||
saltenv='base',
|
||||
env=None):
|
||||
saltenv='base'):
|
||||
'''
|
||||
Check a keyfile from a source destination against the local keys and
|
||||
return the keys to change
|
||||
@ -374,15 +373,6 @@ def check_key_file(user,
|
||||
|
||||
salt '*' ssh.check_key_file root salt://ssh/keyfile
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
keyfile = __salt__['cp.cache_file'](source, saltenv)
|
||||
if not keyfile:
|
||||
return {}
|
||||
@ -451,8 +441,7 @@ def check_key(user, key, enc, comment, options, config='.ssh/authorized_keys',
|
||||
def rm_auth_key_from_file(user,
|
||||
source,
|
||||
config='.ssh/authorized_keys',
|
||||
saltenv='base',
|
||||
env=None):
|
||||
saltenv='base'):
|
||||
'''
|
||||
Remove an authorized key from the specified user's authorized key file,
|
||||
using a file as source
|
||||
@ -463,15 +452,6 @@ def rm_auth_key_from_file(user,
|
||||
|
||||
salt '*' ssh.rm_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
lfile = __salt__['cp.cache_file'](source, saltenv)
|
||||
if not os.path.isfile(lfile):
|
||||
raise CommandExecutionError(
|
||||
@ -576,8 +556,7 @@ def rm_auth_key(user, key, config='.ssh/authorized_keys'):
|
||||
def set_auth_key_from_file(user,
|
||||
source,
|
||||
config='.ssh/authorized_keys',
|
||||
saltenv='base',
|
||||
env=None):
|
||||
saltenv='base'):
|
||||
'''
|
||||
Add a key to the authorized_keys file, using a file as the source.
|
||||
|
||||
@ -587,15 +566,6 @@ def set_auth_key_from_file(user,
|
||||
|
||||
salt '*' ssh.set_auth_key_from_file <user> salt://ssh_keys/<user>.id_rsa.pub
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# TODO: add support for pulling keys from other file sources as well
|
||||
lfile = __salt__['cp.cache_file'](source, saltenv)
|
||||
if not os.path.isfile(lfile):
|
||||
|
@ -264,12 +264,14 @@ def template(tem, queue=False, **kwargs):
|
||||
'''
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
saltenv = kwargs['env']
|
||||
elif 'saltenv' in kwargs:
|
||||
kwargs.pop('env')
|
||||
|
||||
if 'saltenv' in kwargs:
|
||||
saltenv = kwargs['saltenv']
|
||||
else:
|
||||
saltenv = ''
|
||||
@ -554,12 +556,14 @@ def highstate(test=None,
|
||||
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
opts['environment'] = kwargs['env']
|
||||
elif 'saltenv' in kwargs:
|
||||
kwargs.pop('env')
|
||||
|
||||
if 'saltenv' in kwargs:
|
||||
opts['environment'] = kwargs['saltenv']
|
||||
|
||||
pillar = kwargs.get('pillar')
|
||||
@ -620,7 +624,6 @@ def sls(mods,
|
||||
test=None,
|
||||
exclude=None,
|
||||
queue=False,
|
||||
env=None,
|
||||
pillarenv=None,
|
||||
**kwargs):
|
||||
'''
|
||||
@ -695,14 +698,15 @@ def sls(mods,
|
||||
salt '*' state.sls myslsfile pillar="{foo: 'Foo!', bar: 'Bar!'}"
|
||||
'''
|
||||
concurrent = kwargs.get('concurrent', False)
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
if saltenv is None:
|
||||
if __opts__.get('environment', None):
|
||||
saltenv = __opts__['environment']
|
||||
@ -1025,12 +1029,10 @@ def show_low_sls(mods,
|
||||
saltenv='base',
|
||||
test=None,
|
||||
queue=False,
|
||||
env=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Display the low data from a specific sls. The default environment is
|
||||
``base``, use ``saltenv`` (``env`` in Salt 0.17.x and older) to specify a
|
||||
different environment.
|
||||
``base``, use ``saltenv`` to specify a different environment.
|
||||
|
||||
CLI Example:
|
||||
|
||||
@ -1038,14 +1040,15 @@ def show_low_sls(mods,
|
||||
|
||||
salt '*' state.show_low_sls foo
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
conflict = _check_queue(queue, kwargs)
|
||||
if conflict is not None:
|
||||
return conflict
|
||||
@ -1076,11 +1079,11 @@ def show_low_sls(mods,
|
||||
return ret
|
||||
|
||||
|
||||
def show_sls(mods, saltenv='base', test=None, queue=False, env=None, **kwargs):
|
||||
def show_sls(mods, saltenv='base', test=None, queue=False, **kwargs):
|
||||
'''
|
||||
Display the state data from a specific sls or list of sls files on the
|
||||
master. The default environment is ``base``, use ``saltenv`` (``env`` in
|
||||
Salt 0.17.x and older) to specify a different environment.
|
||||
master. The default environment is ``base``, use ``saltenv`` to specify a
|
||||
different environment.
|
||||
|
||||
This function does not support topfiles. For ``top.sls`` please use
|
||||
``show_top`` instead.
|
||||
@ -1093,14 +1096,15 @@ def show_sls(mods, saltenv='base', test=None, queue=False, env=None, **kwargs):
|
||||
|
||||
salt '*' state.show_sls core,edit.vim dev
|
||||
'''
|
||||
if env is not None:
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
kwargs.pop('env')
|
||||
|
||||
conflict = _check_queue(queue, kwargs)
|
||||
if conflict is not None:
|
||||
return conflict
|
||||
@ -1154,14 +1158,17 @@ def show_top(queue=False, **kwargs):
|
||||
salt '*' state.show_top
|
||||
'''
|
||||
opts = copy.deepcopy(__opts__)
|
||||
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
opts['environment'] = kwargs['env']
|
||||
elif 'saltenv' in kwargs:
|
||||
kwargs.pop('env')
|
||||
|
||||
if 'saltenv' in kwargs:
|
||||
opts['environment'] = kwargs['saltenv']
|
||||
conflict = _check_queue(queue, kwargs)
|
||||
if conflict is not None:
|
||||
|
@ -524,7 +524,6 @@ def deploy_war(war,
|
||||
url='http://localhost:8080/manager',
|
||||
saltenv='base',
|
||||
timeout=180,
|
||||
env=None,
|
||||
temp_war_location=None,
|
||||
version=''):
|
||||
'''
|
||||
@ -577,15 +576,6 @@ def deploy_war(war,
|
||||
salt '*' tomcat.deploy_war /tmp/application.war /api no
|
||||
salt '*' tomcat.deploy_war /tmp/application.war /api yes http://localhost:8080/manager
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Decide the location to copy the war for the deployment
|
||||
tfile = 'salt.{0}'.format(os.path.basename(war))
|
||||
if temp_war_location is not None:
|
||||
|
@ -31,19 +31,11 @@ import salt.ext.six as six
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_pillar(opts, grains, minion_id, saltenv=None, ext=None, env=None, funcs=None,
|
||||
def get_pillar(opts, grains, minion_id, saltenv=None, ext=None, funcs=None,
|
||||
pillar=None, pillarenv=None):
|
||||
'''
|
||||
Return the correct pillar driver based on the file_client option
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
ptype = {
|
||||
'remote': RemotePillar,
|
||||
'local': Pillar
|
||||
@ -60,19 +52,11 @@ def get_pillar(opts, grains, minion_id, saltenv=None, ext=None, env=None, funcs=
|
||||
|
||||
|
||||
# TODO: migrate everyone to this one!
|
||||
def get_async_pillar(opts, grains, minion_id, saltenv=None, ext=None, env=None, funcs=None,
|
||||
def get_async_pillar(opts, grains, minion_id, saltenv=None, ext=None, funcs=None,
|
||||
pillar=None, pillarenv=None):
|
||||
'''
|
||||
Return the correct pillar driver based on the file_client option
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
ptype = {
|
||||
'remote': AsyncRemotePillar,
|
||||
'local': AsyncPillar,
|
||||
@ -329,19 +313,10 @@ class Pillar(object):
|
||||
return {}
|
||||
return ext
|
||||
|
||||
def __gen_opts(self, opts_in, grains, saltenv=None, ext=None, env=None, pillarenv=None):
|
||||
def __gen_opts(self, opts_in, grains, saltenv=None, ext=None, pillarenv=None):
|
||||
'''
|
||||
The options need to be altered to conform to the file client
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
opts = copy.deepcopy(opts_in)
|
||||
opts['file_roots'] = opts['pillar_roots']
|
||||
opts['file_client'] = 'local'
|
||||
|
@ -58,7 +58,7 @@ def render(yaml_data, saltenv='base', sls='', argline='', **kws):
|
||||
if len(warn_list) > 0:
|
||||
for item in warn_list:
|
||||
log.warn(
|
||||
'{warn} found in {sls} environment={env}'.format(
|
||||
'{warn} found in {sls} saltenv={env}'.format(
|
||||
warn=item.message, sls=salt.utils.url.create(sls), env=saltenv
|
||||
)
|
||||
)
|
||||
|
@ -24,7 +24,7 @@ def render(sls_data, saltenv='base', sls='', **kws):
|
||||
|
||||
for item in warn_list:
|
||||
log.warn(
|
||||
'{warn} found in {sls} environment={env}'.format(
|
||||
'{warn} found in {sls} saltenv={env}'.format(
|
||||
warn=item.message, sls=salt.utils.url.create(sls), env=saltenv
|
||||
)
|
||||
)
|
||||
|
@ -3364,17 +3364,7 @@ class MasterHighState(HighState):
|
||||
Execute highstate compilation from the master
|
||||
'''
|
||||
def __init__(self, master_opts, minion_opts, grains, id_,
|
||||
saltenv=None,
|
||||
env=None):
|
||||
if isinstance(env, six.string_types):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
saltenv=None):
|
||||
# Force the fileclient to be local
|
||||
opts = copy.deepcopy(minion_opts)
|
||||
opts['file_client'] = 'local'
|
||||
|
@ -1091,7 +1091,6 @@ def managed(name,
|
||||
context=None,
|
||||
replace=True,
|
||||
defaults=None,
|
||||
env=None,
|
||||
backup='',
|
||||
show_changes=True,
|
||||
create=True,
|
||||
@ -1412,6 +1411,15 @@ def managed(name,
|
||||
|
||||
.. versionadded:: 2016.3.0
|
||||
'''
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.expanduser(name)
|
||||
|
||||
ret = {'changes': {},
|
||||
@ -2112,7 +2120,6 @@ def recurse(name,
|
||||
template=None,
|
||||
context=None,
|
||||
defaults=None,
|
||||
env=None,
|
||||
include_empty=False,
|
||||
backup='',
|
||||
include_pat=None,
|
||||
@ -2233,6 +2240,15 @@ def recurse(name,
|
||||
recursively removed so that symlink creation can proceed. This
|
||||
option is usually not needed except in special circumstances.
|
||||
'''
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.expanduser(sdecode(name))
|
||||
|
||||
user = _test_owner(kwargs, user=user)
|
||||
@ -3777,7 +3793,6 @@ def patch(name,
|
||||
hash=None,
|
||||
options='',
|
||||
dry_run_first=True,
|
||||
env=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Apply a patch to a file or directory.
|
||||
@ -3808,7 +3823,7 @@ def patch(name,
|
||||
dry_run_first : ``True``
|
||||
Run patch with ``--dry-run`` first to check if it will apply cleanly.
|
||||
|
||||
env
|
||||
saltenv
|
||||
Specify the environment from which to retrieve the patch file indicated
|
||||
by the ``source`` parameter. If not provided, this defaults to the
|
||||
environment from which the state is being executed.
|
||||
@ -3823,6 +3838,15 @@ def patch(name,
|
||||
- source: salt://file.patch
|
||||
- hash: md5=e138491e9d5b97023cea823fe17bac22
|
||||
'''
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.expanduser(name)
|
||||
|
||||
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
|
||||
@ -4368,7 +4392,6 @@ def serialize(name,
|
||||
user=None,
|
||||
group=None,
|
||||
mode=None,
|
||||
env=None,
|
||||
backup='',
|
||||
makedirs=False,
|
||||
show_diff=True,
|
||||
@ -4466,6 +4489,15 @@ def serialize(name,
|
||||
"name": "naive"
|
||||
}
|
||||
'''
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.expanduser(name)
|
||||
|
||||
ret = {'changes': {},
|
||||
|
@ -49,7 +49,7 @@ def state(
|
||||
highstate=None,
|
||||
sls=None,
|
||||
top=None,
|
||||
env=None,
|
||||
saltenv=None,
|
||||
test=False,
|
||||
pillar=None,
|
||||
expect_minions=False,
|
||||
@ -159,17 +159,6 @@ def state(
|
||||
state_ret['comment'] = 'Passed invalid value for \'allow_fail\', must be an int'
|
||||
return state_ret
|
||||
|
||||
if env is not None:
|
||||
msg = (
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This warning will go away in Salt Carbon and this '
|
||||
'will be the default and expected behavior. Please update your '
|
||||
'state files.'
|
||||
)
|
||||
salt.utils.warn_until('Carbon', msg)
|
||||
state_ret.setdefault('warnings', []).append(msg)
|
||||
# No need to set __env__ = env since that's done in the state machinery
|
||||
|
||||
if expr_form and tgt_type:
|
||||
state_ret.setdefault('warnings', []).append(
|
||||
'Please only use \'tgt_type\' or \'expr_form\' not both. '
|
||||
|
@ -43,14 +43,15 @@ def compile_template(template,
|
||||
ret = {}
|
||||
|
||||
log.debug('compile template: {0}'.format(template))
|
||||
# We "map" env to the same as saltenv until Carbon is out in order to follow the same deprecation path
|
||||
kwargs.setdefault('env', saltenv)
|
||||
|
||||
if 'env' in kwargs:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'We are only supporting \'env\' in the templating context until Carbon comes out. '
|
||||
'Once this warning is shown, please remove the above mapping',
|
||||
_dont_call_warnings=True
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kwargs.pop('env')
|
||||
|
||||
if template != ':string:':
|
||||
# Template was specified incorrectly
|
||||
|
@ -2305,11 +2305,12 @@ class GitFS(GitBase):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
ret = {'data': '',
|
||||
'dest': ''}
|
||||
@ -2341,11 +2342,12 @@ class GitFS(GitBase):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if not all(x in load for x in ('path', 'saltenv')):
|
||||
return ''
|
||||
@ -2374,11 +2376,12 @@ class GitFS(GitBase):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if not os.path.isdir(self.file_list_cachedir):
|
||||
try:
|
||||
@ -2446,11 +2449,12 @@ class GitFS(GitBase):
|
||||
'''
|
||||
if 'env' in load:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
load['saltenv'] = load.pop('env')
|
||||
load.pop('env')
|
||||
|
||||
if load['saltenv'] not in self.envs():
|
||||
return {}
|
||||
|
@ -54,17 +54,8 @@ class SaltCacheLoader(BaseLoader):
|
||||
Templates are cached like regular salt states
|
||||
and only loaded once per loader instance.
|
||||
'''
|
||||
def __init__(self, opts, saltenv='base', encoding='utf-8', env=None,
|
||||
def __init__(self, opts, saltenv='base', encoding='utf-8',
|
||||
pillar_rend=False):
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
self.opts = opts
|
||||
self.saltenv = saltenv
|
||||
self.encoding = encoding
|
||||
|
@ -44,16 +44,7 @@ class SaltMakoTemplateLookup(TemplateCollection):
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, opts, saltenv='base', env=None, pillar_rend=False):
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
def __init__(self, opts, saltenv='base', pillar_rend=False):
|
||||
self.opts = opts
|
||||
self.saltenv = saltenv
|
||||
self._file_client = None
|
||||
|
@ -72,17 +72,7 @@ class MasterPillarUtil(object):
|
||||
use_cached_pillar=True,
|
||||
grains_fallback=True,
|
||||
pillar_fallback=True,
|
||||
opts=None,
|
||||
env=None):
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt '
|
||||
'Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
opts=None):
|
||||
|
||||
log.debug('New instance of {0} created.'.format(
|
||||
self.__class__.__name__))
|
||||
|
@ -139,14 +139,14 @@ class Sls(object):
|
||||
self.options.update(options)
|
||||
|
||||
def include(self, *sls_names, **kws):
|
||||
if kws.get('env', None) is not None:
|
||||
if 'env' in kws:
|
||||
warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
kws['saltenv'] = kws.pop('env')
|
||||
kws.pop('env')
|
||||
|
||||
saltenv = kws.get('saltenv', self.saltenv)
|
||||
|
||||
|
@ -26,11 +26,12 @@ def parse(url):
|
||||
|
||||
if '?env=' in resource:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the salt:// URL. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
path, saltenv = resource.split('?env=', 1)
|
||||
path, saltenv = resource.split('?env=', 1)[0], None
|
||||
elif '?saltenv=' in resource:
|
||||
path, saltenv = resource.split('?saltenv=', 1)
|
||||
else:
|
||||
|
@ -14,19 +14,10 @@ import salt.utils
|
||||
import salt.ext.six as six
|
||||
|
||||
|
||||
def find(path, saltenv='base', env=None):
|
||||
def find(path, saltenv='base'):
|
||||
'''
|
||||
Return a dict of the files located with the given path and environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Return a list of paths + text or bin
|
||||
ret = []
|
||||
if saltenv not in __opts__['file_roots']:
|
||||
@ -43,19 +34,10 @@ def find(path, saltenv='base', env=None):
|
||||
return ret
|
||||
|
||||
|
||||
def list_env(saltenv='base', env=None):
|
||||
def list_env(saltenv='base'):
|
||||
'''
|
||||
Return all of the file paths found in an environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = {}
|
||||
if saltenv not in __opts__['file_roots']:
|
||||
return ret
|
||||
@ -93,19 +75,10 @@ def list_roots():
|
||||
return ret
|
||||
|
||||
|
||||
def read(path, saltenv='base', env=None):
|
||||
def read(path, saltenv='base'):
|
||||
'''
|
||||
Read the contents of a text file, if the file is binary then
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Return a dict of paths + content
|
||||
ret = []
|
||||
files = find(path, saltenv)
|
||||
@ -118,20 +91,11 @@ def read(path, saltenv='base', env=None):
|
||||
return ret
|
||||
|
||||
|
||||
def write(data, path, saltenv='base', index=0, env=None):
|
||||
def write(data, path, saltenv='base', index=0):
|
||||
'''
|
||||
Write the named file, by default the first file found is written, but the
|
||||
index of the file can be specified to write to a lower priority file root
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
if saltenv not in __opts__['file_roots']:
|
||||
return 'Named environment {0} is not present'.format(saltenv)
|
||||
if len(__opts__['file_roots'][saltenv]) <= index:
|
||||
|
@ -15,19 +15,10 @@ import salt.utils
|
||||
import salt.ext.six as six
|
||||
|
||||
|
||||
def find(path, saltenv='base', env=None):
|
||||
def find(path, saltenv='base'):
|
||||
'''
|
||||
Return a dict of the files located with the given path and environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Return a list of paths + text or bin
|
||||
ret = []
|
||||
if saltenv not in __opts__['pillar_roots']:
|
||||
@ -44,19 +35,10 @@ def find(path, saltenv='base', env=None):
|
||||
return ret
|
||||
|
||||
|
||||
def list_env(saltenv='base', env=None):
|
||||
def list_env(saltenv='base'):
|
||||
'''
|
||||
Return all of the file paths found in an environment
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
ret = {}
|
||||
if saltenv not in __opts__['pillar_roots']:
|
||||
return ret
|
||||
@ -94,19 +76,10 @@ def list_roots():
|
||||
return ret
|
||||
|
||||
|
||||
def read(path, saltenv='base', env=None):
|
||||
def read(path, saltenv='base'):
|
||||
'''
|
||||
Read the contents of a text file, if the file is binary then
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
# Return a dict of paths + content
|
||||
ret = []
|
||||
files = find(path, saltenv)
|
||||
@ -119,20 +92,11 @@ def read(path, saltenv='base', env=None):
|
||||
return ret
|
||||
|
||||
|
||||
def write(data, path, saltenv='base', index=0, env=None):
|
||||
def write(data, path, saltenv='base', index=0):
|
||||
'''
|
||||
Write the named file, by default the first file found is written, but the
|
||||
index of the file can be specified to write to a lower priority file root
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Carbon.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
if saltenv not in __opts__['pillar_roots']:
|
||||
return 'Named environment {0} is not present'.format(saltenv)
|
||||
if len(__opts__['pillar_roots'][saltenv]) <= index:
|
||||
|
@ -5,7 +5,6 @@ tests for host state
|
||||
|
||||
# Import python libs
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting.helpers import ensure_in_syspath
|
||||
@ -13,7 +12,6 @@ ensure_in_syspath('../../')
|
||||
|
||||
# Import salt libs
|
||||
import integration
|
||||
import salt.utils
|
||||
|
||||
|
||||
class CompileTest(integration.ModuleCase):
|
||||
@ -39,43 +37,6 @@ class CompileTest(integration.ModuleCase):
|
||||
self.assertTrue(
|
||||
ret[0].strip().endswith('Exception: hehehe'))
|
||||
|
||||
def test_env_in_jinja_context(self):
|
||||
salt.utils.warn_until(
|
||||
'Carbon',
|
||||
'We are only supporting \'env\' in the templating context until Carbon comes out. '
|
||||
'Once this warning is show, please remove the test case',
|
||||
_dont_call_warnings=True
|
||||
)
|
||||
managed_file = os.path.join(integration.TMP, 'env-in-jinja-ctx.txt')
|
||||
template = [
|
||||
'{0}:'.format(managed_file),
|
||||
' file.managed:',
|
||||
' - contents: {{ saltenv }}',
|
||||
' - contents_newline: False'
|
||||
]
|
||||
try:
|
||||
ret = self.run_function('state.template_str', ['\n'.join(template)], timeout=120)
|
||||
with salt.utils.fopen(managed_file) as fhr:
|
||||
self.assertEqual('base', fhr.read())
|
||||
finally:
|
||||
if os.path.isfile(managed_file):
|
||||
os.unlink(managed_file)
|
||||
|
||||
template = [
|
||||
'{0}:'.format(managed_file),
|
||||
' file.managed:',
|
||||
' - contents: {{ env }}',
|
||||
' - contents_newline: False'
|
||||
|
||||
]
|
||||
try:
|
||||
ret = self.run_function('state.template_str', ['\n'.join(template)], timeout=120)
|
||||
with salt.utils.fopen(managed_file) as fhr:
|
||||
self.assertEqual('base', fhr.read())
|
||||
finally:
|
||||
if os.path.isfile(managed_file):
|
||||
os.unlink(managed_file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
|
@ -89,9 +89,18 @@ class PyDSLRendererTestCase(CommonTestCaseBoilerplate):
|
||||
through setUp/tearDown can create dangerous race conditions!
|
||||
'''
|
||||
|
||||
def render_sls(self, content, sls='', env='base', **kws):
|
||||
def render_sls(self, content, sls='', saltenv='base', **kws):
|
||||
if 'env' in kws:
|
||||
salt.utils.warn_until(
|
||||
'Oxygen',
|
||||
'Parameter \'env\' has been detected in the argument list. This '
|
||||
'parameter is no longer used and has been replaced by \'saltenv\' '
|
||||
'as of Salt Carbon. This warning will be removed in Salt Oxygen.'
|
||||
)
|
||||
kws.pop('env')
|
||||
|
||||
return self.HIGHSTATE.state.rend['pydsl'](
|
||||
StringIO(content), env=env, sls=sls, **kws
|
||||
StringIO(content), saltenv=saltenv, sls=sls, **kws
|
||||
)
|
||||
|
||||
def test_state_declarations(self):
|
||||
|
@ -45,16 +45,6 @@ class UrlTestCase(TestCase):
|
||||
|
||||
self.assertEqual(salt.utils.url.parse(url), (path, None))
|
||||
|
||||
def test_parse_salt_env(self):
|
||||
'''
|
||||
Test parsing a 'salt://' URL with an '?env=' query
|
||||
'''
|
||||
env = 'milieu'
|
||||
path = '?funny/path&with {interesting|chars}'
|
||||
url = 'salt://' + path + '?saltenv=' + env
|
||||
|
||||
self.assertEqual(salt.utils.url.parse(url), (path, env))
|
||||
|
||||
def test_parse_salt_saltenv(self):
|
||||
'''
|
||||
Test parsing a 'salt://' URL with a '?saltenv=' query
|
||||
|
Loading…
Reference in New Issue
Block a user