mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Removed env from cp.py
This commit is contained in:
parent
ef36afe5de
commit
02a0c551ab
@ -153,7 +153,6 @@ def get_file(path,
|
||||
makedirs=False,
|
||||
template=None,
|
||||
gzip=None,
|
||||
env=None,
|
||||
**kwargs):
|
||||
'''
|
||||
Used to get a single file from the salt master
|
||||
@ -183,15 +182,6 @@ def get_file(path,
|
||||
is the lightest compression and 9 the heaviest. 1 uses the least CPU on
|
||||
the master (and minion), 9 uses the most.
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
(path, dest) = _render_filenames(path, dest, saltenv, template, **kwargs)
|
||||
|
||||
path, senv = salt.utils.url.split_env(path)
|
||||
@ -214,7 +204,6 @@ def get_template(path,
|
||||
dest,
|
||||
template='jinja',
|
||||
saltenv='base',
|
||||
env=None,
|
||||
makedirs=False,
|
||||
**kwargs):
|
||||
'''
|
||||
@ -228,15 +217,6 @@ def get_template(path,
|
||||
|
||||
salt '*' cp.get_template salt://path/to/template /minion/dest
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
if 'salt' not in kwargs:
|
||||
kwargs['salt'] = __salt__
|
||||
@ -255,7 +235,7 @@ def get_template(path,
|
||||
**kwargs)
|
||||
|
||||
|
||||
def get_dir(path, dest, saltenv='base', template=None, gzip=None, env=None, **kwargs):
|
||||
def get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs):
|
||||
'''
|
||||
Used to recursively copy a directory from the salt master
|
||||
|
||||
@ -267,22 +247,13 @@ def get_dir(path, dest, saltenv='base', template=None, gzip=None, env=None, **kw
|
||||
|
||||
get_dir supports the same template and gzip arguments as get_file.
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
(path, dest) = _render_filenames(path, dest, saltenv, template, **kwargs)
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].get_dir(path, dest, saltenv, gzip)
|
||||
|
||||
|
||||
def get_url(path, dest, saltenv='base', env=None):
|
||||
def get_url(path, dest, saltenv='base'):
|
||||
'''
|
||||
Used to get a single file from a URL.
|
||||
|
||||
@ -297,15 +268,6 @@ def get_url(path, dest, saltenv='base', env=None):
|
||||
salt '*' cp.get_url salt://my/file /tmp/mine
|
||||
salt '*' cp.get_url http://www.slashdot.org /tmp/index.html
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
if dest:
|
||||
return __context__['cp.fileclient'].get_url(path, dest, False, saltenv)
|
||||
@ -313,7 +275,7 @@ def get_url(path, dest, saltenv='base', env=None):
|
||||
return __context__['cp.fileclient'].get_url(path, None, False, saltenv, no_cache=True)
|
||||
|
||||
|
||||
def get_file_str(path, saltenv='base', env=None):
|
||||
def get_file_str(path, saltenv='base'):
|
||||
'''
|
||||
Return the contents of a file from a URL
|
||||
|
||||
@ -323,22 +285,13 @@ def get_file_str(path, saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.get_file_str salt://my/file
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
fn_ = cache_file(path, saltenv)
|
||||
with salt.utils.fopen(fn_, 'r') as fp_:
|
||||
data = fp_.read()
|
||||
return data
|
||||
|
||||
|
||||
def cache_file(path, saltenv='base', env=None):
|
||||
def cache_file(path, saltenv='base'):
|
||||
'''
|
||||
Used to cache a single file on the salt-minion
|
||||
Returns the location of the new cached file on the minion
|
||||
@ -349,15 +302,6 @@ def cache_file(path, saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.cache_file salt://path/to/file
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
|
||||
path, senv = salt.utils.url.split_env(path)
|
||||
@ -374,7 +318,7 @@ def cache_file(path, saltenv='base', env=None):
|
||||
return result
|
||||
|
||||
|
||||
def cache_files(paths, saltenv='base', env=None):
|
||||
def cache_files(paths, saltenv='base'):
|
||||
'''
|
||||
Used to gather many files from the master, the gathered files will be
|
||||
saved in the minion cachedir reflective to the paths retrieved from the
|
||||
@ -386,21 +330,12 @@ def cache_files(paths, saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.cache_files salt://pathto/file1,salt://pathto/file1
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].cache_files(paths, saltenv)
|
||||
|
||||
|
||||
def cache_dir(path, saltenv='base', include_empty=False, include_pat=None,
|
||||
exclude_pat=None, env=None):
|
||||
exclude_pat=None):
|
||||
'''
|
||||
Download and cache everything under a directory from the master
|
||||
|
||||
@ -432,22 +367,13 @@ def cache_dir(path, saltenv='base', include_empty=False, include_pat=None,
|
||||
salt '*' cp.cache_dir salt://path/to/dir
|
||||
salt '*' cp.cache_dir salt://path/to/dir include_pat='E@*.py$'
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].cache_dir(
|
||||
path, saltenv, include_empty, include_pat, exclude_pat
|
||||
)
|
||||
|
||||
|
||||
def cache_master(saltenv='base', env=None):
|
||||
def cache_master(saltenv='base'):
|
||||
'''
|
||||
Retrieve all of the files on the master and cache them locally
|
||||
|
||||
@ -457,15 +383,6 @@ def cache_master(saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.cache_master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].cache_master(saltenv)
|
||||
|
||||
@ -498,7 +415,7 @@ def cache_local_file(path):
|
||||
return __context__['cp.fileclient'].cache_local_file(path)
|
||||
|
||||
|
||||
def list_states(saltenv='base', env=None):
|
||||
def list_states(saltenv='base'):
|
||||
'''
|
||||
List all of the available state modules in an environment
|
||||
|
||||
@ -508,20 +425,11 @@ def list_states(saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.list_states
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].list_states(saltenv)
|
||||
|
||||
|
||||
def list_master(saltenv='base', prefix='', env=None):
|
||||
def list_master(saltenv='base', prefix=''):
|
||||
'''
|
||||
List all of the files stored on the master
|
||||
|
||||
@ -531,20 +439,11 @@ def list_master(saltenv='base', prefix='', env=None):
|
||||
|
||||
salt '*' cp.list_master
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].file_list(saltenv, prefix)
|
||||
|
||||
|
||||
def list_master_dirs(saltenv='base', prefix='', env=None):
|
||||
def list_master_dirs(saltenv='base', prefix=''):
|
||||
'''
|
||||
List all of the directories stored on the master
|
||||
|
||||
@ -554,20 +453,11 @@ def list_master_dirs(saltenv='base', prefix='', env=None):
|
||||
|
||||
salt '*' cp.list_master_dirs
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].dir_list(saltenv, prefix)
|
||||
|
||||
|
||||
def list_master_symlinks(saltenv='base', prefix='', env=None):
|
||||
def list_master_symlinks(saltenv='base', prefix=''):
|
||||
'''
|
||||
List all of the symlinks stored on the master
|
||||
|
||||
@ -577,20 +467,11 @@ def list_master_symlinks(saltenv='base', prefix='', env=None):
|
||||
|
||||
salt '*' cp.list_master_symlinks
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].symlink_list(saltenv, prefix)
|
||||
|
||||
|
||||
def list_minion(saltenv='base', env=None):
|
||||
def list_minion(saltenv='base'):
|
||||
'''
|
||||
List all of the files cached on the minion
|
||||
|
||||
@ -600,20 +481,11 @@ def list_minion(saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.list_minion
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].file_local_list(saltenv)
|
||||
|
||||
|
||||
def is_cached(path, saltenv='base', env=None):
|
||||
def is_cached(path, saltenv='base'):
|
||||
'''
|
||||
Return a boolean if the given path on the master has been cached on the
|
||||
minion
|
||||
@ -624,20 +496,11 @@ def is_cached(path, saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.is_cached salt://path/to/file
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
_mk_client()
|
||||
return __context__['cp.fileclient'].is_cached(path, saltenv)
|
||||
|
||||
|
||||
def hash_file(path, saltenv='base', env=None):
|
||||
def hash_file(path, saltenv='base'):
|
||||
'''
|
||||
Return the hash of a file, to get the hash of a file on the
|
||||
salt master file server prepend the path with salt://<file on server>
|
||||
@ -649,15 +512,6 @@ def hash_file(path, saltenv='base', env=None):
|
||||
|
||||
salt '*' cp.hash_file salt://path/to/file
|
||||
'''
|
||||
if env is not None:
|
||||
salt.utils.warn_until(
|
||||
'Boron',
|
||||
'Passing a salt environment should be done using \'saltenv\' '
|
||||
'not \'env\'. This functionality will be removed in Salt Boron.'
|
||||
)
|
||||
# Backwards compatibility
|
||||
saltenv = env
|
||||
|
||||
path, senv = salt.utils.url.split_env(path)
|
||||
if senv:
|
||||
saltenv = senv
|
||||
|
Loading…
Reference in New Issue
Block a user