You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/11/17 21:05:27 UTC

[01/17] git commit: docs: Update getting started page.

Updated Branches:
  refs/heads/trunk a8aff7e19 -> 33f5722eb


docs: Update getting started page.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b6c2530a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b6c2530a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b6c2530a

Branch: refs/heads/trunk
Commit: b6c2530a4396336957ed2c191909849492b545af
Parents: a8aff7e
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 19:56:20 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 19:56:20 2013 +0100

----------------------------------------------------------------------
 docs/getting_started.rst | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b6c2530a/docs/getting_started.rst
----------------------------------------------------------------------
diff --git a/docs/getting_started.rst b/docs/getting_started.rst
index 472f4a6..fbfb310 100644
--- a/docs/getting_started.rst
+++ b/docs/getting_started.rst
@@ -51,6 +51,12 @@ with any of the Libcloud drivers.
 
    driver = cls('my username', 'my api key')
 
+Keep in mind that some drivers take additional arguments such as ``region``
+and ``api_version``.
+
+For more information on which arguments you can pass to your provider driver,
+see provider-specific documentation and the driver docstrings.
+
 3. Start using the driver
 
 .. sourcecode:: python
@@ -78,3 +84,14 @@ on the :doc:`Compute Examples </compute/examples>` page.
 
 Where to go from here?
 ----------------------
+
+The best thing to do after understanding the basic driver work-flow is to visit
+the documentation chapter for the API you are interested in (:doc:`Compute </compute/index>`, :doc:`Object Storage </storage/index>`,
+:doc:`Load Balancer </loadbalancer/index>`, :doc:`DNS </dns/index>`). Chapter
+for each API explains some basic terminology and things you need to know to
+make an effective use of that API.
+
+After you have a good grasp of those basic concepts, you are encouraged to
+check the driver specific documentation (if available) and usage examples. If
+the driver specific documentation for the provider you are interested in is
+not available yet, you are encouraged to check docstrings for that driver.


[05/17] git commit: docs: Update "api reference" page for all the APIs.

Posted by to...@apache.org.
docs: Update "api reference" page for all the APIs.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cd5f9f10
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cd5f9f10
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cd5f9f10

Branch: refs/heads/trunk
Commit: cd5f9f10400956d5dc660bbf5ea0ddc3fec74eae
Parents: 1191dc2
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:13:17 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:13:17 2013 +0100

----------------------------------------------------------------------
 docs/compute/api.rst      |  9 +++++++++
 docs/dns/api.rst          | 30 ++++++++++++++++++++++++++++++
 docs/loadbalancer/api.rst | 15 +++++++++++++++
 docs/storage/api.rst      | 30 ++++++++++++++++++++++++++++++
 4 files changed, 84 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5f9f10/docs/compute/api.rst
----------------------------------------------------------------------
diff --git a/docs/compute/api.rst b/docs/compute/api.rst
index d73a372..334f463 100644
--- a/docs/compute/api.rst
+++ b/docs/compute/api.rst
@@ -24,3 +24,12 @@ Compute Base API
 
 .. autoclass:: libcloud.compute.base.StorageVolume
     :members:
+
+.. autoclass:: libcloud.compute.types.NodeState
+    :members:
+
+Error Classes
+-------------
+
+.. autoclass:: libcloud.compute.types.DeploymentError
+    :members:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5f9f10/docs/dns/api.rst
----------------------------------------------------------------------
diff --git a/docs/dns/api.rst b/docs/dns/api.rst
index 4742139..9d0eb38 100644
--- a/docs/dns/api.rst
+++ b/docs/dns/api.rst
@@ -3,3 +3,33 @@ DNS Base API
 
 .. autoclass:: libcloud.dns.base.DNSDriver
     :members:
+
+.. autoclass:: libcloud.dns.base.Zone
+    :members:
+
+.. autoclass:: libcloud.dns.base.Record
+    :members:
+
+.. autoclass:: libcloud.dns.types.RecordType
+    :members:
+
+Error Classes
+-------------
+
+.. autoclass:: libcloud.dns.types.ZoneError
+    :members:
+
+.. autoclass:: libcloud.dns.types.ZoneDoesNotExistError
+    :members:
+
+.. autoclass:: libcloud.dns.types.ZoneAlreadyExistsError
+    :members:
+
+.. autoclass:: libcloud.dns.types.RecordError
+    :members:
+
+.. autoclass:: libcloud.dns.types.RecordDoesNotExistError
+    :members:
+
+.. autoclass:: libcloud.dns.types.RecordAlreadyExistsError
+    :members:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5f9f10/docs/loadbalancer/api.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/api.rst b/docs/loadbalancer/api.rst
index 0be4329..90e2305 100644
--- a/docs/loadbalancer/api.rst
+++ b/docs/loadbalancer/api.rst
@@ -3,3 +3,18 @@ LoadBalancer Base API
 
 .. autoclass:: libcloud.loadbalancer.base.Driver
     :members:
