Index: scripts/univention-management-console-client =================================================================== --- scripts/univention-management-console-client (Revision 30894) +++ scripts/univention-management-console-client (Arbeitskopie) @@ -156,21 +156,27 @@ print ' ARGUMENTS: %s' % pprint.pformat( msg.arguments ) else: print ' ARGUMENTS: %s' % ' '.join( msg.arguments ) - print ' STATUS : %d' % msg.status - if msg.options: + print 'MIMETYPE : %s' % msg.mimetype + if msg.mimetype == umcp.MIMETYPE_JSON: + print ' STATUS : %d' % msg.status + if msg.options: + if self._options.prettyprint: + print ' OPTIONS : %s' % pprint.pformat( msg.options, indent = 2 ) + else: + if isinstance( msg.options, ( list, tuple ) ): + print ' OPTIONS : %s' % ', '.join( map( lambda x: str( x ), msg.options ) ) + else: + print ' OPTIONS : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] ) + print ' MESSAGE : %s' % msg.message if self._options.prettyprint: - print ' OPTIONS : %s' % pprint.pformat( msg.options, indent = 2 ) + print ' RESULT : %s' % pprint.pformat( msg.result, indent = 2 ) else: - if isinstance( msg.options, ( list, tuple ) ): - print ' OPTIONS : %s' % ', '.join( map( lambda x: str( x ), msg.options ) ) - else: - print ' OPTIONS : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] ) - print ' MESSAGE : %s' % msg.message - if self._options.prettyprint: - print ' RESULT : %s' % pprint.pformat( msg.result, indent = 2 ) + print ' RESULT : %s' % msg.result + if msg.status is not None: + raise ClientExit( msg.status - 200 ) else: - print ' RESULT : %s' % msg.result - raise ClientExit( msg.status - 200 ) + print 'BODY : %s' % str( msg.body ) + raise ClientExit() if __name__ == '__main__': notifier.init( notifier.GENERIC ) @@ -255,8 +261,10 @@ try: notifier.loop() except ClientExit, exit: - exitcode = int( exit.args[ 0 ] ) - if exitcode == 200: - exitcode = 0 - sys.exit( exitcode ) + if exit.args: + exitcode = int( exit.args[ 0 ] ) + if exitcode == 200: + exitcode = 0 + sys.exit( exitcode ) + sys.exit( 0 ) Index: src/univention/management/console/protocol/message.py =================================================================== --- src/univention/management/console/protocol/message.py (Revision 30894) +++ src/univention/management/console/protocol/message.py (Arbeitskopie) @@ -82,7 +82,8 @@ self.command = command self.arguments = arguments self.mimetype = mime_type - self.options = options + if mime_type == MIMETYPE_JSON: + self.options = options if data: self.parse( data ) @@ -129,14 +130,13 @@ self.body[ key ] = value else: PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) ) - raise AttributeError( _( 'Attribute %s just available for MIME type %s' ) % ( key, MIMETYPE_JSON ) ) def _get_key( self, key ): if self.mimetype == MIMETYPE_JSON: return self.body.get( key ) else: PARSER.process( 'Attribute %s just available for MIME type %s' % ( key, MIMETYPE_JSON ) ) - raise AttributeError( _( 'Attribute %s just available for MIME type %s' ) % ( key, MIMETYPE_JSON ) ) + return None # property: message message = property( lambda self: self._get_key( 'message' ), lambda self, value: self._set_key( 'message', value ) ) Index: src/univention/management/console/protocol/server.py =================================================================== --- src/univention/management/console/protocol/server.py (Revision 30894) +++ src/univention/management/console/protocol/server.py (Arbeitskopie) @@ -264,7 +264,7 @@ request.''' # FIXME: error handling is missing!! if not msg.id in state.requests and msg.id != -1: - CORE.process( 'The given response is invalid or not known' ) + CORE.info( 'The given response is invalid or not known (%s)' % msg.id ) return try: