Add minor fixes to code

Minor check to context
Add TODO about dublicate run_command method
Remove commas in scenario json
This commit is contained in:
vrovachev
2015-03-25 14:02:24 +04:00
parent 693012c371
commit da10885773
3 changed files with 9 additions and 8 deletions

View File

@@ -33,15 +33,15 @@ class CloudNodesContext(base.Context):
active_nodes = []
output = self.run_command(controller["shaker_agent_id"], command)
rabbit_nodes = lambda str: [node for node in str.split("'")
if "rabbit" in node]
for line in output.splitlines():
if "nodes" in line and "running_nodes" not in line:
nodes = [node for node in line.split("'")
if "rabbit" in node]
if "running_nodes" in line:
active_nodes = [node for node in line.split("'")
if "rabbit" in node]
active_nodes = rabbit_nodes(line)
elif "nodes" in line:
nodes = rabbit_nodes(line)
if len(nodes) == 0 or len(active_nodes) < len(nodes):
if not nodes or len(active_nodes) < len(nodes):
return False
for node in nodes:

View File

@@ -16,6 +16,7 @@ class BaseDisasterScenario(base.Scenario):
**kwargs)
return vm
# TODO(vrovachev): delete duplicate method on this or on context
def run_command(self, node, command, recover_command=None,
recover_timeout=0):
if recover_command is not None:

View File

@@ -3,11 +3,11 @@
{
"runner": {
"type": "serial",
"times": 1,
"times": 1
},
"context": {
"recover_cloud": {
"checks": ["rabbitmq_cluster_status", ]
"checks": ["rabbitmq_cluster_status" ]
},
"cloud_nodes": {
"controllers": [