Skip to content

Commit 2bbf947

Browse files
committed
Align actions to Consul API, add 9 new actions, unmask consul metadata for some actions.
1 parent 94664b9 commit 2bbf947

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+517
-162
lines changed

CHANGES.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Change Log
22

3+
## [0.6.0] 16 Nov 2017
4+
5+
### Added the following API calls. (See https://python-consul.readthedocs.io for documentation)
6+
- AgentChecks
7+
- AgentForce
8+
- AgentJoin
9+
- AgentMaintenance
10+
- AgentMembers
11+
- AgentServices
12+
- EventFire
13+
- EventList
14+
- HealthNode
15+
- HealthState
16+
- ServiceDeregister
17+
- ServiceMaintenance
18+
- ServiceRegister
19+
- SessionCreate
20+
- SessionDestroy
21+
- SessionInfo
22+
- SessionList
23+
- SessionNode
24+
- SessionRenew
25+
### Changed
26+
- Renamed existing action names to be aligned with the consul API. This helps logically group
27+
operations by the subsystem they will apply to.
28+
- Returned unmodified data from Consul API from some existing actions. Some of the existing actions
29+
were masking the metadata returned by the consul API. This metadata is useful in certain cases.
30+
331
## 0.5.0
432

533
- Updated action `runner_type` from `run-python` to `python-script`

actions/acl_create.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ class ConsulAclCreateAction(action.ConsulBaseAction):
55
def run(self, name=None, acl_type='client', rules=None):
66

77
rules = rules.encode('ascii', 'ignore')
8-
acl_id = self.consul.acl.create(name=name, type=acl_type, rules=rules)
9-
return acl_id
8+
return (True, self.consul.acl.create(name=name, type=acl_type, rules=rules))

actions/acl_destroy.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33

44
class ConsulAclDestroyAction(action.ConsulBaseAction):
55
def run(self, acl_id):
6-
7-
resp = self.consul.acl.destroy(acl_id)
8-
return resp
6+
return (True, self.consul.acl.destroy(acl_id))

actions/acl_list.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55

66
class ConsulAclListAction(action.ConsulBaseAction):
77
def run(self):
8-
9-
acl_list = self.consul.acl.list()
10-
print json.dumps(acl_list)
8+
return (True, json.dumps(self.consul.acl.list()))

actions/agent_checks.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from lib import action
2+
3+
4+
class ConsulAgentChecksAction(action.ConsulBaseAction):
5+
def run(self):
6+
return (True, self.consul.agent.checks())

actions/agent_checks.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: agent_checks
2+
runner_type: python-script
3+
description: "Returns all the checks that are registered with the local agent."
4+
enabled: true
5+
entry_point: "agent_checks.py"

actions/agent_force_leave.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from lib import action
2+
3+
4+
class ConsulAgentForceLeaveAction(action.ConsulBaseAction):
5+
def run(self, node):
6+
return (True, self.consul.agent.force_leave(node))

actions/agent_force_leave.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: agent_force_leave
2+
runner_type: python-script
3+
description: "Instructs the agent to force a node into the left state."
4+
enabled: true
5+
entry_point: "agent_force_leave.py"
6+
parameters:
7+
node:
8+
type: string
9+
description: "The node to change state for."
10+
required: true

actions/agent_join.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from lib import action
2+
3+
4+
class ConsulAgentJoinAction(action.ConsulBaseAction):
5+
def run(self, address, wan=False):
6+
return (True, self.consul.agent.join(address, wan))

actions/agent_join.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: agent_join
2+
runner_type: python-script
3+
description: "Instructs the agent to attempt to connect to a given address."
4+
enabled: true
5+
entry_point: "agent_join.py"
6+
parameters:
7+
address:
8+
type: string
9+
description: "The ip to connect to."
10+
required: true
11+
wan:
12+
type: boolean
13+
description: "True: causes the agent to attempt to join using the WAN pool."
14+
required: false
15+

0 commit comments

Comments
 (0)