Enis Afgan 8 лет назад
Родитель
Сommit
6795e6b4c0

+ 15 - 6
cloudbridge/cloud/providers/aws/helpers.py

@@ -1,3 +1,4 @@
+"""A set of AWS-specific helper methods used by the framework."""
 import logging as log
 from boto3.resources.params import create_request_parameters
 
@@ -109,14 +110,14 @@ class BotoGenericService(object):
             obj.load()
             log.debug("Successfully Retrieved: %s", obj)
             return self.cb_resource(self.provider, obj)
-        except ClientError as e:
-            error_code = e.response['Error']['Code']
+        except ClientError as exc:
+            error_code = exc.response['Error']['Code']
             if any(status in error_code for status in
-                    ('NotFound', 'InvalidParameterValue', 'Malformed', '404')):
+                   ('NotFound', 'InvalidParameterValue', 'Malformed', '404')):
                 log.debug("Object not found: %s", resource_id)
                 return None
             else:
-                raise e
+                raise exc
 
     def _get_list_operation(self):
         """
@@ -203,6 +204,14 @@ class BotoGenericService(object):
             return (None, collection)
 
     def list(self, limit=None, marker=None, collection=None, **kwargs):
+        """
+        List a set of resources.
+
+        :type  collection: ``ResourceCollection``
+        :param collection: Boto resource collection object corresponding to the
+                           current resource. See http://boto3.readthedocs.io/
+                           en/latest/guide/collections.html
+        """
         collection = collection or self.boto_collection.filter(**kwargs)
         resume_token, boto_objs = self._make_query(collection, limit, marker)
 
@@ -224,7 +233,7 @@ class BotoGenericService(object):
     def find(self, filter_name, filter_value, limit=None, marker=None,
              **kwargs):
         """
-        Returns a list of resources by filter
+        Return a list of resources by filter.
 
         :type filter_name: ``str``
         :param filter_name: Name of the filter to use
@@ -298,7 +307,7 @@ class BotoEC2Service(BotoGenericService):
 
 class BotoS3Service(BotoGenericService):
     """
-    Boto S3 service implementation
+    Boto S3 service implementation.
     """
     def __init__(self, provider, cb_resource,
                  boto_collection_name):

+ 1 - 1
cloudbridge/cloud/providers/aws/services.py

@@ -378,7 +378,7 @@ class AWSInstanceService(BaseInstanceService):
                key_pair=None, vm_firewalls=None, user_data=None,
                launch_config=None, **kwargs):
         log.debug("Creating AWS Instance Service with the params "
-                  "[name: %s image: %s type: %s sunbnet: %s zone: %s "
+                  "[name: %s image: %s type: %s subnet: %s zone: %s "
                   "key pair: %s firewalls: %s user data: %s config %s "
                   "others: %s]", name, image, vm_type, subnet, zone,
                   key_pair, vm_firewalls, user_data, launch_config, **kwargs)