Skip to content

Commit

Permalink
Merge pull request #74 from nchammas/friendly-cli-requirements
Browse files Browse the repository at this point in the history
Check CLI option dependencies cleanly
  • Loading branch information
nchammas committed Jan 10, 2016
2 parents e7b1ebc + f616c1e commit 1fbcec6
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 44 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ install:
- "pip install -r requirements/developer.pip"
script:
- "py.test ./tests/test_static.py"
- "py.test ./tests/test_flintrock.py"
3 changes: 2 additions & 1 deletion flintrock/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from .core import FlintrockCluster
from .core import provision_cluster
from .exceptions import (
Error,
ClusterNotFound,
ClusterAlreadyExists,
ClusterInvalidState,
Expand Down Expand Up @@ -402,7 +403,7 @@ def launch(
region=region)
except boto.exception.EC2ResponseError as e:
if e.error_code == 'InvalidAMIID.NotFound':
raise Exception(
raise Error(
"Error: Could not find {ami} in region {region}.".format(
ami=ami,
region=region))
Expand Down
14 changes: 9 additions & 5 deletions flintrock/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
class NothingToDo(Exception):
pass


class UsageError(Exception):
pass

Expand All @@ -9,19 +13,19 @@ def __init__(self, provider: str):
self.provider = provider


class NothingToDo(Exception):
class Error(Exception):
pass


class ClusterNotFound(Exception):
class ClusterNotFound(Error):
pass


class ClusterAlreadyExists(Exception):
class ClusterAlreadyExists(Error):
pass


class ClusterInvalidState(Exception):
class ClusterInvalidState(Error):
def __init__(self, *, attempted_command: str, state: str):
super().__init__(
"Cluster is in state '{s}'. Cannot execute {c}.".format(
Expand All @@ -31,7 +35,7 @@ def __init__(self, *, attempted_command: str, state: str):
self.state = state


class NodeError(Exception):
class NodeError(Error):
def __init__(self, error: str):
super().__init__(
"At least one node raised an error: " + error)
Expand Down
Loading

0 comments on commit 1fbcec6

Please sign in to comment.