Skip to content

Commit

Permalink
Merge pull request #59 from diggyk/notifier
Browse files Browse the repository at this point in the history
Notifier
  • Loading branch information
jathanism committed Sep 30, 2015
2 parents 8dc5fd5 + 400fff5 commit 59f96b3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bin/hermes-notify
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ def parse_args():
help="Display version information."
)
parser.add_argument(
"-p", "--port", type=int, default=None, help="Override port in config."
"-s", "--send-to", type=str, default=None, help="Send all reports to this email address"
)
return parser.parse_args()


def find_quest(quests, quest_id):
for quest in quests:
if quest.id == quest_id:
return quest


return None

def main():

args = parse_args()
settings.update_from_config(args.config)

Expand Down Expand Up @@ -99,8 +100,7 @@ def main():
# map the labors and quests to owners
info = {}
for labor in open_labors:
# FIXME we only map "required" labors -- is that the right approach?
if labor.creation_event.event_type.state != "required":
if not labor.for_owner:
continue
if owners[labor.host.hostname] not in info:
info[owners[labor.host.hostname]] = {}
Expand Down Expand Up @@ -148,8 +148,10 @@ def main():
"manually, please visit {}.".format(settings.frontend)
)

recipient = args.send_to if args.send_to else owner

email_message(
"{}@{}".format(owner, settings.domain),
"{}@{}".format(recipient, settings.domain),
"Open Hermes labors need your attention", msg
)

Expand Down

0 comments on commit 59f96b3

Please sign in to comment.