Commit d17c73c5 authored by Antoine Millet's avatar Antoine Millet
Browse files

Changed report output to handle outputs.

parent bd15eb3f
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -29,15 +29,17 @@ class Reporter(object):
    def get_dict(self):
        return self._reports.copy()

    def success(self, oid, message):
        self._reports[oid] = ('success', message)
    def success(self, oid, message, output=None):
        report = [('id', oid), ('status', 'success'), ('message', message)]
        self._reports[oid] = (output, report)
        
    def warn(self, oid, message):
        self._reports[oid] = ('warn', message)
        
    def error(self, oid, message):
        self._reports[oid] = ('error', message)
    def warn(self, oid, message, output=None):
        report = [('id', oid), ('status', 'warn'), ('message', message)]
        self._reports[oid] = (output, report)

    def error(self, oid, message, output=None):
        report = [('id', oid), ('status', 'error'), ('message', message)]
        self._reports[oid] = (output, report)

class CCHandler(RpcHandler):
    '''
@@ -478,7 +480,7 @@ class CliHandler(OnlineCCHandler):
                errs.error(obj['id'], 'node not connected')
            else:
                returned = objcon.connection.call('execute_command', command)
                errs.success(obj['id'], returned)
                errs.success(obj['id'], 'command executed', output=returned)
                
        return errs.get_dict()