create capsul and capsuls list page working

This commit is contained in:
2020-05-11 15:13:20 -05:00
parent 452f236c6b
commit 231d1ed7c0
11 changed files with 210 additions and 124 deletions

View File

@ -25,7 +25,7 @@ class VirtualizationInterface:
def list_ids(self) -> list:
pass
def create(self, email: str, id: str, template_image_file_name: str, vcpus: int, memory: int, ssh_public_keys: list) -> VirtualMachine:
def create(self, email: str, id: str, template_image_file_name: str, vcpus: int, memory: int, ssh_public_keys: list):
pass
def destroy(self, email: str, id: str):
@ -42,8 +42,7 @@ class MockVirtualization(VirtualizationInterface):
def create(self, email: str, id: str, template_image_file_name: str, vcpus: int, memory_mb: int, ssh_public_keys: list):
validate_capsul_id(id)
print(f"mock create: {id} for {email}")
sleep(5)
return VirtualMachine(id, ipv4="1.1.1.1")
sleep(1)
def destroy(self, email: str, id: str):
print(f"mock destroy: {id} for {email}")
@ -126,22 +125,6 @@ class ShellScriptVirtualization(VirtualizationInterface):
stderr:
{completedProcess.stderr}
""")
for _ in range(0, 10):
sleep(6)
result = self.get(id)
if result != None:
return result
for _ in range(0, 10):
sleep(60)
result = self.get(id)
if result != None:
return result
raise TimeoutError(f"""timed out waiting for vm {id} ({email}) to obtain an IP address:
{vmSettings}
""")
def destroy(self, email: str, id: str):
validate_capsul_id(id)