Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
9f964612
Commit
9f964612
authored
12 years ago
by
Peter Sankauskas
Browse files
Options
Downloads
Patches
Plain Diff
SPARK-626: Remove rules before removing security groups, with a pause in
between so wait for AWS eventual consistency to catch up.
parent
beb44008
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ec2/spark_ec2.py
+15
-11
15 additions, 11 deletions
ec2/spark_ec2.py
with
15 additions
and
11 deletions
ec2/spark_ec2.py
+
15
−
11
View file @
9f964612
...
...
@@ -557,18 +557,22 @@ def main():
inst
.
terminate
()
# Delete security groups as well
group_names
=
[
cluster_name
+
"
-master
"
,
cluster_name
+
"
-slaves
"
,
cluster_name
+
"
-zoo
"
]
groups
=
conn
.
get_all_security_groups
()
groups
=
[
g
for
g
in
conn
.
get_all_security_groups
()
if
g
.
name
in
group_names
]
# Delete individual rules in all groups before deleting groups to remove
# dependencies between them
for
group
in
groups
:
if
group
.
name
in
group_names
:
print
"
Deleting security group
"
+
group
.
name
# Delete individual rules before deleting group to remove dependencies
for
rule
in
group
.
rules
:
for
grant
in
rule
.
grants
:
group
.
revoke
(
ip_protocol
=
rule
.
ip_protocol
,
from_port
=
rule
.
from_port
,
to_port
=
rule
.
to_port
,
src_group
=
grant
)
conn
.
delete_security_group
(
group
.
name
)
print
"
Deleting rules in security group
"
+
group
.
name
for
rule
in
group
.
rules
:
for
grant
in
rule
.
grants
:
group
.
revoke
(
ip_protocol
=
rule
.
ip_protocol
,
from_port
=
rule
.
from_port
,
to_port
=
rule
.
to_port
,
src_group
=
grant
)
# Sleep for AWS eventual-consistency to catch up
time
.
sleep
(
30
)
# Yes, it does have to be this long :-(
for
group
in
groups
:
print
"
Deleting security group
"
+
group
.
name
conn
.
delete_security_group
(
group
.
name
)
elif
action
==
"
login
"
:
(
master_nodes
,
slave_nodes
,
zoo_nodes
)
=
get_existing_cluster
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment