diff --git a/doc/ref/states/top.rst b/doc/ref/states/top.rst index 053b561060eb..62e1f569f851 100644 --- a/doc/ref/states/top.rst +++ b/doc/ref/states/top.rst @@ -379,7 +379,7 @@ disregarded: With :ref:`GitFS `, it can also be helpful to simply manage each environment's top file separately, and/or manually specify the environment when executing the highstate to avoid any complicated merging scenarios. -:conf_master:`gitfs_env_whitelist` and :conf_master:`gitfs_env_blacklist` can +:conf_master:`gitfs_saltenv_whitelist` and :conf_master:`gitfs_saltenv_blacklist` can also be used to hide unneeded branches and tags from GitFS to reduce the number of top files in play. diff --git a/salt/config/__init__.py b/salt/config/__init__.py index 0f42e68130e3..0dcce5907363 100644 --- a/salt/config/__init__.py +++ b/salt/config/__init__.py @@ -690,8 +690,6 @@ def _gather_buffer_space(): 'gitfs_privkey': six.string_types, 'gitfs_pubkey': six.string_types, 'gitfs_passphrase': six.string_types, - 'gitfs_env_whitelist': list, - 'gitfs_env_blacklist': list, 'gitfs_saltenv_whitelist': list, 'gitfs_saltenv_blacklist': list, 'gitfs_ssl_verify': bool, @@ -1320,8 +1318,6 @@ def _gather_buffer_space(): 'gitfs_privkey': '', 'gitfs_pubkey': '', 'gitfs_passphrase': '', - 'gitfs_env_whitelist': [], - 'gitfs_env_blacklist': [], 'gitfs_saltenv_whitelist': [], 'gitfs_saltenv_blacklist': [], 'gitfs_global_lock': True, @@ -1566,8 +1562,6 @@ def _gather_buffer_space(): 'gitfs_privkey': '', 'gitfs_pubkey': '', 'gitfs_passphrase': '', - 'gitfs_env_whitelist': [], - 'gitfs_env_blacklist': [], 'gitfs_saltenv_whitelist': [], 'gitfs_saltenv_blacklist': [], 'gitfs_global_lock': True, diff --git a/salt/fileserver/gitfs.py b/salt/fileserver/gitfs.py index 479f32329293..494ca3756119 100644 --- a/salt/fileserver/gitfs.py +++ b/salt/fileserver/gitfs.py @@ -55,8 +55,8 @@ PER_REMOTE_OVERRIDES = ( 'base', 'mountpoint', 'root', 'ssl_verify', 'saltenv_whitelist', 'saltenv_blacklist', - 'env_whitelist', 'env_blacklist', 'refspecs', - 'disable_saltenv_mapping', 'ref_types', 'update_interval', + 'refspecs', 'disable_saltenv_mapping', + 'ref_types', 'update_interval', ) PER_REMOTE_ONLY = ('all_saltenvs', 'name', 'saltenv') diff --git a/salt/utils/gitfs.py b/salt/utils/gitfs.py index 0dcb29d6b1fc..54fa0b7fe86e 100644 --- a/salt/utils/gitfs.py +++ b/salt/utils/gitfs.py @@ -159,8 +159,6 @@ def enforce_types(key, val): 'ssl_verify': bool, 'insecure_auth': bool, 'disable_saltenv_mapping': bool, - 'env_whitelist': 'stringlist', - 'env_blacklist': 'stringlist', 'saltenv_whitelist': 'stringlist', 'saltenv_blacklist': 'stringlist', 'refspecs': 'stringlist', @@ -391,17 +389,6 @@ def __init__(self, opts, remote, per_remote_defaults, per_remote_only, '\'%s\'.', default_refspecs, self.role, self.id ) - for item in ('env_whitelist', 'env_blacklist'): - val = getattr(self, item, None) - if val: - salt.utils.versions.warn_until( - 'Neon', - 'The gitfs_{0} config option (and {0} per-remote config ' - 'option) have been renamed to gitfs_salt{0} (and ' - 'salt{0}). Please update your configuration.'.format(item) - ) - setattr(self, 'salt{0}'.format(item), val) - # Discard the conf dictionary since we have set all of the config # params as attributes delattr(self, 'conf') diff --git a/tests/unit/fileserver/test_gitfs.py b/tests/unit/fileserver/test_gitfs.py index 1f9ffcb92582..10dcdc2cf8c8 100644 --- a/tests/unit/fileserver/test_gitfs.py +++ b/tests/unit/fileserver/test_gitfs.py @@ -92,8 +92,6 @@ def setup_loader_modules(self): 'transport': 'zeromq', 'gitfs_mountpoint': '', 'gitfs_saltenv': [], - 'gitfs_env_whitelist': [], - 'gitfs_env_blacklist': [], 'gitfs_saltenv_whitelist': [], 'gitfs_saltenv_blacklist': [], 'gitfs_user': '', @@ -316,6 +314,51 @@ def test_disable_saltenv_mapping_global_with_mapping_defined_globally(self): # the envs list, but the branches should not. self.assertEqual(ret, ['base', 'foo']) + def test_saltenv_blacklist(self): + ''' + test saltenv_blacklist + ''' + opts = salt.utils.yaml.safe_load(textwrap.dedent('''\ + gitfs_saltenv_blacklist: base + ''')) + with patch.dict(gitfs.__opts__, opts): + gitfs.update() + ret = gitfs.envs(ignore_cache=True) + assert 'base' not in ret + assert UNICODE_ENVNAME in ret + assert 'mytag' in ret + + def test_saltenv_whitelist(self): + ''' + test saltenv_whitelist + ''' + opts = salt.utils.yaml.safe_load(textwrap.dedent('''\ + gitfs_saltenv_whitelist: base + ''')) + with patch.dict(gitfs.__opts__, opts): + gitfs.update() + ret = gitfs.envs(ignore_cache=True) + assert 'base' in ret + assert UNICODE_ENVNAME not in ret + assert 'mytag' not in ret + + def test_env_deprecated_opts(self): + ''' + ensure deprecated options gitfs_env_whitelist + and gitfs_env_blacklist do not cause gitfs to + not load. + ''' + opts = salt.utils.yaml.safe_load(textwrap.dedent('''\ + gitfs_env_whitelist: base + gitfs_env_blacklist: '' + ''')) + with patch.dict(gitfs.__opts__, opts): + gitfs.update() + ret = gitfs.envs(ignore_cache=True) + assert 'base' in ret + assert UNICODE_ENVNAME in ret + assert 'mytag' in ret + def test_disable_saltenv_mapping_global_with_mapping_defined_per_remote(self): ''' Test the global gitfs_disable_saltenv_mapping config option, combined @@ -488,8 +531,6 @@ def setup_loader_modules(self): 'transport': 'zeromq', 'gitfs_mountpoint': '', 'gitfs_saltenv': [], - 'gitfs_env_whitelist': [], - 'gitfs_env_blacklist': [], 'gitfs_saltenv_whitelist': [], 'gitfs_saltenv_blacklist': [], 'gitfs_user': '', @@ -534,8 +575,6 @@ def setup_loader_modules(self): 'transport': 'zeromq', 'gitfs_mountpoint': '', 'gitfs_saltenv': [], - 'gitfs_env_whitelist': [], - 'gitfs_env_blacklist': [], 'gitfs_saltenv_whitelist': [], 'gitfs_saltenv_blacklist': [], 'gitfs_user': '',