Example #1
0
 def __init__(self, code='', args=None):
     if args is None:
         args = {}
     self.code = code
     msg = WokMessage(code, args).get_text()
     cherrypy.log.error_log.error(msg)
     Exception.__init__(self, msg)
Example #2
0
    def lookup(self, _id):
        global notificationsStore
        notification = notificationsStore.get(str(_id))

        # use WokMessage to translate the notification
        if notification:
            timestamp = notification.get('timestamp', None)
            plugin = notification.get('_plugin_name', None)
            message = WokMessage(str(_id), notification, plugin).get_text()
            return {'code': _id, 'message': message, 'timestamp': timestamp}

        raise NotFoundError('WOKNOT0001E', {'id': str(_id)})
Example #3
0
    def _attach_all_devices(self, pci_infos):
        with RollbackContext() as rollback:
            for pci_info in pci_infos:
                try:
                    dev = self.conn.get().nodeDeviceLookupByName(
                        pci_info['name'])
                    dev.dettach()
                except Exception:
                    msg = WokMessage('KCHVMHDEV0005E',
                                     {'name': pci_info['name']})
                    self._cb(msg.get_text(), False)
                    raise OperationFailed('KCHVMHDEV0005E',
                                          {'name': pci_info['name']})
                else:
                    rollback.prependDefer(dev.reAttach)

            rollback.commitAll()