Skip to content

Commit

Permalink
use standard defaults and output dry run as curl command
Browse files Browse the repository at this point in the history
  • Loading branch information
satterly committed Jun 25, 2013
1 parent 518e577 commit 900b5cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
9 changes: 3 additions & 6 deletions alerta/sender/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ def main(self):
graph_urls=CONF.graph_urls,
)

if CONF.dry_run:
print exceptionAlert
else:
LOG.debug(repr(exceptionAlert))
LOG.debug(repr(exceptionAlert))

api = ApiClient()
api.send(exceptionAlert)
api = ApiClient()
api.send(exceptionAlert, dry_run=CONF.dry_run)

return exceptionAlert.get_id()
19 changes: 1 addition & 18 deletions bin/alert-sender
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def main(argv):
'--dry-run',
action='store_true',
default=False,
help='Do not send alert.'
help='Do not send alert. Output as Curl.'
)

config.parse_args(argv, version=Version, cli_parser=parser, daemon=False)
Expand All @@ -157,12 +157,6 @@ def main(argv):
if not CONF.event:
parser.error("Must supply event name using -e or --event")

if not CONF.group:
parser.error("Must supply group using -g or --group")

if not CONF.value:
parser.error("Must supply event value using -v or --value")

CONF.severity = severity_code.parse_severity(CONF.severity) or severity_code.NORMAL

if not CONF.severity:
Expand All @@ -172,17 +166,6 @@ def main(argv):
if CONF.severity not in severity_code.ALL:
parser.error("Severity must be one of %s" % ','.join(severity_code.ALL))

if not CONF.environment:
parser.error("Must supply one or more environments using -E or --environment")
else:
CONF.environment = [x.upper() for x in CONF.environment]

if not CONF.service:
parser.error("Must supply one or more service using -S or --service")

if not CONF.text:
parser.error("Must supply alert text using -t or --text.")

if CONF.correlate and CONF.event not in CONF.correlate:
CONF.correlate.append(CONF.event)

Expand Down

0 comments on commit 900b5cd

Please sign in to comment.