mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Rename cache_source arg to keep_source
This new argument name is ambiguous as "cache" can either be interpreted as a noun or a verb.
This commit is contained in:
parent
bb1d40e425
commit
4d7bcff58f
@ -160,7 +160,6 @@ def extracted(name,
|
|||||||
source_hash_name=None,
|
source_hash_name=None,
|
||||||
source_hash_update=False,
|
source_hash_update=False,
|
||||||
skip_verify=False,
|
skip_verify=False,
|
||||||
cache_source=True,
|
|
||||||
password=None,
|
password=None,
|
||||||
options=None,
|
options=None,
|
||||||
list_options=None,
|
list_options=None,
|
||||||
@ -405,7 +404,7 @@ def extracted(name,
|
|||||||
|
|
||||||
.. versionadded:: 2016.3.4
|
.. versionadded:: 2016.3.4
|
||||||
|
|
||||||
cache_source : True
|
keep_source : True
|
||||||
For ``source`` archives not local to the minion (i.e. from the Salt
|
For ``source`` archives not local to the minion (i.e. from the Salt
|
||||||
fileserver or a remote source such as ``http(s)`` or ``ftp``), Salt
|
fileserver or a remote source such as ``http(s)`` or ``ftp``), Salt
|
||||||
will need to download the archive to the minion cache before they can
|
will need to download the archive to the minion cache before they can
|
||||||
@ -415,8 +414,11 @@ def extracted(name,
|
|||||||
.. versionadded:: 2017.7.3
|
.. versionadded:: 2017.7.3
|
||||||
|
|
||||||
keep : True
|
keep : True
|
||||||
.. deprecated:: 2017.7.3
|
Same as ``keep_source``.
|
||||||
Use ``cache_source`` instead
|
|
||||||
|
.. note::
|
||||||
|
If both ``keep_source`` and ``keep`` are used, ``keep`` will be
|
||||||
|
ignored.
|
||||||
|
|
||||||
password
|
password
|
||||||
**For ZIP archives only.** Password used for extraction.
|
**For ZIP archives only.** Password used for extraction.
|
||||||
@ -646,13 +648,20 @@ def extracted(name,
|
|||||||
# Remove pub kwargs as they're irrelevant here.
|
# Remove pub kwargs as they're irrelevant here.
|
||||||
kwargs = salt.utils.args.clean_kwargs(**kwargs)
|
kwargs = salt.utils.args.clean_kwargs(**kwargs)
|
||||||
|
|
||||||
if 'keep' in kwargs:
|
if 'keep_source' in kwargs and 'keep' in kwargs:
|
||||||
cache_source = bool(kwargs.pop('keep'))
|
|
||||||
ret.setdefault('warnings', []).append(
|
ret.setdefault('warnings', []).append(
|
||||||
'The \'keep\' argument has been renamed to \'cache_source\'. '
|
'Both \'keep_source\' and \'keep\' were used. Since these both '
|
||||||
'Assumed cache_source={0}. Please update your SLS to get rid of '
|
'do the same thing, \'keep\' was ignored.'
|
||||||
'this warning.'.format(cache_source)
|
|
||||||
)
|
)
|
||||||
|
keep_source = bool(kwargs.pop('keep_source'))
|
||||||
|
kwargs.pop('keep')
|
||||||
|
elif 'keep_source' in kwargs:
|
||||||
|
keep_source = bool(kwargs.pop('keep_source'))
|
||||||
|
elif 'keep' in kwargs:
|
||||||
|
keep_source = bool(kwargs.pop('keep'))
|
||||||
|
else:
|
||||||
|
# Neither was passed, default is True
|
||||||
|
keep_source = True
|
||||||
|
|
||||||
if not _path_is_abs(name):
|
if not _path_is_abs(name):
|
||||||
ret['comment'] = '{0} is not an absolute path'.format(name)
|
ret['comment'] = '{0} is not an absolute path'.format(name)
|
||||||
@ -1492,7 +1501,7 @@ def extracted(name,
|
|||||||
for item in enforce_failed:
|
for item in enforce_failed:
|
||||||
ret['comment'] += '\n- {0}'.format(item)
|
ret['comment'] += '\n- {0}'.format(item)
|
||||||
|
|
||||||
if not cache_source and not source_is_local:
|
if not keep_source and not source_is_local:
|
||||||
log.debug('Cleaning cached source file %s', cached)
|
log.debug('Cleaning cached source file %s', cached)
|
||||||
result = __states__['file.not_cached'](source_match, saltenv=__env__)
|
result = __states__['file.not_cached'](source_match, saltenv=__env__)
|
||||||
if not result['result']:
|
if not result['result']:
|
||||||
|
@ -1531,7 +1531,7 @@ def managed(name,
|
|||||||
source=None,
|
source=None,
|
||||||
source_hash='',
|
source_hash='',
|
||||||
source_hash_name=None,
|
source_hash_name=None,
|
||||||
cache_source=True,
|
keep_source=True,
|
||||||
user=None,
|
user=None,
|
||||||
group=None,
|
group=None,
|
||||||
mode=None,
|
mode=None,
|
||||||
@ -1731,7 +1731,7 @@ def managed(name,
|
|||||||
|
|
||||||
.. versionadded:: 2016.3.5
|
.. versionadded:: 2016.3.5
|
||||||
|
|
||||||
cache_source : True
|
keep_source : True
|
||||||
Set to ``False`` to discard the cached copy of the source file once the
|
Set to ``False`` to discard the cached copy of the source file once the
|
||||||
state completes. This can be useful for larger files to keep them from
|
state completes. This can be useful for larger files to keep them from
|
||||||
taking up space in minion cache. However, keep in mind that discarding
|
taking up space in minion cache. However, keep in mind that discarding
|
||||||
@ -2452,7 +2452,7 @@ def managed(name,
|
|||||||
ret['changes'] = {}
|
ret['changes'] = {}
|
||||||
log.debug(traceback.format_exc())
|
log.debug(traceback.format_exc())
|
||||||
salt.utils.files.remove(tmp_filename)
|
salt.utils.files.remove(tmp_filename)
|
||||||
if not cache_source and sfn:
|
if not keep_source and sfn:
|
||||||
salt.utils.files.remove(sfn)
|
salt.utils.files.remove(sfn)
|
||||||
return _error(ret, 'Unable to check_cmd file: {0}'.format(exc))
|
return _error(ret, 'Unable to check_cmd file: {0}'.format(exc))
|
||||||
|
|
||||||
@ -2524,7 +2524,7 @@ def managed(name,
|
|||||||
finally:
|
finally:
|
||||||
if tmp_filename:
|
if tmp_filename:
|
||||||
salt.utils.files.remove(tmp_filename)
|
salt.utils.files.remove(tmp_filename)
|
||||||
if not cache_source and sfn:
|
if not keep_source and sfn:
|
||||||
salt.utils.files.remove(sfn)
|
salt.utils.files.remove(sfn)
|
||||||
|
|
||||||
|
|
||||||
@ -3054,7 +3054,7 @@ def directory(name,
|
|||||||
|
|
||||||
def recurse(name,
|
def recurse(name,
|
||||||
source,
|
source,
|
||||||
cache_source=True,
|
keep_source=True,
|
||||||
clean=False,
|
clean=False,
|
||||||
require=None,
|
require=None,
|
||||||
user=None,
|
user=None,
|
||||||
@ -3087,7 +3087,7 @@ def recurse(name,
|
|||||||
located on the master in the directory named spam, and is called eggs,
|
located on the master in the directory named spam, and is called eggs,
|
||||||
the source string is salt://spam/eggs
|
the source string is salt://spam/eggs
|
||||||
|
|
||||||
cache_source : True
|
keep_source : True
|
||||||
Set to ``False`` to discard the cached copy of the source file once the
|
Set to ``False`` to discard the cached copy of the source file once the
|
||||||
state completes. This can be useful for larger files to keep them from
|
state completes. This can be useful for larger files to keep them from
|
||||||
taking up space in minion cache. However, keep in mind that discarding
|
taking up space in minion cache. However, keep in mind that discarding
|
||||||
@ -3376,7 +3376,7 @@ def recurse(name,
|
|||||||
_ret = managed(
|
_ret = managed(
|
||||||
path,
|
path,
|
||||||
source=source,
|
source=source,
|
||||||
cache_source=cache_source,
|
keep_source=keep_source,
|
||||||
user=user,
|
user=user,
|
||||||
group=group,
|
group=group,
|
||||||
mode='keep' if keep_mode else file_mode,
|
mode='keep' if keep_mode else file_mode,
|
||||||
|
Loading…
Reference in New Issue
Block a user