mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
File state born deprecations.
Removed all Boron warning and deprecated code.
This commit is contained in:
parent
e618cd47a6
commit
b20738a5a1
@ -3999,7 +3999,7 @@ def manage_file(name,
|
||||
backup,
|
||||
makedirs=False,
|
||||
template=None, # pylint: disable=W0613
|
||||
show_diff=True,
|
||||
show_changes=True,
|
||||
contents=None,
|
||||
dir_mode=None,
|
||||
follow_symlinks=True):
|
||||
@ -4044,7 +4044,7 @@ def manage_file(name,
|
||||
template
|
||||
format of templating
|
||||
|
||||
show_diff
|
||||
show_changes
|
||||
Include diff in state return
|
||||
|
||||
contents:
|
||||
@ -4107,8 +4107,8 @@ def manage_file(name,
|
||||
# Print a diff equivalent to diff -u old new
|
||||
if __salt__['config.option']('obfuscate_templates'):
|
||||
ret['changes']['diff'] = '<Obfuscated Template>'
|
||||
elif not show_diff:
|
||||
ret['changes']['diff'] = '<show_diff=False>'
|
||||
elif not show_changes:
|
||||
ret['changes']['diff'] = '<show_changes=False>'
|
||||
else:
|
||||
# Check to see if the files are bins
|
||||
bdiff = _binary_replace(real_name, sfn)
|
||||
@ -4155,8 +4155,8 @@ def manage_file(name,
|
||||
if different:
|
||||
if __salt__['config.option']('obfuscate_templates'):
|
||||
ret['changes']['diff'] = '<Obfuscated Template>'
|
||||
elif not show_diff:
|
||||
ret['changes']['diff'] = '<show_diff=False>'
|
||||
elif not show_changes:
|
||||
ret['changes']['diff'] = '<show_changes=False>'
|
||||
else:
|
||||
if salt.utils.istextfile(real_name):
|
||||
ret['changes']['diff'] = \
|
||||
|
@ -1087,7 +1087,6 @@ def managed(name,
|
||||
defaults=None,
|
||||
env=None,
|
||||
backup='',
|
||||
show_diff=None,
|
||||
show_changes=True,
|
||||
create=True,
|
||||
contents=None,
|
||||
@ -1254,12 +1253,6 @@ def managed(name,
|
||||
backup
|
||||
Overrides the default backup mode for this specific file.
|
||||
|
||||
show_diff
|
||||
DEPRECATED: Please use show_changes.
|
||||
|
||||
If set to ``False``, the diff will not be shown in the return data if
|
||||
changes are made.
|
||||
|
||||
show_changes
|
||||
Output a unified diff of the old file and the new file. If ``False``
|
||||
return a boolean if any changes were made.
|
||||
@ -1530,17 +1523,6 @@ def managed(name,
|
||||
return _error(
|
||||
ret, 'Specified file {0} is not an absolute path'.format(name))
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
msg = (
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This warning will go away in Salt Boron and this '
|
||||
'will be the default and expected behavior. Please update your '
|
||||
'state files.'
|
||||
)
|
||||
salt.utils.warn_until('Boron', msg)
|
||||
ret.setdefault('warnings', []).append(msg)
|
||||
# No need to set __env__ = env since that's done in the state machinery
|
||||
|
||||
if os.path.isdir(name):
|
||||
ret['comment'] = 'Specified target {0} is a directory'.format(name)
|
||||
ret['result'] = False
|
||||
@ -1589,14 +1571,6 @@ def managed(name,
|
||||
else:
|
||||
ret['pchanges'] = {}
|
||||
|
||||
if show_diff is not None:
|
||||
show_changes = show_diff
|
||||
msg = (
|
||||
'The \'show_diff\' argument to the file.managed state has been '
|
||||
'deprecated, please use \'show_changes\' instead.'
|
||||
)
|
||||
salt.utils.warn_until('Boron', msg)
|
||||
|
||||
try:
|
||||
if __opts__['test']:
|
||||
if ret['pchanges']:
|
||||
@ -1674,7 +1648,7 @@ def managed(name,
|
||||
backup,
|
||||
makedirs,
|
||||
template,
|
||||
show_diff,
|
||||
show_changes,
|
||||
contents,
|
||||
dir_mode,
|
||||
follow_symlinks)
|
||||
@ -1730,7 +1704,7 @@ def managed(name,
|
||||
backup,
|
||||
makedirs,
|
||||
template,
|
||||
show_diff,
|
||||
show_changes,
|
||||
contents,
|
||||
dir_mode,
|
||||
follow_symlinks)
|
||||
@ -2284,17 +2258,6 @@ def recurse(name,
|
||||
return _error(
|
||||
ret, 'Specified file {0} is not an absolute path'.format(name))
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
msg = (
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This warning will go away in Salt Boron and this '
|
||||
'will be the default and expected behavior. Please update your '
|
||||
'state files.'
|
||||
)
|
||||
salt.utils.warn_until('Boron', msg)
|
||||
ret.setdefault('warnings', []).append(msg)
|
||||
# No need to set __env__ = env since that's done in the state machinery
|
||||
|
||||
# expand source into source_list
|
||||
source_list = _validate_str_list(source)
|
||||
|
||||
@ -3776,17 +3739,6 @@ def patch(name,
|
||||
ret.update(result=True, comment='Patch is already applied')
|
||||
return ret
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
msg = (
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This warning will go away in Salt Boron and this '
|
||||
'will be the default and expected behavior. Please update your '
|
||||
'state files.'
|
||||
)
|
||||
salt.utils.warn_until('Boron', msg)
|
||||
ret.setdefault('warnings', []).append(msg)
|
||||
# No need to set __env__ = env since that's done in the state machinery
|
||||
|
||||
# get cached file or copy it to cache
|
||||
cached_source_path = __salt__['cp.cache_file'](source, __env__)
|
||||
if not cached_source_path:
|
||||
@ -4422,17 +4374,6 @@ def serialize(name,
|
||||
if not name:
|
||||
return _error(ret, 'Must provide name to file.serialize')
|
||||
|
||||
if isinstance(env, six.string_types):
|
||||
msg = (
|
||||
'Passing a salt environment should be done using \'saltenv\' not '
|
||||
'\'env\'. This warning will go away in Salt Boron and this '
|
||||
'will be the default and expected behavior. Please update your '
|
||||
'state files.'
|
||||
)
|
||||
salt.utils.warn_until('Boron', msg)
|
||||
ret.setdefault('warnings', []).append(msg)
|
||||
# No need to set __env__ = env since that's done in the state machinery
|
||||
|
||||
if not create:
|
||||
if not os.path.isfile(name):
|
||||
# Don't create a file that is not already present
|
||||
|
@ -233,21 +233,21 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
self.assertSaltNoneReturn(ret)
|
||||
self.assertFalse(os.path.isfile(name))
|
||||
|
||||
def test_managed_show_diff_false(self):
|
||||
def test_managed_show_changes_false(self):
|
||||
'''
|
||||
file.managed test interface
|
||||
'''
|
||||
name = os.path.join(integration.TMP, 'grail_not_scene33')
|
||||
with salt.utils.fopen(name, 'wb') as fp_:
|
||||
fp_.write('test_managed_show_diff_false\n')
|
||||
fp_.write('test_managed_show_changes_false\n')
|
||||
|
||||
ret = self.run_state(
|
||||
'file.managed', name=name, source='salt://grail/scene33',
|
||||
show_diff=False
|
||||
show_changes=False
|
||||
)
|
||||
|
||||
changes = next(six.itervalues(ret))['changes']
|
||||
self.assertEqual('<show_diff=False>', changes['diff'])
|
||||
self.assertEqual('<show_changes=False>', changes['diff'])
|
||||
|
||||
def test_managed_escaped_file_path(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user