#NEWLINE# def _push_assemble_error_status( status , ret , logs ) : #NEWLINE# #INDENT# '\n    Given input in this form::\n\n        u\'{"status":"Pulling repository foo/ubuntubox"}:\n        "image (latest) from foo/  ...\n         rogress":"complete","id":"2c80228370c9"}\'\n\n    construct something like that (load json data is possible)::\n\n        [u\'{"status":"Pulling repository foo/ubuntubox"\',\n         {"status":"Download","progress":"complete","id":"2c80228370c9"}]\n    ' #NEWLINE# comment = 'An error occurred pushing your image' #NEWLINE# status [ 'out' ] = '' #NEWLINE# try : #NEWLINE# #INDENT# status [ 'out' ] += ( '\n' + ret ) #NEWLINE# for err_log in logs : #NEWLINE# #INDENT# if isinstance ( err_log , dict ) : #NEWLINE# #INDENT# if ( 'errorDetail' in err_log ) : #NEWLINE# #INDENT# if ( 'code' in err_log [ 'errorDetail' ] ) : #NEWLINE# #INDENT# msg = '\n{0}\n{1}: {2}' . format ( err_log [ 'error' ] , err_log [ 'errorDetail' ] [ 'code' ] , err_log [ 'errorDetail' ] [ 'message' ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# msg = '\n{0}\n{1}' . format ( err_log [ 'error' ] , comment [ 'errorDetail' ] [ 'message' ] ) #NEWLINE# #UNINDENT# comment += msg #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# trace = traceback . format_exc ( ) #NEWLINE# status [ 'out' ] = 'An error occurred while parsing error output:\n{0}' . format ( trace ) #NEWLINE# #UNINDENT# _invalid ( status , comment = comment ) #NEWLINE# return status