File tree Expand file tree Collapse file tree 4 files changed +20
-24
lines changed Expand file tree Collapse file tree 4 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -135,10 +135,10 @@ def create_role(self,
135
135
return self ._put_response_body (
136
136
["role" ], {},
137
137
dict (
138
- model .ACLPolicy (name = name ,
139
- description = description ,
140
- policies = policies ,
141
- service_identities = service_identities )))
138
+ model .ACLRole (name = name ,
139
+ description = description ,
140
+ policies = policies ,
141
+ service_identities = service_identities )))
142
142
143
143
def update_role (self ,
144
144
id ,
@@ -159,10 +159,10 @@ def update_role(self,
159
159
return self ._put_response_body (
160
160
["role" , id ], {},
161
161
dict (
162
- model .ACLPolicy (name = name ,
163
- description = d
10000
escription ,
164
- policies = policies ,
165
- service_identities = service_identities )))
162
+ model .ACLRole (name = name ,
163
+ description = description ,
164
+ policies = policies ,
165
+ service_identities = service_identities )))
166
166
167
167
def delete_role (self , id ):
168
168
"""Delete an existing role with the given ID.
Original file line number Diff line number Diff line change 8
8
def _validate_link_array (value , model ):
9
9
""" Validate the policies or roles links are formatted correctly.
10
10
11
- :param list(dict()) value: An array of PolicyLink or RoleLink.
12
- :param rtype: bool
13
- :param consulate.models.agent.Check model: The model instance.
11
+ :param list value: An array of PolicyLink or RoleLink.
14
12
:param rtype: bool
15
13
16
14
"""
17
- return all (['ID' in link or 'Name' in link
18
- for link in value ]) and not model .args
15
+ return all (['ID' in link or 'Name' in link for link in value ])
19
16
20
17
21
18
def _validate_service_identities (value , model ):
22
19
""" Validate service_identities is formatted correctly.
23
20
24
- :param list(dict()) value: A ServiceIdentity list
21
+ :param ServiceIdentities value: A ServiceIdentity list
25
22
:param rtype: bool
26
23
27
24
"""
28
25
return all (
29
- ['ServiceName' in service_identity
30
- for service_identity in value ]) and not model .args
26
+ ['ServiceName' in service_identity for service_identity in value ])
31
27
32
28
33
29
class ACLPolicy (base .Model ):
Original file line number Diff line number Diff line change 37
37
"""
38
38
39
39
POLICYLINKS_SAMPLE = [
40
- dict (ID = "783beef3-783f-f41f-7422-7087dc272765 " ),
40
+ dict (Name = "policylink_sample " ),
41
41
]
42
42
43
43
POLICYLINKS_UPDATE_SAMPLE = [
44
- dict (ID = "783beef3-783f-f41f-7422-7087dc272765 " ),
45
- dict (Name = "some_policy_name " )
44
+ dict (Name = "policylink_sample " ),
45
+ dict (Name = "policylink_update_sample " )
46
46
]
47
47
48
48
SERVICE_IDENTITIES_SAMPLE = [dict (ServiceName = "db" , Datacenters = ["dc1" ])]
49
49
50
- ROLELINKS_SAMPLE = [dict (Name = "some_role_name " )]
50
+ ROLELINKS_SAMPLE = [dict (Name = "role_sample " )]
51
51
52
52
53
53
class TestCase (base .TestCase ):
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ def tearDown(self):
52
52
for name in services :
53
53
self .consul .agent .service .deregister (services [name ]['ID' ])
54
54
55
- for acl in self .consul .acl .list ():
56
- if acl ['ID ' ] == CONSUL_CONFIG ['acl' ]['tokens' ]['master' ]:
55
+ for acl in self .consul .acl .list_tokens ():
56
+ if acl ['AccessorID ' ] == CONSUL_CONFIG ['acl' ]['tokens' ]['master' ]:
57
57
continue
58
58
try :
59
- uuid .UUID (acl ['ID ' ])
60
- self .consul .acl .destroy (acl ['ID ' ])
59
+ uuid .UUID (acl ['AccessorID ' ])
60
+ self .consul .acl .delete_token (acl ['AccessorID ' ])
61
61
except (ValueError , exceptions .ConsulateException ):
62
62
pass
You can’t perform that action at this time.
0 commit comments