Просмотр исходного кода

Better documentation.

Make it clear that the current version only adds firewall rules to the
default network.

Also, this fixes a Python 2.x vs 3 issue, too.
chiniforooshan 9 лет назад
Родитель
Сommit
fbeb72b356

+ 11 - 4
cloudbridge/cloud/providers/gce/README.rst

@@ -1,4 +1,6 @@
-CloudBridge support for Google compute engine and cloud storage.
+CloudBridge support for `Google Cloud Platform`_. Compute is provided by `Google
+Compute Engine`_ (GCE). Object storage is provided by `Google Cloud Storage`_
+(GCE).
 
 Security Groups
 ~~~~~~~~~~~~~~~
@@ -20,10 +22,15 @@ makes sure that the rule applies to all instances that have ``sg`` as a tag (in
 CloudBridge language instances belonging to the security group ``sg``).
 
 **Note**: This implementation does not take advantage of the full power of GCE
-firewall format and only creates firewalls with one rule and only sees firewalls
-with one rule.  This should be OK as long as all firewalls are created through
-the CloudBridge API.
+firewall format and only creates firewalls with one rule and only can find or
+list firewalls with one rule. This should be OK as long as all firewalls are
+created through the CloudBridge API.
 
+**Note**: The current implementation adds firewalls to the ``default`` network.
+
+.. _`Google Cloud Platform`: https://cloud.google.com/
+.. _`Google Compute Engine`: https://cloud.google.com/compute/docs
+.. _`Google Cloud Storage`: https://cloud.google.com/storage/docs
 .. _`tags`: https://cloud.google.com/compute/docs/reference/latest/instances/
    setTags
 .. _`firewall rules`: https://cloud.google.com/compute/docs/

+ 7 - 2
cloudbridge/cloud/providers/gce/resources.py

@@ -7,7 +7,12 @@ from cloudbridge.cloud.base.resources import BasePlacementZone
 from cloudbridge.cloud.base.resources import BaseRegion
 from cloudbridge.cloud.base.resources import BaseSecurityGroup
 from cloudbridge.cloud.base.resources import BaseSecurityGroupRule
-from sets import Set
+
+# Older versions of Python do not have a built-in set data-structure.
+try:
+    set
+except NameError:
+    from sets import Set as set
 
 import hashlib
 import inspect
@@ -188,7 +193,7 @@ class GCEFirewallsDelegate(object):
 
     @property
     def tags(self):
-        out = Set()
+        out = set()
         for firewall in self.iter_firewalls():
             out.add(firewall['targetTags'][0])
         return out