2
0
mirror of https://github.com/openkmip/pykmip synced 2025-12-18 17:23:52 +00:00

Merge pull request #437 from OpenKMIP/feat/use-preset-over-default

Rename the 'default' policy section to 'preset'
This commit is contained in:
Peter Hamilton
2018-05-17 15:32:25 -04:00
committed by GitHub
7 changed files with 20 additions and 20 deletions

View File

@@ -71,7 +71,7 @@ def read_policy_from_file(path):
"{}".format(path, e)
)
policy_sections = {'groups', 'default'}
policy_sections = {'groups', 'preset'}
object_types = set([t.name for t in enums.ObjectType])
result = {}
@@ -84,9 +84,9 @@ def read_policy_from_file(path):
if sections <= policy_sections:
parsed_policies = dict()
default_policy = object_policy.get('default')
default_policy = object_policy.get('preset')
if default_policy:
parsed_policies['default'] = parse_policy(default_policy)
parsed_policies['preset'] = parse_policy(default_policy)
group_policies = object_policy.get('groups')
if group_policies:
@@ -100,7 +100,7 @@ def read_policy_from_file(path):
result[name] = parsed_policies
elif sections <= object_types:
policy = parse_policy(object_policy)
result[name] = {'default': policy}
result[name] = {'preset': policy}
else:
invalid_sections = sections - policy_sections - object_types
raise ValueError(
@@ -113,7 +113,7 @@ def read_policy_from_file(path):
policies = {
'default': {
'default': {
'preset': {
enums.ObjectType.CERTIFICATE: {
enums.Operation.LOCATE: enums.Policy.ALLOW_ALL,
enums.Operation.CHECK: enums.Policy.ALLOW_ALL,
@@ -279,7 +279,7 @@ policies = {
}
},
'public': {
'default': {
'preset': {
enums.ObjectType.TEMPLATE: {
enums.Operation.LOCATE: enums.Policy.ALLOW_ALL,
enums.Operation.GET: enums.Policy.ALLOW_ALL,