You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2010/05/05 01:46:25 UTC

svn commit: r941110 - in /incubator/libcloud/trunk/libcloud: base.py deployment.py interface.py ssh.py

Author: pquerna
Date: Tue May  4 23:46:25 2010
New Revision: 941110

URL: http://svn.apache.org/viewvc?rev=941110&view=rev
Log:
Style cleanups, no functional changes.

Modified:
    incubator/libcloud/trunk/libcloud/base.py
    incubator/libcloud/trunk/libcloud/deployment.py
    incubator/libcloud/trunk/libcloud/interface.py
    incubator/libcloud/trunk/libcloud/ssh.py

Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=941110&r1=941109&r2=941110&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Tue May  4 23:46:25 2010
@@ -41,7 +41,7 @@ class Node(object):
     """
     A Base Node class to derive from.
     """
-    
+
     interface.implements(INode)
     interface.classProvides(INodeFactory)
 
@@ -58,13 +58,13 @@ class Node(object):
             self.extra = {}
         else:
             self.extra = extra
-        
+
     def get_uuid(self):
         """Unique hash for this node
         @return: C{string}
         """
         return hashlib.sha1("%s:%d" % (self.id,self.driver.type)).hexdigest()
-        
+
     def reboot(self):
         """Reboot this node
         @return: C{bool}
@@ -88,7 +88,7 @@ class NodeSize(object):
     """
     A Base NodeSize class to derive from.
     """
-    
+
     interface.implements(INodeSize)
     interface.classProvides(INodeSizeFactory)
 
@@ -111,7 +111,7 @@ class NodeImage(object):
     """
     A Base NodeImage class to derive from.
     """
-    
+
     interface.implements(INodeImage)
     interface.classProvides(INodeImageFactory)
 
@@ -263,11 +263,11 @@ class LoggingConnection():
         cmd.extend(["-X", pquote(method)])
 
         for h in headers:
-          cmd.extend(["-H", pquote("%s: %s" % (h, headers[h]))])
+            cmd.extend(["-H", pquote("%s: %s" % (h, headers[h]))])
 
         # TODO: in python 2.6, body can be a file-like object.
         if body is not None and len(body) > 0:
-          cmd.extend(["--data-binary", pquote(body)])
+            cmd.extend(["--data-binary", pquote(body)])
 
         cmd.extend([pquote("https://%s:%d%s" % (self.host, self.port, url))])
         return " ".join(cmd)
@@ -345,10 +345,10 @@ class ConnectionKey(object):
         self.secure = secure and 1 or 0
         self.ua = []
         if host:
-          self.host = host
+            self.host = host
 
         if force_port:
-          self.port = (force_port, force_port)
+            self.port = (force_port, force_port)
 
     def connect(self, host=None, port=None):
         """
@@ -375,22 +375,22 @@ class ConnectionKey(object):
         self.connection = connection
 
     def _user_agent(self):
-      return 'libcloud/%s (%s)%s' % (
-                libcloud.__version__,
-                self.driver.name,
-                "".join([" (%s)" % x for x in self.ua]))
+        return 'libcloud/%s (%s)%s' % (
+                  libcloud.__version__,
+                  self.driver.name,
+                  "".join([" (%s)" % x for x in self.ua]))
 
     def user_agent_append(self, token):
-      """
-      Append a token to a user agent string.
+        """
+        Append a token to a user agent string.
 
-      Users of the library should call this to uniquely identify thier requests
-      to a provider.
+        Users of the library should call this to uniquely identify thier requests
+        to a provider.
 
-      @type token: C{str}
-      @param token: Token to add to the user agent.
-      """
-      self.ua.append(token)
+        @type token: C{str}
+        @param token: Token to add to the user agent.
+        """
+        self.ua.append(token)
 
     def request(self,
                 action,
@@ -400,7 +400,7 @@ class ConnectionKey(object):
                 method='GET'):
         """
         Request a given `action`.
-        
+
         Basically a wrapper around the connection
         object's `request` that does some helpful pre-processing.
 
@@ -424,9 +424,9 @@ class ConnectionKey(object):
         @return: An instance of type I{responseCls}
         """
         if params is None:
