explain error from vms with no ip yet

This commit is contained in:
forest 2021-02-15 21:17:10 -06:00
parent e55798494b
commit 0de5305eac

View File

@ -90,6 +90,11 @@ def handle_get(operation_id, request_body):
return abort(400, f"bad request; id is required for get") return abort(400, f"bad request; id is required for get")
vm = current_app.config['SPOKE_MODEL'].get(request_body['id'], request_body['get_ssh_host_keys']) vm = current_app.config['SPOKE_MODEL'].get(request_body['id'], request_body['get_ssh_host_keys'])
# TODO vm can be None when the capsul exists on this host but has no IP address yet
# when this happens it logs an "error reading assignment_status"
# To fix this we need to
# 1. modify shell script to return does it exist on this host + if it does whats its ip
# 2. if exists but no ip, return assigned with no ip
return jsonify(dict(assignment_status="assigned", id=vm.id, host=vm.host, ipv4=vm.ipv4, ipv6=vm.ipv6, ssh_host_keys=vm.ssh_host_keys)) return jsonify(dict(assignment_status="assigned", id=vm.id, host=vm.host, ipv4=vm.ipv4, ipv6=vm.ipv6, ssh_host_keys=vm.ssh_host_keys))