|
|
@ -88,27 +88,19 @@ 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:
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
|
'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 )
|
|
|
|
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,
|
|
|
|
'message': message,
|
|
|
|
'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 )
|
|
|
|
|
|
|
|
if message:
|
|
|
|
|
|
|
|
app.mm.posts.create_post( options = { 'channel_id': channel_id,
|
|
|
|
|
|
|
|
'message': message,
|
|
|
|
|
|
|
|
} )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# pull, merge, commit
|
|
|
|
# pull, merge, commit
|
|
|
|
for pull_from in app.config[ "MERCURIAL_PUSH_TO" ]:
|
|
|
|
for pull_from in app.config[ "MERCURIAL_PUSH_TO" ]:
|
|
|
@ -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
|
|
|
|