Permalink
Browse files

Merge pull request #8 from pkubat/master

Added support for using ec2  tags as subitutions in tools
  • Loading branch information...
2 parents b096a55 + 7689c0d commit e5c3f1d6c26f5608d736443810da1b6f9f1c9e16 @winebarrel winebarrel committed Mar 23, 2013
Showing with 13 additions and 0 deletions.
  1. +3 −0 ec2ui/content/ec2ui/dialog_manage_tools.xul
  2. +10 −0 ec2ui/content/ec2ui/instancesview.js
View
3 ec2ui/content/ec2ui/dialog_manage_tools.xul
@@ -92,6 +92,9 @@
<hbox>
<description>${pass} - The Administrator password for a Windows instance.</description>
</hbox>
+ <hbox>
+ <description>${&lt;ec2 tag&gt;} - The EC2 tag will be replaced with its value. MyGroup:foobar ${MyGroup} = foobar</description>
+ </hbox>
</vbox>
</dialog>
View
10 ec2ui/content/ec2ui/instancesview.js
@@ -1600,6 +1600,16 @@ outer:
argStr = argStr.replace(/\${privateDnsName}/g, instance.privateDnsName);
argStr = argStr.replace(/\${privateIpAddress}/g, instance.privateIpAddress);
argStr = argStr.replace(/\${name}/g, instance.name);
+
+ //replace with any tag's value
+ var tagValuePairs=instance.tag.split(",");
+ for(i in tagValuePairs) {
+ var tagName = tagValuePairs[i].split(":")[0].trim();
+ var tagValue = tagValuePairs[i].split(":")[1].trim();
+
+ var re = new RegExp("\\${" + tagName + "}","g");
+ argStr = argStr.replace(re, tagValue);
+ }
// Finally, split args into an array
var args = tokenise(argStr);

0 comments on commit e5c3f1d

Please sign in to comment.