Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(852)

Unified Diff: environs/ec2/ec2.go

Issue 6589073: ec2: integrated firewall mode configuration (Closed)
Patch Set: ec2: integrated firewall mode configuration Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: environs/ec2/ec2.go
=== modified file 'environs/ec2/ec2.go'
--- environs/ec2/ec2.go 2012-10-02 13:42:18 +0000
+++ environs/ec2/ec2.go 2012-10-04 14:23:00 +0000
@@ -554,7 +554,10 @@
}
func (e *environ) machineGroupName(machineId int) string {
- return fmt.Sprintf("%s-%d", e.groupName(), machineId)
+ if e.Config().FirewallMode() == config.FwDefault {
+ return fmt.Sprintf("%s-%d", e.groupName(), machineId)
+ }
+ return fmt.Sprintf("%s-global", e.groupName())
}
func (e *environ) groupName() string {
@@ -566,7 +569,6 @@
return nil
}
// Give permissions for anyone to access the given ports.
- // TODO(mue) Choose group depending on inst.e.Config().FirewallMode().
ipPerms := portsToIPPerms(ports)
g := ec2.SecurityGroup{Name: inst.e.machineGroupName(machineId)}
_, err := inst.e.ec2().AuthorizeSecurityGroup(g, ipPerms)
@@ -600,7 +602,6 @@
// Revoke permissions for anyone to access the given ports.
// Note that ec2 allows the revocation of permissions that aren't
// granted, so this is naturally idempotent.
- // TODO(mue) Choose group depending on inst.e.Config().FirewallMode().
g := ec2.SecurityGroup{Name: inst.e.machineGroupName(machineId)}
_, err := inst.e.ec2().RevokeSecurityGroup(g, portsToIPPerms(ports))
if err != nil {
@@ -624,7 +625,6 @@
}
func (inst *instance) Ports(machineId int) (ports []state.Port, err error) {
- // TODO(mue) Choose group depending on inst.e.Config().FirewallMode().
g := ec2.SecurityGroup{Name: inst.e.machineGroupName(machineId)}
resp, err := inst.e.ec2().SecurityGroups([]ec2.SecurityGroup{g}, nil)
if err != nil {
@@ -688,8 +688,6 @@
if err != nil {
return nil, err
}
- // TODO(mue) Ensure machine group only if e.Config().FirewallMode()
- // is config.FwDefault.
jujuMachineGroup, err := e.ensureGroup(e.machineGroupName(machineId), nil)
if err != nil {
return nil, err

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 204d58d