aws-sg-container
Advanced tools
Comparing version 0.16.3 to 0.16.4
@@ -18,14 +18,10 @@ /* | ||
var _ = require('lodash'); | ||
var _ec2; | ||
var _config; | ||
var _mode; | ||
var handleGroup = function(system, container, out, cb) { | ||
exports.handleSecurityGroup = function(mode, config, ec2, system, container, out, cb) { | ||
var sg = container.specific; | ||
var match = false; | ||
var sgParams = { GroupIds: [container.nativeId] }; | ||
var filters = []; | ||
filters.push({Name: 'tag:nscale-system', Values: [system.name + '-' + system.topology.name]}); | ||
_ec2.describeSecurityGroups(sgParams, function(err, sgroups) { | ||
ec2.describeSecurityGroups({ Filters: filters }, function(err, sgroups) { | ||
var c = _.find(system.topology.containers, function(cont) { return cont.id === container.id; }); | ||
@@ -38,5 +34,5 @@ | ||
if (!match || (err && err.name && -1 !== err.name.indexOf('NotFound'))) { | ||
_ec2.createSecurityGroup({Description: sg.Description, | ||
ec2.createSecurityGroup({Description: sg.Description, | ||
GroupName: container.id, | ||
VpcId: sg.VpcId || _config.defaultVpcId}, function(err, resp) { | ||
VpcId: sg.VpcId || config.defaultVpcId}, function(err, resp) { | ||
if (err) { | ||
@@ -54,3 +50,3 @@ if (-1 !== err.name.indexOf('InvalidGroup.Duplicate')) { | ||
tagParams.Tags.push({Key: 'Name', Value: container.id}); | ||
_ec2.createTags(tagParams, function() { | ||
ec2.createTags(tagParams, function() { | ||
c.nativeId = resp.GroupId; | ||
@@ -62,3 +58,3 @@ c.groupId = resp.GroupId; | ||
var params = {GroupId : resp.GroupId, IpPermissions : sg.IpPermissions}; | ||
_ec2.authorizeSecurityGroupIngress(params, function(err) { | ||
ec2.authorizeSecurityGroupIngress(params, function(err) { | ||
cb(err, system); | ||
@@ -84,14 +80,1 @@ }); | ||
}; | ||
exports.handleSecurityGroup = function(mode, config, ec2, system, container, out, cb) { | ||
_ec2 = ec2; | ||
_config = config; | ||
_mode = mode; | ||
handleGroup(system, container, out, function(err, newSys) { | ||
cb(err, newSys); | ||
}); | ||
}; | ||
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.16.3", | ||
"version": "0.16.4", | ||
"license": "Artistic License 2.0", | ||
@@ -17,0 +17,0 @@ "author": "Peter Elger (http://nearform.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71652
126