mirror of https://github.com/apache/cloudstack.git
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 <tsp@apache.org>
This commit is contained in:
parent
f1eb72359e
commit
b006c993f3
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import time
|
|||
import cloudstackException
|
||||
import contextlib
|
||||
import logging
|
||||
from contextlib import closing
|
||||
|
||||
|
||||
class remoteSSHClient(object):
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue