Skip to content

Commit

Permalink
Merge pull request #55552 from Ch3LL/issue_49426
Browse files Browse the repository at this point in the history
Deprecate hgfs/svnfs_env_whitelist/blacklist
  • Loading branch information
dwoz authored Dec 19, 2019
2 parents 6b8fa5c + f80174c commit 0a6d5f4
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 52 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions doc/topics/releases/neon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ State Deprecations
:py:func:`MS Teams <salt.states.msteams>` or
:py:func:`Slack <salt.states.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
--------------

Expand Down
8 changes: 0 additions & 8 deletions salt/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
24 changes: 2 additions & 22 deletions salt/fileserver/hgfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
)


Expand Down
24 changes: 2 additions & 22 deletions salt/fileserver/svnfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
)


Expand Down
39 changes: 39 additions & 0 deletions tests/unit/fileserver/test_hgfs.py
Original file line number Diff line number Diff line change
@@ -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')
39 changes: 39 additions & 0 deletions tests/unit/fileserver/test_svnfs.py
Original file line number Diff line number Diff line change
@@ -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')

0 comments on commit 0a6d5f4

Please sign in to comment.