always try adding the event file

master
Marek Isalski 6 years ago
parent ab93e34a67
commit 561881ff33

@ -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 ),
} )
if new:
cmdline = app.config[ "MERCURIAL_BIN" ] + " add " + ev.path_short()
message = exec_to_message( cmdline )
if message:
app.mm.posts.create_post( options = { 'channel_id': channel_id,
'message': message,
} )
cmdline = app.config[ "MERCURIAL_BIN" ] + " add " + ev.path_short()
message = exec_to_message( cmdline )
if message:
app.mm.posts.create_post( options = { 'channel_id': channel_id,
'message': message,
} )
cmdline = app.config[ "MERCURIAL_BIN" ] + " commit -m 'add 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 )
if message:
app.mm.posts.create_post( options = { 'channel_id': channel_id,
'message': message,
} )
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,
} )
# pull, merge, commit
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' ) ) )
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' ) ) )
if stderr:
results += "\n\n```\n" + stderr.replace( "```", "` ` `" ) + "```\n"
results += "\n\n`````````\n" + stderr + "`````````\n"
if not stdout and not stderr:
results += '_no output_\n'
return results

Loading…
Cancel
Save