diff contrib/automation/hgautomation/cli.py @ 42277:dd6a9723ae2b

automation: don't create resources when deleting things Otherwise running these commands can result in resources being created. In the case of `purge-ec2-resources`, we will create resources only to delete them immediately afterwards! With this change, `purge-ec2-resources` now no-ops if no resources exist. # no-check-commit because foo_bar function name Differential Revision: https://phab.mercurial-scm.org/D6285
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 19 Apr 2019 05:20:33 -0700
parents b05a3e28cf24
children d137a3d5ad41
line wrap: on
line diff
--- a/contrib/automation/hgautomation/cli.py	Fri Apr 19 05:15:43 2019 -0700
+++ b/contrib/automation/hgautomation/cli.py	Fri Apr 19 05:20:33 2019 -0700
@@ -95,12 +95,12 @@
 
 
 def terminate_ec2_instances(hga: HGAutomation, aws_region):
-    c = hga.aws_connection(aws_region)
+    c = hga.aws_connection(aws_region, ensure_ec2_state=False)
     aws.terminate_ec2_instances(c.ec2resource)
 
 
 def purge_ec2_resources(hga: HGAutomation, aws_region):
-    c = hga.aws_connection(aws_region)
+    c = hga.aws_connection(aws_region, ensure_ec2_state=False)
     aws.remove_resources(c)