-          params = {}
+            params = {}
         if headers is None:
-          headers = {}
+            headers = {}
 
         self.action = action
         # Extend default parameters
@@ -441,7 +441,7 @@ class ConnectionKey(object):
             data = self.encode_data(data)
         headers.update({'Content-Length': len(data)})
         url = '?'.join((action, urllib.urlencode(params)))
-        
+
         # Removed terrible hack...this a less-bad hack that doesn't execute a
         # request twice, but it's still a hack.
         self.connect()
@@ -525,7 +525,7 @@ class NodeDriver(object):
         @keyword    secret: Secret password to be used
         @type       secret: str
 
-        @keyword    secure: Weither to use HTTPS or HTTP. Note: Some providers 
+        @keyword    secure: Weither to use HTTPS or HTTP. Note: Some providers
                             only support HTTPS, and it is on by default.
         @type       secure: bool
 
@@ -541,15 +541,15 @@ class NodeDriver(object):
         args = [self.key]
 
         if self.secret != None:
-          args.append(self.secret)
+            args.append(self.secret)
 
         args.append(secure)
 
         if host != None:
-          args.append(host)
+            args.append(host)
 
         if port != None:
-          args.append(port)
+            args.append(port)
 
         self.connection = self.connectionCls(*args)
 
@@ -637,7 +637,7 @@ class NodeDriver(object):
         """
         Create a new node, and start deployment.
 
-        Depends on a Provider Driver supporting either using a specific password 
+        Depends on a Provider Driver supporting either using a specific password
         or returning a generated password.
 
         @keyword    deploy: Deployment to run once machine is online and availble to SSH.

Modified: incubator/libcloud/trunk/libcloud/deployment.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/deployment.py?rev=941110&r1=941109&r2=941110&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/deployment.py (original)
+++ incubator/libcloud/trunk/libcloud/deployment.py Tue May  4 23:46:25 2010
@@ -50,7 +50,7 @@ class SSHKeyDeployment(Deployment):
         @keyword key: Contents of the public key write
         """
         self.key = key
-  
+
     def run(self, node, client):
         """
         Installs SSH key into C{.ssh/authorized_keys}

Modified: incubator/libcloud/trunk/libcloud/interface.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/interface.py?rev=941110&r1=941109&r2=941110&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/interface.py (original)
+++ incubator/libcloud/trunk/libcloud/interface.py Tue May  4 23:46:25 2010
@@ -267,7 +267,7 @@ class IConnectionKeyFactory(Interface):
 
         The acceptance of only `key` provides support for APIs with only one
         authentication bit.
-        
+
         The `secure` argument indicates whether or not a secure connection
         should be made. Not all providers support this, so it may be ignored.
         """
@@ -283,7 +283,7 @@ class IConnectionUserAndKeyFactory(Inter
 
         The first two arguments provide the initial values for `user_id` and
         `key`, respectively, which should be used for authentication.
-        
+
         The `secure` argument indicates whether or not a secure connection
         should be made. Not all providers support this, so it may be ignored.
         """
@@ -325,4 +325,3 @@ class IResponseFactory(Interface):
         """
         Process the given response, setting ivars.
         """
-

Modified: incubator/libcloud/trunk/libcloud/ssh.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/ssh.py?rev=941110&r1=941109&r2=941110&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/ssh.py (original)
+++ incubator/libcloud/trunk/libcloud/ssh.py Tue May  4 23:46:25 2010
@@ -81,7 +81,7 @@ class ParamikoSSHClient(BaseSSHClient):
                 try:
                     sftp.mkdir(part)
                 except IOError, e:
-                    # so, there doens't seem to be a way to 
+                    # so, there doens't seem to be a way to
                     # catch EEXIST consistently *sigh*
                     pass
                 sftp.chdir(part)