def create_host_object(self, provider, payload, env, created_host_metadata, static_ip_id, **kw): nic = created_host_metadata.get("nic", '') vm = created_host_metadata.get("vm", '') configs = [conf for conf in nic["properties"]["ipConfigurations"]] primary_ip_address = [ i["properties"]["privateIPAddress"] for i in configs ][0] identifier = vm["properties"]["vmId"] address = primary_ip_address host = Host(name=payload["name"], group=payload["group"], engine=payload["engine"], environment=env, cpu=payload["cpu"], memory=payload["memory"], provider=provider.credential.provider, identifier=identifier, address=address, zone=provider.credential._zone) host.save() return host
def create_host_object(self, provider, payload, env, created_host_metadata, *args, **kw): host = Host( name=f"{created_host_metadata.metadata.name}-0", group=payload['group'], engine=payload['engine'], environment=env, cpu=payload['cpu'], memory=payload['memory'], provider=provider.credential.provider, identifier=created_host_metadata.metadata.name, address=created_host_metadata.metadata.name, zone='' ) host.save() return host
def create_host_object(self, provider, payload, env, created_host_metadata, *args, **kw): address = created_host_metadata.private_ips[0] host = Host(name=payload['name'], group=payload['group'], engine=payload['engine'], environment=env, cpu=payload['cpu'], memory=payload['memory'], provider=provider.credential.provider, identifier=created_host_metadata.id, address=address, zone=provider.credential._zone) host.save() return host
def create_host_object(self, provider, payload, env, created_host_metadata, static_ip_id, **kw): zone = provider.credential.zone instance_name = payload['name'] instance = self.get_instance(instance_name, zone) address = instance['networkInterfaces'][0]['networkIP'] host = Host(name=payload['name'], group=payload['group'], engine=payload['engine'], environment=env, cpu=payload['cpu'], memory=payload['memory'], provider=provider.credential.provider, identifier=created_host_metadata['id'], address=address, zone=zone) host.save() return host