diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b1fd7fcf2d9..b8ca498675e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Versions are `MAJOR.PATCH`. - [#54943](https://github.com/saltstack/salt/pull/54943) - RAET transport method has been removed per the deprecation schedule - [@s0undt3ch](https://github.com/s0undt3ch) ### Deprecated +- [#55552](https://github.com/saltstack/salt/pull/55552) - The config options `hgfs_env_whitelist`, `hgfs_env_blacklist`, `svnfs_env_whitelist`, and `svnfs_env_whitelist` have been deprecated in favor of `hgfs_saltenv_whitelist`, `hgfs_saltenv_blacklist`, `svnfs_saltenv_whitelist`, `svnfs_saltenv_blacklist`. - [#55609](https://github.com/saltstack/salt/pull/55609) - Remove smartos grains `hypervisor_uuid` and `datacenter` in favor of `mdata:sdc:server_uuid` and `mdata:sdc:datacenter_name`. - [#55539](https://github.com/saltstack/salt/pull/55539) - Deprecate salt.auth.Authorize class and the any_auth method diff --git a/doc/topics/releases/neon.rst b/doc/topics/releases/neon.rst index 18aaeda73e41..0e70dc68ba6f 100644 --- a/doc/topics/releases/neon.rst +++ b/doc/topics/releases/neon.rst @@ -105,6 +105,19 @@ State Deprecations :py:func:`MS Teams ` or :py:func:`Slack ` may be suitable replacements. +Fileserver Deprecations +----------------------- + +- The hgfs fileserver had the following config options removed: + + - The ``hgfs_env_whitelist`` config option has been removed in favor of ``hgfs_saltenv_whitelist``. + - The ``hgfs_env_blacklist`` config option has been removed in favor of ``hgfs_saltenv_blacklist``. + +- The svnfs fileserver had the following config options removed: + + - The ``svnfs_env_whitelist`` config option has been removed in favor of ``svnfs_saltenv_whitelist``. + - The ``svnfs_env_blacklist`` config option has been removed in favor of ``svnfs_saltenv_blacklist``. + Engine Removal -------------- diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 76e946dde1e6..4a6605ca5892 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -704,8 +704,6 @@ def _gather_buffer_space(): 'hgfs_root': six.string_types, 'hgfs_base': six.string_types, 'hgfs_branch_method': six.string_types, - 'hgfs_env_whitelist': list, - 'hgfs_env_blacklist': list, 'hgfs_saltenv_whitelist': list, 'hgfs_saltenv_blacklist': list, 'svnfs_remotes': list, @@ -714,8 +712,6 @@ def _gather_buffer_space(): 'svnfs_trunk': six.string_types, 'svnfs_branches': six.string_types, 'svnfs_tags': six.string_types, - 'svnfs_env_whitelist': list, - 'svnfs_env_blacklist': list, 'svnfs_saltenv_whitelist': list, 'svnfs_saltenv_blacklist': list, 'minionfs_env': six.string_types, @@ -1582,8 +1578,6 @@ def _gather_buffer_space(): 'hgfs_root': '', 'hgfs_base': 'default', 'hgfs_branch_method': 'branches', - 'hgfs_env_whitelist': [], - 'hgfs_env_blacklist': [], 'hgfs_saltenv_whitelist': [], 'hgfs_saltenv_blacklist': [], 'show_timeout': True, @@ -1595,8 +1589,6 @@ def _gather_buffer_space(): 'svnfs_trunk': 'trunk', 'svnfs_branches': 'branches', 'svnfs_tags': 'tags', - 'svnfs_env_whitelist': [], - 'svnfs_env_blacklist': [], 'svnfs_saltenv_whitelist': [], 'svnfs_saltenv_blacklist': [], 'max_event_size': 1048576, diff --git a/salt/fileserver/hgfs.py b/salt/fileserver/hgfs.py index 9ccc5e27200a..6cdf0e666767 100644 --- a/salt/fileserver/hgfs.py +++ b/salt/fileserver/hgfs.py @@ -580,30 +580,10 @@ def _env_is_exposed(env): Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' - if __opts__['hgfs_env_whitelist']: - salt.utils.versions.warn_until( - 'Neon', - 'The hgfs_env_whitelist config option has been renamed to ' - 'hgfs_saltenv_whitelist. Please update your configuration.' - ) - whitelist = __opts__['hgfs_env_whitelist'] - else: - whitelist = __opts__['hgfs_saltenv_whitelist'] - - if __opts__['hgfs_env_blacklist']: - salt.utils.versions.warn_until( - 'Neon', - 'The hgfs_env_blacklist config option has been renamed to ' - 'hgfs_saltenv_blacklist. Please update your configuration.' - ) - blacklist = __opts__['hgfs_env_blacklist'] - else: - blacklist = __opts__['hgfs_saltenv_blacklist'] - return salt.utils.stringutils.check_whitelist_blacklist( env, - whitelist=whitelist, - blacklist=blacklist, + whitelist=__opts__['hgfs_saltenv_whitelist'], + blacklist=__opts__['hgfs_saltenv_blacklist'], ) diff --git a/salt/fileserver/svnfs.py b/salt/fileserver/svnfs.py index 18006599d250..6bd3f042a098 100644 --- a/salt/fileserver/svnfs.py +++ b/salt/fileserver/svnfs.py @@ -493,30 +493,10 @@ def _env_is_exposed(env): Check if an environment is exposed by comparing it against a whitelist and blacklist. ''' - if __opts__['svnfs_env_whitelist']: - salt.utils.versions.warn_until( - 'Neon', - 'The svnfs_env_whitelist config option has been renamed to ' - 'svnfs_saltenv_whitelist. Please update your configuration.' - ) - whitelist = __opts__['svnfs_env_whitelist'] - else: - whitelist = __opts__['svnfs_saltenv_whitelist'] - - if __opts__['svnfs_env_blacklist']: - salt.utils.versions.warn_until( - 'Neon', - 'The svnfs_env_blacklist config option has been renamed to ' - 'svnfs_saltenv_blacklist. Please update your configuration.' - ) - blacklist = __opts__['svnfs_env_blacklist'] - else: - blacklist = __opts__['svnfs_saltenv_blacklist'] - return salt.utils.stringutils.check_whitelist_blacklist( env, - whitelist=whitelist, - blacklist=blacklist, + whitelist=__opts__['svnfs_saltenv_whitelist'], + blacklist=__opts__['svnfs_saltenv_blacklist'], ) diff --git a/tests/unit/fileserver/test_hgfs.py b/tests/unit/fileserver/test_hgfs.py new file mode 100644 index 000000000000..b1fc50952b7c --- /dev/null +++ b/tests/unit/fileserver/test_hgfs.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Import Python libs +from __future__ import absolute_import, print_function, unicode_literals + +# Import Salt Testing libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support.unit import TestCase +from tests.support.mock import patch + +# Import Salt libs +import salt.fileserver.hgfs as hgfs + + +class HgfsFileTest(TestCase, LoaderModuleMockMixin): + def setup_loader_modules(self): + return { + hgfs: {} + } + + def test_env_is_exposed(self): + ''' + test _env_is_exposed method when + base is in whitelist + ''' + with patch.dict(hgfs.__opts__, + {'hgfs_saltenv_whitelist': 'base', + 'hgfs_saltenv_blacklist': ''}): + assert hgfs._env_is_exposed('base') + + def test_env_is_exposed_blacklist(self): + ''' + test _env_is_exposed method when + base is in blacklist + ''' + with patch.dict(hgfs.__opts__, + {'hgfs_saltenv_whitelist': '', + 'hgfs_saltenv_blacklist': 'base'}): + assert not hgfs._env_is_exposed('base') diff --git a/tests/unit/fileserver/test_svnfs.py b/tests/unit/fileserver/test_svnfs.py new file mode 100644 index 000000000000..b9b39edc07fc --- /dev/null +++ b/tests/unit/fileserver/test_svnfs.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# Import Python libs +from __future__ import absolute_import, print_function, unicode_literals + +# Import Salt Testing libs +from tests.support.mixins import LoaderModuleMockMixin +from tests.support.unit import TestCase +from tests.support.mock import patch + +# Import Salt libs +import salt.fileserver.svnfs as svnfs + + +class SvnfsFileTest(TestCase, LoaderModuleMockMixin): + def setup_loader_modules(self): + return { + svnfs: {} + } + + def test_env_is_exposed(self): + ''' + test _env_is_exposed method when + base is in whitelist + ''' + with patch.dict(svnfs.__opts__, + {'svnfs_saltenv_whitelist': 'base', + 'svnfs_saltenv_blacklist': ''}): + assert svnfs._env_is_exposed('base') + + def test_env_is_exposed_blacklist(self): + ''' + test _env_is_exposed method when + base is in blacklist + ''' + with patch.dict(svnfs.__opts__, + {'svnfs_saltenv_whitelist': '', + 'svnfs_saltenv_blacklist': 'base'}): + assert not svnfs._env_is_exposed('base')