StackStorm/st2 — pull request #915 by Kami (2014-12-18 14:29:45+00:00)
Title: [RFC] Improve error messages and handling, fix bugs in packs actions

Previously if a pack didn't exist or didn't have a pack.yaml file we returned a very cryptic error - `Exception: No packs from [u'packname'] were downloaded.` error message.

This pull request fixes and improves the message, but we still need to improve the error formatting and reporting. Currently it's still *very* unfriendly because we throw an exception and not return a result. In fact, this should be our top priority - currently, the experience is very bad if a packs action fails.

```
+-----------------+--------------------------------------------------------------+
| Property | Value |
+-----------------+--------------------------------------------------------------+
| id | 5492e47d0640fd0b7cdaf8d1 |
| context | { |
| | "user": "stanley" |
| | } |
| parameters | { |
| | "packs": [ |
| | "fooo", |
| | "barr" |
| | ] |
| | } |
| status | failed |
| start_timestamp | 2014-12-18T14:28:13.214000Z |
| result | { |
| | "result": null, |
| | "exit_code": 1, |
| | "stderr": "Traceback (most recent call last): |
| | File "/data/stanley/st2actions/st2actions/runners/python_a |
| | ction_wrapper.py", line 106, in |
| | obj.run() |
| | File "/data/stanley/st2actions/st2actions/runners/python_a |
| | ction_wrapper.py", line 57, in run |
| | output = action.run(**self._parameters) |
| | File |
| | "/data/stanley/contrib/packs/actions/pack_mgmt/download.py", |
| | line 24, in run |
| | return self._validate_result(result=result, packs=packs, |
| | repo_url=repo_url) |
| | File |
| | "/data/stanley/contrib/packs/actions/pack_mgmt/download.py", |
| | line 96, in _validate_result |
| | raise Exception(message) |
| | Exception: No packs were downloaded from repository |
| | "https://github.com/StackStorm/st2contrib.git". |
| | |
| | Errors: |
| | - fooo: Failure : Pack "fooo" not found or it's missing a |
| | "pack.yaml" file. |
| | - barr: Failure : Pack "barr" not found or it's missing a |
| | "pack.yaml" file. |
| | ", |
| | "stdout": "" |
| | } |
| action | packs.download |
| callback | |
| end_timestamp | 2014-12-18T14:28:30.651000Z |
+-----------------+--------------------------------------------------------------+
```

On top of that, it also fixes some other issues.