From 9e76187a42b73f29c634746ac2373ccf7bf388ef Mon Sep 17 00:00:00 2001 From: davinerd Date: Thu, 23 Nov 2017 21:39:11 +0100 Subject: [PATCH] added support for tags --- Chaosfile.json | 6 ++++++ lambda/index.js | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 lambda/index.js diff --git a/Chaosfile.json b/Chaosfile.json index 039e7b7..1a886d7 100644 --- a/Chaosfile.json +++ b/Chaosfile.json @@ -4,5 +4,11 @@ "enableForASGs": [ ], "disableForASGs": [ + ], + "enableForTags": [ + { + "key": "chaos_monkey", + "value": "true" + } ] } diff --git a/lambda/index.js b/lambda/index.js old mode 100644 new mode 100755 index 89b299a..dd5023f --- a/lambda/index.js +++ b/lambda/index.js @@ -46,6 +46,14 @@ ec2.describeInstances(function(err, data) { } } } + } else { + if (llamaConfig.enableForTags) { + llamaConfig.enableForTags.forEach(function(asgTags) { + if (asgTags.key == tag.Key && asgTags.value == tag.Value) { + candidates.push(inst); + } + }); + } } }); }); @@ -78,4 +86,4 @@ ec2.describeInstances(function(err, data) { function randomIntFromInterval(min,max) { return Math.floor(Math.random()*(max-min+1)+min); -} \ No newline at end of file +}