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