Merge pull request #39808 from carlpett/vault-lowercase-policies

Vault: Always lowercase policies
This commit is contained in:
Mike Place 2017-03-03 08:21:59 -07:00 committed by GitHub
commit 7460e460e1
2 changed files with 9 additions and 2 deletions

View File

@ -120,7 +120,10 @@ def _get_policies(minion_id, config):
for pattern in policy_patterns:
try:
for expanded_pattern in _expand_pattern_lists(pattern, **mappings):
policies.append(expanded_pattern.format(**mappings))
policies.append(
expanded_pattern.format(**mappings)
.lower() # Vault requirement
)
except KeyError:
log.warning('Could not resolve policy pattern {0}'.format(pattern))

View File

@ -45,6 +45,7 @@ class VaultTest(TestCase):
}
}
},
'mixedcase': 'UP-low-UP',
'dictlist': [
{'foo': 'bar'},
{'baz': 'qux'}
@ -111,7 +112,10 @@ class VaultTest(TestCase):
'deeply-nested-list:hello',
'deeply-nested-list:world'
],
'should-not-cause-an-exception,but-result-empty:{foo}': []
'should-not-cause-an-exception,but-result-empty:{foo}': [],
'Case-Should-Be-Lowered:{grains[mixedcase]}': [
'case-should-be-lowered:up-low-up'
]
}
with patch('salt.utils.minions.get_minion_data',