statuspage icon indicating copy to clipboard operation
statuspage copied to clipboard

Not selecting severity while creating an issue causes exception

Open nangia opened this issue 7 years ago • 1 comments

Thanks a lot for this great utility.

I was just was trying to use statuspage (statuspage==0.8.1). Found that I ran into following exception when trying to run statuspage update.

Generating..
Traceback (most recent call last):
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/bin/statuspage", line 11, in <module>
sys.exit(cli())
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/click/core.py", line 534, in invoke
  return callback(*args, **kwargs)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/statuspage/statuspage.py", line 73, in update
run_update(name=name, token=token, org=org)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/statuspage/statuspage.py", line 200, in run_update
"systems": systems, "incidents": incidents, "panels": panels, "config": config
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
return self.environment.handle_exception(exc_info, True)
  File "/Users/sandeep/bin/virtualenv/hbank12sep2016/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
  File "<template>", line 38, in top-level template code
jinja2.exceptions.UndefinedError: 'None' has no attribute 'capitalize'

I read through the code and figured that this will happen if severity labels are not selected while creating an issue. Thus severity will be None when being evaluated in template.html and causes an exception when trying to evaluate severity.capitalize. It might be a good idea to check this in the code and give a more user friendly message.

nangia avatar Oct 04 '16 12:10 nangia

I opened PR with the fix https://github.com/jayfk/statuspage/pull/149

orels1 avatar Apr 12 '17 22:04 orels1