-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathlocations.py
More file actions
38 lines (31 loc) · 1.13 KB
/
locations.py
File metadata and controls
38 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python
import logging
import os
_log = logging.getLogger("end2end configuration")
def create_location(client, uuid, location):
"""
Creates a location
:param client: swagger client
:param uuid: zenko instance uuid
:param location: location details
"""
ENABLE_RING_TESTS = os.environ['ENABLE_RING_TESTS']
if ENABLE_RING_TESTS == "false" and location["locationType"] == "location-scality-ring-s3-v1":
return
try:
Location_V1 = client.get_model('location-v1')
if "bootstrapList" not in location["details"]:
location["details"]["bootstrapList"] = []
loc = Location_V1(name=location["name"],
locationType=location["locationType"],
details=location["details"])
res = (
client.ui_facing
.createConfigurationOverlayLocation(location=loc, uuid=uuid)
.response()
.result
)
_log.info("location created")
except Exception as e:
raise Exception(
"Failed to create location '%s': %s" % (location["name"], e))