def workflow_approve_callback(self, flow_instance): from cloud.tasks import allocate_floating_task try: allocate_floating_task.delay(self) self.status = FLOATING_ALLOCATE self.save() content = title = _('Your application for %(bandwidth)d Mbps floating IP is approved! ') \ % {'bandwidth': self.bandwidth} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = FLOATING_ERROR self.save() title = _('Error happened to your application for floating IP') content = _( 'Your application for %(bandwidth)d Mbps floating ip is approved, ' 'but an error happened when creating it.') % { 'bandwidth': self.bandwidth } Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_approve_callback(self, flow_instance): from cloud.instance_task import instance_create_task try: instance_create_task.delay(self, password=flow_instance.extra_data) self.status = INSTANCE_STATE_WAITING self.save() content = title = _('Your application for instance "%(instance_name)s" is approved! ') \ % {'instance_name': self.name} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = INSTANCE_STATE_ERROR self.save() title = _('Error happened to your application for %(instance_name)s') \ % {'instance_name': self.name} content = _( 'Your application for instance "%(instance_name)s" is approved, ' 'but an error happened when creating instance.') % { 'instance_name': self.name } Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_approve_callback(self, flow_instance): from cloud.volume_task import volume_create_task try: self.status = VOLUME_STATE_CREATING self.save() volume_create_task.delay(self) content = title = _('Your application for %(size)d GB volume named %(name)s is approved! ') \ % {'size': self.size, 'name': self.name} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = VOLUME_STATE_ERROR self.save() title = _('Error happened to your application for volume') content = _( 'Your application for %(size)d GB volume named %(name)s is approved, ' 'but an error happened when creating it.') % { 'size': self.size, 'name': self.name } Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_reject_callback(self, flow_instance): self.status = INSTANCE_STATE_REJECTED self.save() content = title = _('Your application for instance "%(instance_name)s" is rejected! ') \ % {'instance_name': self.name} Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_reject_callback(self, flow_instance): self.status = FLOATING_REJECTED self.save() content = title = _('Your application for %(bandwidth)d floating IP is rejected! ') \ % {'bandwidth': self.bandwidth} Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_reject_callback(self, flow_instance): self.status = VOLUME_STATE_REJECTED self.save() content = title = _('Your application for %(disk_size)d GB volume named %(name)s is rejected! ') \ % {'disk_size': self.size, 'name': self.name} Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_approve_callback(self, flow_instance): from cloud.volume_task import volume_create_task try: self.status = VOLUME_STATE_CREATING self.save() volume_create_task.delay(self) content = title = _('Your application for %(size)d GB volume named %(name)s is approved! ') \ % {'size': self.size, 'name': self.name} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = VOLUME_STATE_ERROR self.save() title = _('Error happened to your application for volume') content = _('Your application for %(size)d GB volume named %(name)s is approved, ' 'but an error happened when creating it.') % {'size': self.size, 'name': self.name} Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_approve_callback(self, flow_instance): from cloud.tasks import allocate_floating_task try: allocate_floating_task.delay(self) self.status = FLOATING_ALLOCATE self.save() content = title = _('Your application for %(bandwidth)d Mbps floating IP is approved! ') \ % {'bandwidth': self.bandwidth} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = FLOATING_ERROR self.save() title = _('Error happened to your application for floating IP') content = _('Your application for %(bandwidth)d Mbps floating ip is approved, ' 'but an error happened when creating it.') % {'bandwidth': self.bandwidth} Notification.error(flow_instance.owner, title, content, is_auto=True)
def workflow_approve_callback(self, flow_instance): from cloud.instance_task import instance_create_task try: instance_create_task.delay(self, password=flow_instance.extra_data) self.status = INSTANCE_STATE_WAITING self.save() content = title = _('Your application for instance "%(instance_name)s" is approved! ') \ % {'instance_name': self.name} Notification.info(flow_instance.owner, title, content, is_auto=True) except: self.status = INSTANCE_STATE_ERROR self.save() title = _('Error happened to your application for %(instance_name)s') \ % {'instance_name': self.name} content = _('Your application for instance "%(instance_name)s" is approved, ' 'but an error happened when creating instance.') % {'instance_name': self.name} Notification.error(flow_instance.owner, title, content, is_auto=True)