Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
22de696a
Commit
22de696a
authored
Jan 29, 2014
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Figure out the security group for the play by tag instead of getting it passed in.
parent
2ab4a2d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
util/vpc-tools/abbey.py
+11
-18
No files found.
util/vpc-tools/abbey.py
View file @
22de696a
...
...
@@ -172,8 +172,6 @@ def parse_args():
parser
.
add_argument
(
'-t'
,
'--instance-type'
,
required
=
False
,
default
=
"m1.large"
,
help
=
"instance type to launch"
)
parser
.
add_argument
(
"--security-group"
,
required
=
False
,
default
=
"abbey"
,
help
=
"Security group to use"
)
parser
.
add_argument
(
"--role-name"
,
required
=
False
,
default
=
"abbey"
,
help
=
"IAM role name to use (must exist)"
)
...
...
@@ -198,27 +196,22 @@ def parse_args():
return
parser
.
parse_args
()
def
get_instance_sec_group
(
vpc_id
,
security_group
):
def
get_instance_sec_group
(
vpc_id
):
security_group_id
=
None
grp_details
=
ec2
.
get_all_security_groups
(
filters
=
{
'vpc_id'
:
vpc_id
'vpc_id'
:
vpc_id
,
'tag:play'
:
args
.
play
}
)
for
grp
in
grp_details
:
if
grp
.
name
==
security_group
:
security_group_id
=
grp
.
id
break
if
not
security_group_id
:
print
"Unable to lookup id for security group {}"
.
format
(
security_group
)
sys
.
exit
(
1
)
if
len
(
grp_details
)
<
1
:
sys
.
stderr
.
write
(
"ERROR: Expected atleast one security group, got {}
\n
"
.
format
(
len
(
gry_details
)))
return
security_group_
id
return
grp_details
[
0
]
.
id
def
create_instance_args
():
...
...
@@ -233,16 +226,16 @@ def create_instance_args():
subnet
=
vpc
.
get_all_subnets
(
filters
=
{
'tag:aws:cloudformation:stack-name'
:
stack_name
,
'tag:
Application'
:
args
.
application
}
'tag:
play'
:
args
.
play
}
)
if
len
(
subnet
)
!=
1
:
sys
.
stderr
.
write
(
"ERROR: Expected
1 admin
subnet, got {}
\n
"
.
format
(
if
len
(
subnet
)
<
1
:
sys
.
stderr
.
write
(
"ERROR: Expected
at least one
subnet, got {}
\n
"
.
format
(
len
(
subnet
)))
sys
.
exit
(
1
)
subnet_id
=
subnet
[
0
]
.
id
vpc_id
=
subnet
[
0
]
.
vpc_id
security_group_id
=
get_instance_sec_group
(
vpc_id
,
args
.
security_group
)
security_group_id
=
get_instance_sec_group
(
vpc_id
)
if
args
.
identity
:
config_secure
=
'true'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment