|
|
@ -88,7 +88,6 @@ def mattermost_incident_command( command, args, channel_id, raw_incident_number,
|
|
|
|
'message': "#### Written `%s`:\n\n```\n%s```" % ( ev.path_short(), written ),
|
|
|
|
'message': "#### Written `%s`:\n\n```\n%s```" % ( ev.path_short(), written ),
|
|
|
|
} )
|
|
|
|
} )
|
|
|
|
|
|
|
|
|
|
|
|
if new:
|
|
|
|
|
|
|
|
cmdline = app.config[ "MERCURIAL_BIN" ] + " add " + ev.path_short()
|
|
|
|
cmdline = app.config[ "MERCURIAL_BIN" ] + " add " + ev.path_short()
|
|
|
|
message = exec_to_message( cmdline )
|
|
|
|
message = exec_to_message( cmdline )
|
|
|
|
if message:
|
|
|
|
if message:
|
|
|
@ -96,14 +95,7 @@ def mattermost_incident_command( command, args, channel_id, raw_incident_number,
|
|
|
|
'message': message,
|
|
|
|
'message': message,
|
|
|
|
} )
|
|
|
|
} )
|
|
|
|
|
|
|
|
|
|
|
|
cmdline = app.config[ "MERCURIAL_BIN" ] + " commit -m 'add event for incident " + raw_incident_number + " via FIH' " + ev.path_short()
|
|
|
|
cmdline = app.config[ "MERCURIAL_BIN" ] + " commit -m 'event for incident " + raw_incident_number + " via FIH' " + ev.path_short()
|
|
|
|
message = exec_to_message( cmdline )
|
|
|
|
|
|
|
|
if message:
|
|
|
|
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
|
|
|
|
|
'message': message,
|
|
|
|
|
|
|
|
} )
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
cmdline = app.config[ "MERCURIAL_BIN" ] + " commit -m 'update event for incident " + raw_incident_number + " via FIH' " + ev.path_short()
|
|
|
|
|
|
|
|
message = exec_to_message( cmdline )
|
|
|
|
message = exec_to_message( cmdline )
|
|
|
|
if message:
|
|
|
|
if message:
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
@ -365,10 +357,10 @@ def exec_to_message( cmdline ):
|
|
|
|
|
|
|
|
|
|
|
|
stdout = strip_progress( strip_ansi( process.stdout.read().decode( 'ascii', 'ignore' ) ) )
|
|
|
|
stdout = strip_progress( strip_ansi( process.stdout.read().decode( 'ascii', 'ignore' ) ) )
|
|
|
|
if stdout:
|
|
|
|
if stdout:
|
|
|
|
results += "\n\n```\n" + stdout.replace( "```", "` ` `" ) + "```\n"
|
|
|
|
results += "\n\n`````````\n" + stdout + "`````````\n"
|
|
|
|
stderr = strip_progress( strip_ansi( process.stderr.read().decode( 'ascii', 'ignore' ) ) )
|
|
|
|
stderr = strip_progress( strip_ansi( process.stderr.read().decode( 'ascii', 'ignore' ) ) )
|
|
|
|
if stderr:
|
|
|
|
if stderr:
|
|
|
|
results += "\n\n```\n" + stderr.replace( "```", "` ` `" ) + "```\n"
|
|
|
|
results += "\n\n`````````\n" + stderr + "`````````\n"
|
|
|
|
if not stdout and not stderr:
|
|
|
|
if not stdout and not stderr:
|
|
|
|
results += '_no output_\n'
|
|
|
|
results += '_no output_\n'
|
|
|
|
return results
|
|
|
|
return results
|
|
|
|