···9393 current_app.logger.error(f"/hosts/operation returned 400: id is required for get")
9494 return abort(400, f"bad request; id is required for get")
95959696- vm = current_app.config['SPOKE_MODEL'].get(request_body['id'], request_body['get_ssh_host_keys'], request_body['get_agent_details'])
9696+ vm = current_app.config['SPOKE_MODEL'].get(request_body['id'], request_body['get_ssh_host_keys'], request_body['get_agent_details'], request_body['vm_os_id'])
9797 if vm is None:
9898 return jsonify(dict(assignment_status="assigned"))
9999 return jsonify(dict(assignment_status="assigned", id=vm.id, host=vm.host, state=vm.state, ipv4=vm.ipv4, ipv6=vm.ipv6, ssh_host_keys=vm.ssh_host_keys, agent_socket=vm.agent_socket, guest_agent=vm.guest_agent, acpid=vm.acpid))
+7-4
capsulflask/spoke_model.py
···2828 def capacity_avaliable(self, additional_ram_bytes):
2929 return True
30303131- def get(self, id, get_ssh_host_keys: bool, get_agent_details: bool):
3131+ def get(self, id, get_ssh_host_keys: bool, get_agent_details: bool, vm_os_id: str):
3232 validate_capsul_id(id)
33333434 ipv4 = "1.1.1.1"
···118118119119 return True
120120121121- def get(self, id, get_ssh_host_keys: bool, get_agent_details: bool):
121121+ def get(self, id, get_ssh_host_keys: bool, get_agent_details: bool, os_image_id: str):
122122 validate_capsul_id(id)
123123 completed_process = run([join(current_app.root_path, 'shell_scripts/get.sh'), id], capture_output=True)
124124 self.validate_completed_process(completed_process)
···147147 if not re.match(r"^([0-9]{1,3}\.){3}[0-9]{1,3}$", ipaddr):
148148 return VirtualMachine(id, current_app.config["SPOKE_HOST_ID"], state=state)
149149150150+ if not re.match(r"^[a-z0-9]+$", os_image_id):
151151+ raise ValueError(f"os_image_id '{os_image_id}' is not a valid value")
152152+150153 guest_agent=False
151154 agent_socket=False
152155 acpid=False
···164167165168 if get_agent_details:
166169 try:
167167- completed_process3 = run([join(current_app.root_path, 'shell_scripts/get-guest-agent.sh'), id], capture_output=True)
170170+ completed_process3 = run([join(current_app.root_path, 'shell_scripts/get-guest-agent.sh'), id, os_image_id], capture_output=True)
168171 self.validate_completed_process(completed_process3)
169172 result = completed_process3.stdout.decode("utf-8").strip(" \t\n\r")
170170- current_app.logger.info(f"get_agent_details result: {result}")
173173+ #current_app.logger.info(f"get_agent_details result: {result}")
171174 if result != 'no-guest-agent-socket':
172175 agent_socket = True
173176 if result == "ok" or result == 'no-acpid':