18
18
]
19
19
20
20
21
- def generate_id (instance , tags_filter ):
21
+ def generate_id (instance , tags_filter , region ):
22
22
id = ''
23
23
24
24
if tags_filter is not None :
@@ -40,12 +40,16 @@ def generate_id(instance, tags_filter):
40
40
if not id :
41
41
id = instance .id
42
42
43
+ if region :
44
+ id += '-' + instance .placement
45
+
43
46
return id
44
47
45
48
46
49
def main ():
47
50
parser = argparse .ArgumentParser ()
48
51
parser .add_argument ('--tags' , help = 'A comma-separated list of tag names to be considered for concatenation. If omitted, all tags will be used' )
52
+ parser .add_argument ('--region' , action = 'store_true' , help = 'Append the region name at the end of the concatenation' )
49
53
parser .add_argument ('--private' , action = 'store_true' , help = 'Use private IP addresses (public are used by default)' )
50
54
args = parser .parse_args ()
51
55
@@ -67,7 +71,7 @@ def main():
67
71
68
72
instances [instance .launch_time ].append (instance )
69
73
70
- id = generate_id (instance , args .tags )
74
+ id = generate_id (instance , args .tags , args . region )
71
75
72
76
if id not in counts_total :
73
77
counts_total [id ] = 0
@@ -98,7 +102,7 @@ def main():
98
102
if instance .ip_address :
99
103
ip = instance .ip_address
100
104
101
- id = generate_id (instance , args .tags )
105
+ id = generate_id (instance , args .tags , args . region )
102
106
103
107
if counts_total [id ] != 1 :
104
108
counts_incremental [id ] += 1
0 commit comments