def check(self): if not self.vm_id: return state = self._get_vm_state() self.log("VM state is ‘{0}’".format(state)) if state == "poweroff" or state == "aborted": self.state = self.STOPPED elif state == "running": self._update_ip() MachineState.check(self) else: self.state = self.UNKNOWN
def check(self): if not self.vm_id: return self.connect() instance = self._get_instance_by_id(self.vm_id, allow_missing=True) old_state = self.state self.log("instance state is ‘{0}’".format(instance.state if instance else "gone")) if instance is None or instance.state in {"shutting-down", "terminated"}: self.state = self.MISSING elif instance.state == "pending": self.state = self.STARTING elif instance.state == "running": if self.private_ipv4 != instance.private_ip_address or self.public_ipv4 != instance.ip_address: self.warn("IP address has changed, you may need to run ‘charon deploy’") self.private_ipv4 = instance.private_ip_address self.public_ipv4 = instance.ip_address MachineState.check(self) elif instance.state == "stopping": self.state = self.STOPPING elif instance.state == "stopped": self.state = self.STOPPED
def __init__(self, depl, name, id): MachineState.__init__(self, depl, name, id) self._conn = None self._conn_route53 = None
def address_to(self, m): if isinstance(m, EC2State): return m.private_ipv4 return MachineState.address_to(self, m)
def show_type(self): s = MachineState.show_type(self) if self.zone or self.region: s = "{0} [{1}; {2}]".format(s, self.zone or self.region, self.instance_type) return s
def __init__(self, depl, name, id): MachineState.__init__(self, depl, name, id)
def __init__(self, depl, name, id): MachineState.__init__(self, depl, name, id) self._disk_attached = False