+
+.. autoclass:: libcloud.loadbalancer.base.LoadBalancer
+    :members:
+
+.. autoclass:: libcloud.loadbalancer.base.Member
+    :members:
+
+.. autoclass:: libcloud.loadbalancer.base.Algorithm
+    :members:
+
+.. autoclass:: libcloud.loadbalancer.types.State
+    :members:
+
+.. autoclass:: libcloud.loadbalancer.types.MemberCondition
+    :members:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cd5f9f10/docs/storage/api.rst
----------------------------------------------------------------------
diff --git a/docs/storage/api.rst b/docs/storage/api.rst
index f44b0b4..2f546e0 100644
--- a/docs/storage/api.rst
+++ b/docs/storage/api.rst
@@ -3,3 +3,33 @@ Storage Base API
 
 .. autoclass:: libcloud.storage.base.StorageDriver
     :members:
+
+.. autoclass:: libcloud.storage.base.Container
+    :members:
+
+.. autoclass:: libcloud.storage.base.Object
+    :members:
+
+Error Classes
+-------------
+
+.. autoclass:: libcloud.storage.types.ContainerError
+    :members:
+
+.. autoclass:: libcloud.storage.types.ContainerAlreadyExistsError
+    :members:
+
+.. autoclass:: libcloud.storage.types.ContainerDoesNotExistError
+    :members:
+
+.. autoclass:: libcloud.storage.types.ContainerIsNotEmptyError
+    :members:
+
+.. autoclass:: libcloud.storage.types.ObjectDoesNotExistError
+    :members:
+
+.. autoclass:: libcloud.storage.types.ObjectHashMismatchError
+    :members:
+
+.. autoclass:: libcloud.storage.types.InvalidContainerNameError
+    :members:


[14/17] git commit: Remove "public_ip" and "private_ip" property which has been deprecated in 0.7.0 from the Node object.

Posted by to...@apache.org.
Remove "public_ip" and "private_ip" property which has been deprecated in
0.7.0 from the Node object.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/fc99d596
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/fc99d596
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/fc99d596

Branch: refs/heads/trunk
Commit: fc99d5965cf3f6c043dfd3c4855d766acfc065e2
Parents: 3e3bcad
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:39:44 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:39:44 2013 +0100

----------------------------------------------------------------------
 CHANGES                  |  4 ++++
 libcloud/compute/base.py | 18 ------------------
 2 files changed, 4 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/fc99d596/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index cbb472f..e8efb4e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -20,6 +20,10 @@ Changes with Apache Libcloud in development
       Affected drivers: Bluebox, Joyent, NephoScale, OpSource, VPSNet
       [Tomaz Muraus]
 
