Yedidyah Bar David has posted comments on this change. Change subject: core: Add executePipe ......................................................................
Patch Set 3: (4 comments) http://gerrit.ovirt.org/#/c/26213/3/src/otopi/plugin.py File src/otopi/plugin.py: Line 410: popenKwargsList, Line 411: exc_info=True Line 412: ) Line 413: raise Line 414: > please print execution result for each command Please explain exactly what you want here. Note that normally we do not enter this "except:" on external process failure, but on python (e.g. Popen) failure. At this point we do not even know if all processes were created. Also, not sure it's a good idea to log stderr (and stdout) - caller might have not wanted that. I basically followed the structure of executeRaw/execute - in the former you also do not log anything about the process. Line 415: return { Line 416: 'stdout': popens[-1].stdout, Line 417: 'result': [ Line 418: { Line 468: temp_stdin, temp_name = tempfile.mkstemp() Line 469: atexit.register(os.unlink, temp_name) Line 470: with os.fdopen(temp_stdin, 'w') as f: Line 471: f.write('\n'.join(stdin).encode('utf-8')) Line 472: temp_stdin = open(temp_name, 'r') > can't we reopen the fd? Not sure how. Line 473: Line 474: res_dict = self.executePipeRaw( Line 475: popenKwargsList=popenKwargsList, Line 476: stdin=temp_stdin if stdin is not None else None, Line 496: } Line 497: if logStreams: Line 498: self.logger.debug( Line 499: 'executePipe-output: %s stdout:\n%s\n', Line 500: ' | '.join([str(kw['args']) for kw in popenKwargsList]), > not sure we need all commands but the first, we do get all commands at the Changed to print the last (as it's its stdout). I personally think it does make sense to log all of the commands in one line at least once, to ease log parsing/searching, but won't argue. Line 501: '\n'.join(res['stdout']) Line 502: ) Line 503: for i, r, kw in [ Line 504: (i, r, popenKwargsList[i]) Line 518: if len(RCs) > 0 and raiseOnError: Line 519: # Log the last one, somewhat similarly to pipefail in bash Line 520: raise RuntimeError( Line 521: _("Command '{command}' failed to execute").format( Line 522: command=popenKwargsList[RCs[-1][0]]['args'][0] > I think that it is better to show the entire command and not the rc? shell Again - followed 'execute' - you print there only args[0]. I guess your point was to not output a too-long message, which here makes even more sense - users that care will check the log file. I agree I actually do not need the rc itself. Line 523: ) Line 524: ) Line 525: return res Line 526: -- To view, visit http://gerrit.ovirt.org/26213 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I4a434fbe1308ac2f603b8ae09756354c11138912 Gerrit-PatchSet: 3 Gerrit-Project: otopi Gerrit-Branch: master Gerrit-Owner: Yedidyah Bar David <d...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com> Gerrit-Reviewer: Simone Tiraboschi <stira...@redhat.com> Gerrit-Reviewer: Yedidyah Bar David <d...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches