From 46ba8a102abc2fa527c8b87b9af69721baf28b33 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Fri, 27 Sep 2013 20:39:00 -0400 Subject: [PATCH] add exceptions --- employ/exceptions.py | 16 ++++++++++++++++ employ/managers/__init__.py | 2 ++ employ/managers/ec2.py | 1 + 3 files changed, 19 insertions(+) create mode 100644 employ/exceptions.py diff --git a/employ/exceptions.py b/employ/exceptions.py new file mode 100644 index 0000000..e75781b --- /dev/null +++ b/employ/exceptions.py @@ -0,0 +1,16 @@ +class EmployError(Exception): + """ + Base Employ Exception + """ + + +class ExecutionError(EmployError): + """ + Error when executing a command + """ + + +class SSHConnectionError(EmployError): + """ + Could not connect to EC2 Instance with SSH + """ diff --git a/employ/managers/__init__.py b/employ/managers/__init__.py index 5ab412c..44bb50a 100644 --- a/employ/managers/__init__.py +++ b/employ/managers/__init__.py @@ -1,6 +1,8 @@ from pkgutil import extend_path __path__ = extend_path(__path__, __name__) +from employ.execptions import ExecutionError + class Manager(object): name = "manager" diff --git a/employ/managers/ec2.py b/employ/managers/ec2.py index 890488d..68b1b1c 100644 --- a/employ/managers/ec2.py +++ b/employ/managers/ec2.py @@ -3,6 +3,7 @@ import time import boto.ec2 from boto.manage.cmdshell import sshclient_from_instance +from employ.exceptions import SSHConnectionError from employ.managers import Manager