Skip to content

Commit

Permalink
Correct test integration ec2 cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
jlaska committed Mar 12, 2014
1 parent e753b39 commit 9cc4be2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test/integration/cleanup_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ def delete_aws_resources(get_func, attr, opts):
for item in get_func():
val = getattr(item, attr)
if re.search(opts.match_re, val):
prompt_and_delete("Delete object with %s=%s? [y/n]: " % (attr, val), opts.assumeyes)
prompt_and_delete(item, "Delete object with %s=%s? [y/n]: " % (attr, val), opts.assumeyes)

def prompt_and_delete(prompt, assumeyes):
while not assumeyes:
assumeyes = raw_input(prompt)
obj.delete()
def prompt_and_delete(item, prompt, assumeyes):
if not assumeyes:
assumeyes = raw_input(prompt).lower() == 'y'
assert hasattr(item, 'delete'), "Class <%s> has no delete attribute" % item.__class__
if assumeyes:
item.delete()

def parse_args():
# Load details from credentials.yml
Expand Down

0 comments on commit 9cc4be2

Please sign in to comment.