copr-builders: ibm-cloud-vm spawner script cleanup

This commit is contained in:
Pavel Raiskup 2022-01-19 09:03:56 +01:00
parent 445a2ff9a5
commit b13f01d350

View file

@ -84,10 +84,9 @@ def bind_floating_ip(service, instance_id, opts):
def allocate_and_assign_ip(service, opts): def allocate_and_assign_ip(service, opts):
""" """
curl -X POST "$vpc_api_endpoint/v1/floating_ips?version=$api_version&generation=2" \ Allocate and assign a Floating IP to an existing machine in one call.
-H "$iam_token" \
'
""" """
url = SERVICE_URL + "/floating_ips" url = SERVICE_URL + "/floating_ips"
headers = { headers = {
"Accept": "application/json", "Accept": "application/json",
@ -97,14 +96,12 @@ def allocate_and_assign_ip(service, opts):
'version': "2022-01-18", 'version': "2022-01-18",
'generation': "2", 'generation': "2",
} }
data = { data = {
"name": opts.instance_name, "name": opts.instance_name,
"target": { "target": {
"id": opts.instance_created["primary_network_interface"]["id"], "id": opts.instance_created["primary_network_interface"]["id"],
}, },
} }
response = requests.post(url, headers=headers, json=data, params=params) response = requests.post(url, headers=headers, json=data, params=params)
assert response.status_code == 201 assert response.status_code == 201
opts.allocated_floating_ip_id = response.json()["id"] opts.allocated_floating_ip_id = response.json()["id"]