コード例 #1
0
 def get_instance_info(self) -> InstanceInfo:
     try:
         instance_info = self._get_instance_info()
         return instance_info
     except errors.ProviderInfoError as instance_error:
         # Until we have proper multipass error codes to know if this
         # was a communication error we should keep this error tracking
         # and generation here.
         raise errors.ProviderInstanceNotFoundError(
             instance_name=self.instance_name) from instance_error
コード例 #2
0
    def _start(self):
        try:
            instance_info = self._get_instance_info()
            if not instance_info.is_running():
                self._multipass_cmd.start(instance_name=self.instance_name)

        except errors.ProviderInfoError as instance_error:
            # Until we have proper multipass error codes to know if this
            # was a communication error we should keep this error tracking
            # and generation here.
            raise errors.ProviderInstanceNotFoundError(
                instance_name=self.instance_name) from instance_error