jayfk / jayfk/statuspage

Not selecting severity while creating an issue causes exception

Open
#96 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.9k
Forks
180
PR merge metrics
No merged PRs in 30d

Description

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
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 "", 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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing `statuspage update` with an issue that has no severity selected, then inspect `statuspage/statuspage.py` around `run_update` and the referenced `template.html` line. Confirm how `severity` becomes `None` and define a user-facing outcome that avoids the Jinja exception; done means the update handles missing severity without the reported traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.