Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

Commit cb1037d

Browse files
author
高岩A
committed
fix #18
1 parent 010d3c2 commit cb1037d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

consul/base.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,20 +1067,21 @@ def list(
10671067
self, policy=None, token=None):
10681068
"""
10691069
This endpoint lists all the ACL roles.
1070-
:param *policy*: (string: "") - Filters the
1071-
role list to those roles that are linked with
1072-
the specific policy ID.
1073-
:header X-Consul-Token:
1074-
:return:
1070+
:param *policy*: (string: "") - Filters the
1071+
role list to those roles that are linked with
1072+
the specific policy ID.
1073+
:header X-Consul-Token:
1074+
:return:
10751075
"""
1076-
path = '/v1/acl/roles?policy=%s' % policy
1076+
1077+
if policy:
1078+
path = '/v1/acl/roles?policy=%s' % policy
1079+
else:
1080+
path = '/v1/acl/roles'
10771081
headers = {}
10781082
token = token or self.agent.token
10791083
if token:
10801084
headers['X-Consul-Token'] = token
1081-
1082-
if policy:
1083-
headers['X-Consul-Token'] = policy
10841085

10851086
return self.agent.http.get(CB.json(),
10861087
path=path,

0 commit comments

Comments
 (0)