@@ -19,20 +19,13 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
19
19
from cosalib .builds import Builds
20
20
from cosalib .cmdlib import write_json
21
21
22
- # default region list
23
- default_all_regions = [
24
- "us-east-1" , "us-east-2" , "us-west-1" , "us-west-2" , "eu-west-1" ,
25
- "eu-west-2" , "eu-west-3" , "eu-central-1" , "eu-north-1" ,
26
- "ap-south-1" , "ap-southeast-1" , "ap-southeast-2" , "ap-northeast-1" ,
27
- "ap-northeast-2" , "sa-east-1" , "ca-central-1" ]
28
-
29
22
# Parse args and dispatch
30
23
parser = argparse .ArgumentParser ()
31
24
parser .add_argument ("--build" , help = "Build ID" ,
32
25
required = True )
33
26
parser .add_argument ("--name-suffix" , help = "Suffix for name" )
34
- parser .add_argument ("--regions" , help = "EC2 regions" ,
35
- default = default_all_regions , nargs = '+' )
27
+ parser .add_argument ("--regions" , help = "EC2 regions, default: all regions " ,
28
+ default = [] , nargs = '+' )
36
29
parser .add_argument ("--log-level" , help = "ore log level" )
37
30
args = parser .parse_args ()
38
31
52
45
def run_ore ():
53
46
if len (buildmeta ['amis' ]) < 1 :
54
47
raise SystemExit ("buildmeta doesn't contain source AMIs. Run buildextend-aws first" )
48
+ if not args .regions :
49
+ args .regions = subprocess .check_output (['ore' , 'aws' , 'list-regions' ]).decode ().strip ().split ()
55
50
# only replicate to regions that don't already exist
56
51
existing_regions = [item ['name' ] for item in buildmeta ['amis' ]]
57
52
duplicates = list (set (args .regions ).intersection (existing_regions ))
0 commit comments