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