+    - Remove "public_ip" and "private_ip" property which has been deprecated in
+      0.7.0 from the Node object.
+      [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.14.0-beta3
 
   *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/fc99d596/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 7b33aca..ecaf87d 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -187,24 +187,6 @@ class Node(UuidMixin):
         self.extra = extra or {}
         UuidMixin.__init__(self)
 
-    # Note: getters and setters bellow are here only for backward
-    # compatibility. They will be removed in the next release.
-
-    def _set_public_ips(self, value):
-        self.public_ips = value
-
-    def _get_public_ips(self):
-        return self.public_ips
-
-    def _set_private_ips(self, value):
-        self.private_ips = value
-
-    def _get_private_ips(self):
-        return self.private_ips
-
-    public_ip = property(fget=_get_public_ips, fset=_set_public_ips)
-    private_ip = property(fget=_get_private_ips, fset=_set_private_ips)
-
     def reboot(self):
         """
         Reboot this node


[06/17] git commit: Remove unused imports which are not part of the compute API from libcloud.compute.base.

Posted by to...@apache.org.
Remove unused imports which are not part of the compute API from
libcloud.compute.base.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/32cc7f43
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/32cc7f43
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/32cc7f43

Branch: refs/heads/trunk
Commit: 32cc7f43954f0371d83465ea44037531750bc110
Parents: cd5f9f1
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:18:42 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:18:42 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/32cc7f43/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 2172e6b..662d51c 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -31,13 +31,8 @@ import libcloud.compute.ssh
 from libcloud.pricing import get_size_price
 from libcloud.compute.types import NodeState, DeploymentError
 from libcloud.compute.ssh import SSHClient
-
-# @@TR: are the imports below part of the public api for this
-# module? They aren't used in here ...
-from libcloud.common.base import ConnectionKey, ConnectionUserAndKey
+from libcloud.common.base import ConnectionKey
 from libcloud.common.base import BaseDriver
-from libcloud.httplib_ssl import LibcloudHTTPSConnection
-from libcloud.common.base import LibcloudHTTPConnection
 from libcloud.common.types import LibcloudError
 
 
@@ -57,13 +52,7 @@ __all__ = [
     "NodeLocation",
     "NodeAuthSSHKey",
     "NodeAuthPassword",
-    "NodeDriver",
-
-    # @@TR: do the following need exporting?
-    "ConnectionKey",
-    "ConnectionUserAndKey",
-    "LibcloudHTTPSConnection",
-    "LibcloudHTTPConnection"
+    "NodeDriver"
 ]
 
 


[15/17] git commit: Fix a typo.

Posted by to...@apache.org.
Fix a typo.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/58dfc295
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/58dfc295
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/58dfc295

Branch: refs/heads/trunk
Commit: 58dfc295997d436e6f94f1fdf312a24f99d3744a
Parents: fc99d59
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:44:11 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:44:11 2013 +0100

----------------------------------------------------------------------
 libcloud/storage/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/58dfc295/libcloud/storage/base.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/base.py b/libcloud/storage/base.py
index 35c49b2..3408d24 100644
--- a/libcloud/storage/base.py
+++ b/libcloud/storage/base.py
@@ -37,7 +37,7 @@ CHUNK_SIZE = 8096
 
 __all__ = [
     'Object',
-    'Contaner',
+    'Container',
     'StorageDriver'
 ]
 


[13/17] git commit: Fix a typo.

Posted by to...@apache.org.
Fix a typo.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3e3bcade
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3e3bcade
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3e3bcade

Branch: refs/heads/trunk
Commit: 3e3bcade231f27a4e1ac3755e2279475009a39cf
Parents: 5227ca0
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:36:11 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:36:11 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/3e3bcade/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 9feb22c..7b33aca 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -171,7 +171,7 @@ class Node(UuidMixin):
         :param image: Image of this node. (optional)
         :type size: :class:`.NodeImage:
 
-        :param extra: Optional provided specific attributes associated with
+        :param extra: Optional provider specific attributes associated with
                       this node.
         :type extra: ``dict``
 


[16/17] git commit: Add missing __all__ to libcloud.utils.files and libcloud.utils.xml module.

Posted by to...@apache.org.
Add missing __all__ to libcloud.utils.files and libcloud.utils.xml module.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c2438acd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c2438acd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c2438acd

Branch: refs/heads/trunk
Commit: c2438acd3d9681edf83f639b737cd5a8b23e8f9e
Parents: 58dfc29
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:44:16 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:45:07 2013 +0100

----------------------------------------------------------------------
 libcloud/utils/files.py | 10 ++++++++--
 libcloud/utils/xml.py   |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c2438acd/libcloud/utils/files.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/files.py b/libcloud/utils/files.py
index 201e94a..19b2a3f 100644
--- a/libcloud/utils/files.py
+++ b/libcloud/utils/files.py
@@ -21,11 +21,17 @@ from libcloud.utils.py3 import httplib
 from libcloud.utils.py3 import next
 from libcloud.utils.py3 import b
 
-CHUNK_SIZE = 8096
-
 if PY3:
     from io import FileIO as file
 
+CHUNK_SIZE = 8096
+
+__all__ = [
+    'read_in_chunks',
+    'exhaust_iterator',
+    'guess_file_mime_type'
+]
+
 
 def read_in_chunks(iterator, chunk_size=None, fill_size=False):
     """

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c2438acd/libcloud/utils/xml.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/xml.py b/libcloud/utils/xml.py
index d05b843..c2c1321 100644
--- a/libcloud/utils/xml.py
+++ b/libcloud/utils/xml.py
@@ -13,6 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+__all__ = [
+    'fixxpath',
+    'findtext',
+    'findattr',
+    'findall'
+]
+
 
 def fixxpath(xpath, namespace=None):
     # ElementTree wants namespaces in its xpaths, so here we add them.


[02/17] git commit: docs: Fix typos in deployment page.

Posted by to...@apache.org.
docs: Fix typos in deployment page.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0d8485fb
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0d8485fb
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0d8485fb

Branch: refs/heads/trunk
Commit: 0d8485fb48fc5acaa8142c0f5bfc653dcf549998
Parents: b6c2530
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 19:57:59 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 19:57:59 2013 +0100

----------------------------------------------------------------------
 docs/compute/deployment.rst | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/0d8485fb/docs/compute/deployment.rst
----------------------------------------------------------------------
diff --git a/docs/compute/deployment.rst b/docs/compute/deployment.rst
index 693d5bb..304457a 100644
--- a/docs/compute/deployment.rst
+++ b/docs/compute/deployment.rst
@@ -56,8 +56,8 @@ using LIBCLOUD_DEBUG method which is described on the
 
 :func:`libcloud.compute.base.NodeDriver.deploy_node` takes the same base
 keyword arguments as the :func:`libcloud.compute.base.NodeDriver.create_node`
-method a couple of additional arguments. The most important ones are ``deploy``
-and ``auth``:
+method and couple of additional arguments. The most important ones are
+``deploy`` and ``auth``:
 
 * ``deploy`` argument specifies which deployment step or steps to run after the
   server has been created.
@@ -67,7 +67,8 @@ and ``auth``:
   log in. For more information, please see the create_node and deploy_node
   method docstring.
 
-Examples which demonstrates how this method can be used are displayed bellow.
+Some examples which demonstrate how this method can be used are displayed
+bellow.
 
 Run a single deploy step using ScriptDeployment class
 -----------------------------------------------------


[03/17] git commit: docs: Update link texts.

Posted by to...@apache.org.
docs: Update link texts.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c9918508
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c9918508
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c9918508

Branch: refs/heads/trunk
Commit: c9918508e68b7f7ef7bc64bcdd9c189979095a81
Parents: 0d8485f
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:01:22 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:01:22 2013 +0100

----------------------------------------------------------------------
 docs/dns/index.rst          | 4 ++--
 docs/loadbalancer/index.rst | 4 ++--
 docs/storage/index.rst      | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c9918508/docs/dns/index.rst
----------------------------------------------------------------------
diff --git a/docs/dns/index.rst b/docs/dns/index.rst
index 9f76459..7580cfe 100644
--- a/docs/dns/index.rst
+++ b/docs/dns/index.rst
@@ -39,5 +39,5 @@ We have :doc:`examples of several common patterns </dns/examples>`.
 API Reference
 -------------
 
-There is a reference to :doc:`all the methods on the base dns driver
-</dns/api/>`.
+For a full reference of all the classes and methods exposed by the DNS
+API, see :doc:`this page </dns/api>`.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c9918508/docs/loadbalancer/index.rst
----------------------------------------------------------------------
diff --git a/docs/loadbalancer/index.rst b/docs/loadbalancer/index.rst
index a946a11..f432017 100644
--- a/docs/loadbalancer/index.rst
+++ b/docs/loadbalancer/index.rst
@@ -31,5 +31,5 @@ We have :doc:`examples of several common patterns </loadbalancer/examples>`.
 API Reference
 -------------
 
-There is a reference to :doc:`all the methods on the base loadbalancer driver
-</loadbalancer/api/>`.
+For a full reference of all the classes and methods exposed by the loadbalancer
+API, see :doc:`this page </loadbalancer/api>`.

http://git-wip-us.apache.org/repos/asf/libcloud/blob/c9918508/docs/storage/index.rst
----------------------------------------------------------------------
diff --git a/docs/storage/index.rst b/docs/storage/index.rst
index 0960cf5..fe1042d 100644
--- a/docs/storage/index.rst
+++ b/docs/storage/index.rst
@@ -35,5 +35,5 @@ We have :doc:`examples of several common patterns </storage/examples>`.
 API Reference
 -------------
 
-There is a reference to :doc:`all the methods on the base storage driver
-</storage/api/>`.
+For a full reference of all the classes and methods exposed by the storage
+API, see :doc:`this page </storage/api>`.


[11/17] git commit: For consistency, move private methods on the Driver class to the end.

Posted by to...@apache.org.
For consistency, move private methods on the Driver class to the end.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cc04b13c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cc04b13c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cc04b13c

Branch: refs/heads/trunk
Commit: cc04b13c161380ebdd109223e53a719d2b727e32
Parents: 81d5fd6
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:34:35 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:34:48 2013 +0100

----------------------------------------------------------------------
 libcloud/loadbalancer/base.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc04b13c/libcloud/loadbalancer/base.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/base.py b/libcloud/loadbalancer/base.py
index 1508121..b785af0 100644
--- a/libcloud/loadbalancer/base.py
+++ b/libcloud/loadbalancer/base.py
@@ -307,6 +307,14 @@ class Driver(BaseDriver):
         raise NotImplementedError(
             'balancer_list_members not implemented for this driver')
 
+    def list_supported_algorithms(self):
+        """
+        Return algorithms supported by this driver.
+
+        :rtype: ``list`` of ``str``
+        """
+        return list(self._ALGORITHM_TO_VALUE_MAP.keys())
+
     def _value_to_algorithm(self, value):
         """
         Return :class`Algorithm` based on the value.
@@ -336,11 +344,3 @@ class Driver(BaseDriver):
         except KeyError:
             raise LibcloudError(value='Invalid algorithm: %s' % (algorithm),
                                 driver=self)
-
-    def list_supported_algorithms(self):
-        """
-        Return algorithms supported by this driver.
-
-        :rtype: ``list`` of ``str``
-        """
-        return list(self._ALGORITHM_TO_VALUE_MAP.keys())


[09/17] git commit: Add some missing docstrings to classes in the loadbalancer API.

Posted by to...@apache.org.
Add some missing docstrings to classes in the loadbalancer API.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e1fc7e9b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e1fc7e9b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e1fc7e9b

Branch: refs/heads/trunk
Commit: e1fc7e9b97ce46b797584a6f49384ba901f51273
Parents: b56f901
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:32:09 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:32:09 2013 +0100

----------------------------------------------------------------------
 libcloud/loadbalancer/base.py | 51 +++++++++++++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e1fc7e9b/libcloud/loadbalancer/base.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/base.py b/libcloud/loadbalancer/base.py
index 9868efb..c017f3b 100644
--- a/libcloud/loadbalancer/base.py
+++ b/libcloud/loadbalancer/base.py
@@ -25,8 +25,27 @@ __all__ = [
 
 
 class Member(object):
+    """
+    Represents a load balancer member.
+    """
 
     def __init__(self, id, ip, port, balancer=None, extra=None):
+        """
+        :param id: Member ID.
+        :type id: ``str``
+
+        :param ip: IP address of this member.
+        :param ip: ``str``
+
+        :param port: Port of this member
+        :param port: ``str``
+
+        :param balancer: Balancer this member is attached to. (optional)
+        :param balancer: :class:`.LoadBalancer`
+
+        :param extra: Provider specific attributes.
+        :type extra: ``dict``
+        """
         self.id = str(id) if id else None
         self.ip = ip
         self.port = port
@@ -39,6 +58,10 @@ class Member(object):
 
 
 class Algorithm(object):
+    """
+    Represents a load balancing algorithm.
+    """
+
     RANDOM = 0
     ROUND_ROBIN = 1
     LEAST_CONNECTIONS = 2
@@ -53,10 +76,29 @@ class LoadBalancer(object):
     Provide a common interface for handling Load Balancers.
     """
 
-    name = None
-    website = None
-
     def __init__(self, id, name, state, ip, port, driver, extra=None):
+        """
+        :param id: Load balancer ID.
+        :type id: ``str``
+
+        :param name: Load balancer name.
+        :type name: ``str``
+
+        :param state: State this loadbalancer is in.
+        :type state: :class:`libcloud.loadbalancer.types.State`
+
+        :param ip: IP address of this loadbalancer.
+        :type ip: ``str``
+
+        :param port: Port of this loadbalancer.
+        :type port: ``int``
+
+        :param driver: Driver this loadbalancer belongs to.
+        :type driver: :class:`.Driver`
+
+        :param extra: Provier specific attributes. (optional)
+        :type extra: ``dict``
+        """
         self.id = str(id) if id else None
         self.name = name
         self.state = state
@@ -95,6 +137,9 @@ class Driver(BaseDriver):
     This class is always subclassed by a specific driver.
     """
 
+    name = None
+    website = None
+
     connectionCls = ConnectionKey
     _ALGORITHM_TO_VALUE_MAP = {}
     _VALUE_TO_ALGORITHM_MAP = {}


[04/17] git commit: docs: Update compute docs.

Posted by to...@apache.org.
docs: Update compute docs.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1191dc22
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1191dc22
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1191dc22

Branch: refs/heads/trunk
Commit: 1191dc22e75d4d7ec0c28bc2ab4b0fd8936a43dc
Parents: c991850
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:08:42 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:08:42 2013 +0100

----------------------------------------------------------------------
 docs/compute/index.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1191dc22/docs/compute/index.rst
----------------------------------------------------------------------
diff --git a/docs/compute/index.rst b/docs/compute/index.rst
index 86900f7..836925b 100644
--- a/docs/compute/index.rst
+++ b/docs/compute/index.rst
@@ -29,7 +29,7 @@ Compute
 * **NodeImage** - represents an operating system image.
 * **NodeLocation** - represents a physical location where a server can be.
 * **NodeState** - represents a node state. Standard states are: ``running``,
-  ``rebooting``, ``terminated``, ``pending``, and ``unknown``.
+  ``stopped``, ``rebooting``, ``terminated``, ``pending``, and ``unknown``.
 
 Block Storage
 ~~~~~~~~~~~~~


[12/17] git commit: Use consistent order for __all__.

Posted by to...@apache.org.
Use consistent order for __all__.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5227ca0d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5227ca0d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5227ca0d

Branch: refs/heads/trunk
Commit: 5227ca0d776ae2ac14665e40ee1582be6add3f19
Parents: cc04b13
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:35:56 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:35:56 2013 +0100

----------------------------------------------------------------------
 libcloud/dns/base.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/5227ca0d/libcloud/dns/base.py
----------------------------------------------------------------------
diff --git a/libcloud/dns/base.py b/libcloud/dns/base.py
index fafdf56..f0b1da6 100644
--- a/libcloud/dns/base.py
+++ b/libcloud/dns/base.py
@@ -15,18 +15,18 @@
 
 from __future__ import with_statement
 
-__all__ = [
-    'Zone',
-    'Record',
-    'DNSDriver'
-]
-
 import datetime
 
 from libcloud import __version__
 from libcloud.common.base import ConnectionUserAndKey, BaseDriver
 from libcloud.dns.types import RecordType
 
+__all__ = [
+    'Zone',
+    'Record',
+    'DNSDriver'
+]
+
 
 class Zone(object):
     """


[07/17] git commit: Use consistent quoting and docstring style.

Posted by to...@apache.org.
Use consistent quoting and docstring style.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cff3adf2
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cff3adf2
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cff3adf2

Branch: refs/heads/trunk
Commit: cff3adf20230d47e7f77329262f38a7bf90820b0
Parents: 32cc7f4
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:19:56 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:23:48 2013 +0100

----------------------------------------------------------------------
 libcloud/compute/base.py      | 37 +++++++++++++++++++++----------------
 libcloud/loadbalancer/base.py |  8 ++++----
 2 files changed, 25 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cff3adf2/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index 662d51c..9feb22c 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -45,14 +45,14 @@ SSH_CONNECT_TIMEOUT = 5 * 60
 
 
 __all__ = [
-    "Node",
-    "NodeState",
-    "NodeSize",
-    "NodeImage",
-    "NodeLocation",
-    "NodeAuthSSHKey",
-    "NodeAuthPassword",
-    "NodeDriver"
+    'Node',
+    'NodeState',
+    'NodeSize',
+    'NodeImage',
+    'NodeLocation',
+    'NodeAuthSSHKey',
+    'NodeAuthPassword',
+    'NodeDriver'
 ]
 
 
@@ -65,9 +65,8 @@ class UuidMixin(object):
         self._uuid = None
 
     def get_uuid(self):
-        """Unique hash for a node, node image, or node size
-
-        :return: ``string``
+        """
+        Unique hash for a node, node image, or node size
 
         The hash is a function of an SHA1 hash of the node, node image,
         or node size's ID and its driver which means that it should be
@@ -85,6 +84,8 @@ class UuidMixin(object):
 
         Note, for example, that this example will always produce the
         same UUID!
+
+        :rtype: ``str``
         """
         if not self._uuid:
             self._uuid = hashlib.sha1(b('%s:%s' %
@@ -205,7 +206,8 @@ class Node(UuidMixin):
     private_ip = property(fget=_get_private_ips, fset=_set_private_ips)
 
     def reboot(self):
-        """Reboot this node
+        """
+        Reboot this node
 
         :return: ``bool``
 
@@ -226,7 +228,8 @@ class Node(UuidMixin):
         return self.driver.reboot_node(self)
 
     def destroy(self):
-        """Destroy this node
+        """
+        Destroy this node
 
         :return: ``bool``
 
@@ -716,7 +719,8 @@ class NodeDriver(BaseDriver):
             'create_node not implemented for this driver')
 
     def destroy_node(self, node):
-        """Destroy a node.
+        """
+        Destroy a node.
 
         Depending upon the provider, this may destroy all data associated with
         the node, including backups.
@@ -745,7 +749,8 @@ class NodeDriver(BaseDriver):
 
     def list_nodes(self):
         """
-        List all nodes
+        List all nodes.
+
         :return:  list of node objects
         :rtype: ``list`` of :class:`.Node`
         """
@@ -1270,6 +1275,6 @@ def is_valid_ip_address(address, family=socket.AF_INET):
     return True
 
 
-if __name__ == "__main__":
+if __name__ == '__main__':
     import doctest
     doctest.testmod()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cff3adf2/libcloud/loadbalancer/base.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/base.py b/libcloud/loadbalancer/base.py
index 39ada3d..9868efb 100644
--- a/libcloud/loadbalancer/base.py
+++ b/libcloud/loadbalancer/base.py
@@ -17,10 +17,10 @@ from libcloud.common.base import ConnectionKey, BaseDriver
 from libcloud.common.types import LibcloudError
 
 __all__ = [
-    "Member",
-    "LoadBalancer",
-    "Driver",
-    "Algorithm"
+    'Member',
+    'LoadBalancer',
+    'Driver',
+    'Algorithm'
 ]
 
 


[17/17] git commit: Move "is_private_ip" and "is_valid_ip_address" function from libcloud.compute.base into libcloud.utils.networking module.

Posted by to...@apache.org.
Move "is_private_ip" and "is_valid_ip_address" function from
libcloud.compute.base into libcloud.utils.networking module.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/33f5722e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/33f5722e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/33f5722e

Branch: refs/heads/trunk
Commit: 33f5722ebe231b6e7be0539bcc733734bd3c2005
Parents: c2438ac
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:56:33 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 21:00:52 2013 +0100

----------------------------------------------------------------------
 CHANGES                                |  4 ++
 libcloud/compute/base.py               | 48 +++--------------
 libcloud/compute/drivers/cloudstack.py |  3 +-
 libcloud/compute/drivers/ecp.py        |  2 +-
 libcloud/compute/drivers/joyent.py     |  2 +-
 libcloud/compute/drivers/nephoscale.py |  2 +-
 libcloud/utils/networking.py           | 80 +++++++++++++++++++++++++++++
 7 files changed, 97 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e8efb4e..0453fcb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -24,6 +24,10 @@ Changes with Apache Libcloud in development
       0.7.0 from the Node object.
       [Tomaz Muraus]
 
+    - Move "is_private_ip" and "is_valid_ip_address" function from
+      libcloud.compute.base into libcloud.utils.networking module.
+      [Tomaz Muraus]
+
 Changes with Apache Libcloud 0.14.0-beta3
 
   *) General

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/compute/base.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/base.py b/libcloud/compute/base.py
index ecaf87d..5ce5db6 100644
--- a/libcloud/compute/base.py
+++ b/libcloud/compute/base.py
@@ -22,7 +22,6 @@ import time
 import hashlib
 import os
 import socket
-import struct
 import binascii
 
 from libcloud.utils.py3 import b
@@ -35,6 +34,9 @@ from libcloud.common.base import ConnectionKey
 from libcloud.common.base import BaseDriver
 from libcloud.common.types import LibcloudError
 
+from libcloud.utils.networking import is_private_subnet
+from libcloud.utils.networking import is_valid_ip_address
+
 
 # How long to wait for the node to come online after creating it
 NODE_ONLINE_WAIT_TIMEOUT = 10 * 60
@@ -52,7 +54,11 @@ __all__ = [
     'NodeLocation',
     'NodeAuthSSHKey',
     'NodeAuthPassword',
-    'NodeDriver'
+    'NodeDriver',
+
+    # Deprecated, moved to libcloud.utils.networking
+    'is_private_subnet',
+    'is_valid_ip_address'
 ]
 
 
@@ -1219,44 +1225,6 @@ class NodeDriver(BaseDriver):
                               size_id=size_id)
 
 
-def is_private_subnet(ip):
-    """
-    Utility function to check if an IP address is inside a private subnet.
-
-    :type ip: ``str``
-    :param ip: IP address to check
-
-    :return: ``bool`` if the specified IP address is private.
-    """
-    priv_subnets = [{'subnet': '10.0.0.0', 'mask': '255.0.0.0'},
-                    {'subnet': '172.16.0.0', 'mask': '255.240.0.0'},
-                    {'subnet': '192.168.0.0', 'mask': '255.255.0.0'}]
-
-    ip = struct.unpack('I', socket.inet_aton(ip))[0]
-
-    for network in priv_subnets:
-        subnet = struct.unpack('I', socket.inet_aton(network['subnet']))[0]
-        mask = struct.unpack('I', socket.inet_aton(network['mask']))[0]
-
-        if (ip & mask) == (subnet & mask):
-            return True
-
-    return False
-
-
-def is_valid_ip_address(address, family=socket.AF_INET):
-    """
-    Check if the provided address is valid IPv4 or IPv6 adddress.
-
-    :return: ``bool`` True if the provided address is valid.
-    """
-    try:
-        socket.inet_pton(family, address)
-    except socket.error:
-        return False
-    return True
-
-
 if __name__ == '__main__':
     import doctest
     doctest.testmod()

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/compute/drivers/cloudstack.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py
index 84073b7..819fcda 100644
--- a/libcloud/compute/drivers/cloudstack.py
+++ b/libcloud/compute/drivers/cloudstack.py
@@ -23,8 +23,9 @@ from libcloud.utils.py3 import b
 from libcloud.compute.providers import Provider
 from libcloud.common.cloudstack import CloudStackDriverMixIn
 from libcloud.compute.base import Node, NodeDriver, NodeImage, NodeLocation,\
-    NodeSize, StorageVolume, is_private_subnet
+    NodeSize, StorageVolume
 from libcloud.compute.types import NodeState, LibcloudError
+from libcloud.utils.networking import is_private_subnet
 
 
 class CloudStackNode(Node):

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/compute/drivers/ecp.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ecp.py b/libcloud/compute/drivers/ecp.py
index 86e77e2..021e7b0 100644
--- a/libcloud/compute/drivers/ecp.py
+++ b/libcloud/compute/drivers/ecp.py
@@ -36,7 +36,7 @@ from libcloud.common.base import Response, ConnectionUserAndKey
 from libcloud.compute.base import NodeDriver, NodeSize, NodeLocation
 from libcloud.compute.base import NodeImage, Node
 from libcloud.compute.types import Provider, NodeState, InvalidCredsError
-from libcloud.compute.base import is_private_subnet
+from libcloud.utils.networking import is_private_subnet
 
 #Defaults
 API_HOST = ''

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/compute/drivers/joyent.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/joyent.py b/libcloud/compute/drivers/joyent.py
index 1aa1a60..6d8142e 100644
--- a/libcloud/compute/drivers/joyent.py
+++ b/libcloud/compute/drivers/joyent.py
@@ -30,9 +30,9 @@ from libcloud.utils.py3 import b
 from libcloud.common.types import LibcloudError
 from libcloud.compute.providers import Provider
 from libcloud.common.base import JsonResponse, ConnectionUserAndKey
-from libcloud.compute.base import is_private_subnet
 from libcloud.compute.types import NodeState, InvalidCredsError
 from libcloud.compute.base import Node, NodeDriver, NodeImage, NodeSize
+from libcloud.utils.networking import is_private_subnet
 
 API_HOST_SUFFIX = '.api.joyentcloud.com'
 API_VERSION = '~6.5'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/compute/drivers/nephoscale.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/nephoscale.py b/libcloud/compute/drivers/nephoscale.py
index c8fad3b..efe5089 100644
--- a/libcloud/compute/drivers/nephoscale.py
+++ b/libcloud/compute/drivers/nephoscale.py
@@ -30,12 +30,12 @@ from libcloud.utils.py3 import b
 from libcloud.utils.py3 import urlencode
 
 from libcloud.compute.providers import Provider
-from libcloud.compute.base import is_private_subnet
 from libcloud.common.base import JsonResponse, ConnectionUserAndKey
 from libcloud.compute.types import (NodeState, InvalidCredsError,
                                     LibcloudError)
 from libcloud.compute.base import (Node, NodeDriver, NodeImage, NodeSize,
                                    NodeLocation)
+from libcloud.utils.networking import is_private_subnet
 
 API_HOST = 'api.nephoscale.com'
 

http://git-wip-us.apache.org/repos/asf/libcloud/blob/33f5722e/libcloud/utils/networking.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/networking.py b/libcloud/utils/networking.py
new file mode 100644
index 0000000..d9678ed
--- /dev/null
+++ b/libcloud/utils/networking.py
@@ -0,0 +1,80 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import socket
+import struct
+
+__all__ = [
+    'is_private_subnet',
+    'is_public_subnet',
+    'is_valid_ip_address'
+]
+
+
+def is_private_subnet(ip):
+    """
+    Utility function to check if an IP address is inside a private subnet.
+
+    :type ip: ``str``
+    :param ip: IP address to check
+
+    :return: ``bool`` if the specified IP address is private.
+    """
+    priv_subnets = [{'subnet': '10.0.0.0', 'mask': '255.0.0.0'},
+                    {'subnet': '172.16.0.0', 'mask': '255.240.0.0'},
+                    {'subnet': '192.168.0.0', 'mask': '255.255.0.0'}]
+
+    ip = struct.unpack('I', socket.inet_aton(ip))[0]
+
+    for network in priv_subnets:
+        subnet = struct.unpack('I', socket.inet_aton(network['subnet']))[0]
+        mask = struct.unpack('I', socket.inet_aton(network['mask']))[0]
+
+        if (ip & mask) == (subnet & mask):
+            return True
+
+    return False
+
+
+def is_public_subnet(ip):
+    """
+    Utility function to check if an IP address is inside a public subnet.
+
+    :type ip: ``str``
+    :param ip: IP address to check
+
+    :return: ``bool`` if the specified IP address is public.
+    """
+    return not is_private_subnet(ip=ip)
+
+
+def is_valid_ip_address(address, family=socket.AF_INET):
+    """
+    Check if the provided address is valid IPv4 or IPv6 adddress.
+
+    :param address: IPv4 or IPv6 ddress to check.
+    :type address: ``str``
+
+    :param family: Address family (socket.AF_INTET / socket.AF_INET6).
+    :type family: ``int``
+
+    :return: ``bool`` True if the provided address is valid.
+    """
+    try:
+        socket.inet_pton(family, address)
+    except socket.error:
+        return False
+
+    return True


[08/17] git commit: Add missing __all__ to libcloud.storage.base module.

Posted by to...@apache.org.
Add missing __all__ to libcloud.storage.base module.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b56f9018
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b56f9018
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b56f9018

Branch: refs/heads/trunk
Commit: b56f90182e4d0b4b4c6cb5505b473a316c6b911f
Parents: cff3adf
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:23:50 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:23:50 2013 +0100

----------------------------------------------------------------------
 libcloud/storage/base.py | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b56f9018/libcloud/storage/base.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/base.py b/libcloud/storage/base.py
index b99f4be..35c49b2 100644
--- a/libcloud/storage/base.py
+++ b/libcloud/storage/base.py
@@ -35,6 +35,12 @@ from libcloud.storage.types import ObjectDoesNotExistError
 
 CHUNK_SIZE = 8096
 
+__all__ = [
+    'Object',
+    'Contaner',
+    'StorageDriver'
+]
+
 
 class Object(object):
     """


[10/17] git commit: Update class order in the loadbalancer API, add DEFAULT_ALGORITHM variable to __all__.

Posted by to...@apache.org.
Update class order in the loadbalancer API, add DEFAULT_ALGORITHM variable to
__all__.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/81d5fd63
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/81d5fd63
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/81d5fd63

Branch: refs/heads/trunk
Commit: 81d5fd6336f13a1eabdc90509d771a8586798495
Parents: e1fc7e9
Author: Tomaz Muraus <to...@apache.org>
Authored: Sun Nov 17 20:33:40 2013 +0100
Committer: Tomaz Muraus <to...@apache.org>
Committed: Sun Nov 17 20:33:40 2013 +0100

----------------------------------------------------------------------
 libcloud/loadbalancer/base.py | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/81d5fd63/libcloud/loadbalancer/base.py
----------------------------------------------------------------------
diff --git a/libcloud/loadbalancer/base.py b/libcloud/loadbalancer/base.py
index c017f3b..1508121 100644
--- a/libcloud/loadbalancer/base.py
+++ b/libcloud/loadbalancer/base.py
@@ -19,8 +19,9 @@ from libcloud.common.types import LibcloudError
 __all__ = [
     'Member',
     'LoadBalancer',
+    'Algorithm',
     'Driver',
-    'Algorithm'
+    'DEFAULT_ALGORITHM'
 ]
 
 
@@ -57,20 +58,6 @@ class Member(object):
                                                     self.ip, self.port))
 
 
-class Algorithm(object):
-    """
-    Represents a load balancing algorithm.
-    """
-
-    RANDOM = 0
-    ROUND_ROBIN = 1
-    LEAST_CONNECTIONS = 2
-    WEIGHTED_ROUND_ROBIN = 3
-    WEIGHTED_LEAST_CONNECTIONS = 4
-
-DEFAULT_ALGORITHM = Algorithm.ROUND_ROBIN
-
-
 class LoadBalancer(object):
     """
     Provide a common interface for handling Load Balancers.
@@ -130,6 +117,20 @@ class LoadBalancer(object):
                 self.name, self.state))
 
 
+class Algorithm(object):
+    """
+    Represents a load balancing algorithm.
+    """
+
+    RANDOM = 0
+    ROUND_ROBIN = 1
+    LEAST_CONNECTIONS = 2
+    WEIGHTED_ROUND_ROBIN = 3
+    WEIGHTED_LEAST_CONNECTIONS = 4
+
+DEFAULT_ALGORITHM = Algorithm.ROUND_ROBIN
+
+
 class Driver(BaseDriver):
     """
     A base Driver class to derive from