@cryptotaxi247 / infra-1 / commits / 26549c2b

packet importer: load by mandatory tags, not based on being a spot instant

Graham Christensen committed Sep 29, 2019 at 23:50 UTC 26549c2b8e3cf2a745c1c62bf71903d6b2118718
2 files changed +3 -3
hydra-packet-importer/config-example.json
+1
@@ -1,6 +1,7 @@
1 {
2 "token": "You read only API token",
3 "project_id": "Your project's unique ID",
4 + "mandatory_tags": [ "tags which each", "server", "must have" ],
5 "skip_tags": [ "tags which will", "exclude a server from", "being imported" ],
6 "plans": {
7 "c2.large.arm": {
hydra-packet-importer/import.py
+2 -3
@@ -26,9 +26,8 @@ def get_devices(manager):
26 for device in data['devices']:
27 if device['state'] != 'active':
28 continue
29 - if 'spot_instance' not in device:
30 - continue
31 - if device['spot_instance'] != True:
29 +
30 + if not set(config['mandatory_tags']).issubset(device['tags']):
31 continue
32
33 if not set(device['tags']).isdisjoint(config['skip_tags']):