You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/10/02 18:42:13 UTC
[43/50] [abbrv] git commit: updated refs/heads/marvin-refactor to
bbaf354
marvin_refactor: exception handle for non-standard libraries
non-standard python libraries that are not installed by default on
python installations need to be exception handled appropriately
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3aa10efe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3aa10efe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3aa10efe
Branch: refs/heads/marvin-refactor
Commit: 3aa10efec176baed4ad07a9d39f0009476e753c3
Parents: c1524f3
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed Oct 2 11:28:44 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed Oct 2 20:28:09 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/TestCaseExecuteEngine.py | 5 ++++-
tools/marvin/marvin/cloudstackConnection.py | 13 ++++++++-----
tools/marvin/marvin/dbConnection.py | 11 ++++++-----
tools/marvin/marvin/remoteSSHClient.py | 1 -
tools/marvin/marvin/util.py | 1 -
5 files changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3aa10efe/tools/marvin/marvin/TestCaseExecuteEngine.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/TestCaseExecuteEngine.py b/tools/marvin/marvin/TestCaseExecuteEngine.py
index 6495000..c9796b8 100644
--- a/tools/marvin/marvin/TestCaseExecuteEngine.py
+++ b/tools/marvin/marvin/TestCaseExecuteEngine.py
@@ -15,7 +15,10 @@
# specific language governing permissions and limitations
# under the License.
-import unittest2 as unittest
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import os
import sys
import logging
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3aa10efe/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 07cb471..1e4298e 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -15,7 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-import requests
+try:
+ import requests
+ from requests import ConnectionError
+ from requests import HTTPError
+ from requests import Timeout
+ from requests import RequestException
+except ImportError:
+ raise Exception("requests installation not found. use pip install requests to continue")
import urllib
import base64
import hmac
@@ -25,10 +32,6 @@ import time
from marvin import cloudstackException
from marvin.cloudstackAPI import *
from marvin import jsonHelper
-from requests import ConnectionError
-from requests import HTTPError
-from requests import Timeout
-from requests import RequestException
class CloudConnection(object):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3aa10efe/tools/marvin/marvin/dbConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/dbConnection.py b/tools/marvin/marvin/dbConnection.py
index 99014ab..98c72c5 100644
--- a/tools/marvin/marvin/dbConnection.py
+++ b/tools/marvin/marvin/dbConnection.py
@@ -15,13 +15,14 @@
# specific language governing permissions and limitations
# under the License.
-import mysql
+try:
+ import mysql
+ from mysql import connector
+ from mysql.connector import errors
+except ImportError:
+ raise Exception("mysql-connector-python not installed. pip install mysql-connector-python to continue")
import contextlib
-from mysql import connector
-from mysql.connector import errors
-from contextlib import closing
import cloudstackException
-import sys
import os
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3aa10efe/tools/marvin/marvin/remoteSSHClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/remoteSSHClient.py b/tools/marvin/marvin/remoteSSHClient.py
index fea9b12..d64c82d 100644
--- a/tools/marvin/marvin/remoteSSHClient.py
+++ b/tools/marvin/marvin/remoteSSHClient.py
@@ -20,7 +20,6 @@ import time
import cloudstackException
import contextlib
import logging
-from contextlib import closing
class remoteSSHClient(object):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3aa10efe/tools/marvin/marvin/util.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/util.py b/tools/marvin/marvin/util.py
index 9a97c9d..609e696 100644
--- a/tools/marvin/marvin/util.py
+++ b/tools/marvin/marvin/util.py
@@ -19,7 +19,6 @@ from marvin.entity.template import Template
from marvin.entity.zone import Zone
from marvin.entity.serviceoffering import ServiceOffering
from marvin.entity.domain import Domain
-from marvin.entity.guestos import GuestOS
def get_domain(apiclient):
"Returns a default `ROOT` domain"