dos2unix
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 9 Jun 2009 14:41:12 +0000 (14:41 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 9 Jun 2009 14:41:12 +0000 (14:41 +0000)
geni/util/api.py
geni/util/geniclient.py
geni/util/gid.py
geni/util/hierarchy.py
geni/util/trustedroot.py

index 228647f..03620d1 100644 (file)
@@ -121,8 +121,8 @@ class GeniAPI:
 
     def getPLCShell(self):
         self.plauth = {'Username': self.config.GENI_PLC_USER,
-                         'AuthMethod': 'password',
-                         'AuthString': self.config.GENI_PLC_PASSWORD}
+                       'AuthMethod': 'password',
+                       'AuthString': self.config.GENI_PLC_PASSWORD}
         try:
             import PLC.Shell
             shell = PLC.Shell.Shell(globals = globals())
@@ -133,16 +133,15 @@ class GeniAPI:
             plc_host = self.config.GENI_PLC_HOST
             plc_port = self.config.GENI_PLC_PORT
             plc_api_path = self.config.GENI_PLC_API_PATH
-            url = "https://%(plc_host)s:%(plc_port)s/%(plc_api_path)s/" % \
-                   locals()
+            url = "https://%(plc_host)s:%(plc_port)s/%(plc_api_path)s/" % locals()
              
             shell = xmlrpclib.Server(url, verbose = 0, allow_none = True)
             shell.AuthCheck(self.plauth)
             return shell
 
     def getPLCShellVersion(self):
-        # We need to figure out what version of PLCAPI are talking to.
-        # Some calls we need to make later will be different depending
+        # We need to figure out what version of PLCAPI we are talking to.
+        # Some calls we need to make later will be different depending on
         # the api version. 
         try:
             # This is probably a bad way to determine api versions
@@ -290,12 +289,12 @@ class GeniAPI:
     def fill_record_pl_info(self, record):
         """
         Fill in the planetlab specific fields of a Geni record. This
-        involves calling the appropraite PLC method to retrie the 
-        dtabase record for the object.
+        involves calling the appropriate PLC method to retrieve the 
+        database record for the object.
         
-        PLC data is filled into the pl_fino field of the record.
+        PLC data is filled into the pl_info field of the record.
     
-        @param record record to fill in field (in/out param)     
+        @param record: record to fill in field (in/out param)     
         """
         type = record.get_type()
         pointer = record.get_pointer()
@@ -391,15 +390,15 @@ class GeniAPI:
             geni_info['pi'] = pis
             geni_info['operator'] = operators
             geni_info['owner'] = owners
-            # TODO: OrganizationName
+            # xxx TODO: OrganizationName
 
         elif (type == "node"):
             geni_info['dns'] = record.get("hostname", "")
-            # TODO: URI, LatLong, IP, DNS
+            # xxx TODO: URI, LatLong, IP, DNS
     
         elif (type == "user"):
             geni_info['email'] = record.get("email", "")
-            # TODO: PostalAddress, Phone
+            # xxx TODO: PostalAddress, Phone
 
         record.update(geni_info)
 
@@ -412,7 +411,7 @@ class GeniAPI:
         self.fill_record_geni_info(record)
 
     def update_membership_list(self, oldRecord, record, listName, addFunc, delFunc):
-        # get a list of the HRNs tht are members of the old and new records^M
+        # get a list of the HRNs tht are members of the old and new records
         oldList = oldRecord.get(listName, [])
         newList = record.get(listName, [])
 
@@ -434,7 +433,7 @@ class GeniAPI:
                 userRecord = records[0]    
                 newIdList.append(userRecord.get_pointer())
 
-        # build a list of the old person ids from the person_ids field of the
+        # build a list of the old person ids from the person_ids field 
         if oldRecord:
             oldIdList = oldRecord.get("person_ids", [])
             containerId = oldRecord.get_pointer()
@@ -462,7 +461,7 @@ class GeniAPI:
                                         self.plshell.AddPersonToSlice,
                                         self.plshell.DeletePersonFromSlice)
         elif record.type == "authority":
-            # TODO
+            # xxx TODO
             pass
 
 
index 35065d5..fb969f7 100644 (file)
@@ -23,10 +23,10 @@ class ServerException(Exception):
     pass
 
 class ExceptionUnmarshaller(xmlrpclib.Unmarshaller):
-    def close(self):\r
-        try:\r
-            return xmlrpclib.Unmarshaller.close(self)\r
-        except xmlrpclib.Fault, e:\r
+    def close(self):
+        try:
+            return xmlrpclib.Unmarshaller.close(self)
+        except xmlrpclib.Fault, e:
             raise ServerException(e.faultString)
 
 ##
@@ -37,35 +37,35 @@ class ExceptionUnmarshaller(xmlrpclib.Unmarshaller):
 class GeniTransport(xmlrpclib.Transport):
     key_file = None
     cert_file = None
-    def make_connection(self, host):\r
-        # create a HTTPS connection object from a host descriptor\r
-        # host may be a string, or a (host, x509-dict) tuple\r
-        import httplib\r
-        host, extra_headers, x509 = self.get_host_info(host)\r
-        try:\r
-            HTTPS = httplib.HTTPS()\r
-        except AttributeError:\r
-            raise NotImplementedError(\r
-                "your version of httplib doesn't support HTTPS"\r
-                )\r
-        else:\r
-            return httplib.HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file) #**(x509 or {}))\r
-\r
-    def getparser(self):\r
-        unmarshaller = ExceptionUnmarshaller()\r
-        parser = xmlrpclib.ExpatParser(unmarshaller)\r
-        return parser, unmarshaller\r
-\r
-##\r
-# The GeniClient class provides stubs for executing Geni operations. A given\r
-# client object connects to one server. To connect to multiple servers, create\r
-# multiple GeniClient objects.\r
-#\r
-# The Geni protocol uses an HTTPS connection, and the client's side of the\r
-# connection uses his private key. Generally, this private key must match the\r
-# public key that is containing in the GID that the client is providing for\r
-# those functions that take a GID.\r
-\r
+    def make_connection(self, host):
+        # create a HTTPS connection object from a host descriptor
+        # host may be a string, or a (host, x509-dict) tuple
+        import httplib
+        host, extra_headers, x509 = self.get_host_info(host)
+        try:
+            HTTPS = httplib.HTTPS()
+        except AttributeError:
+            raise NotImplementedError(
+                "your version of httplib doesn't support HTTPS"
+                )
+        else:
+            return httplib.HTTPS(host, None, key_file=self.key_file, cert_file=self.cert_file) #**(x509 or {}))
+
+    def getparser(self):
+        unmarshaller = ExceptionUnmarshaller()
+        parser = xmlrpclib.ExpatParser(unmarshaller)
+        return parser, unmarshaller
+
+##
+# The GeniClient class provides stubs for executing Geni operations. A given
+# client object connects to one server. To connect to multiple servers, create
+# multiple GeniClient objects.
+#
+# The Geni protocol uses an HTTPS connection, and the client's side of the
+# connection uses his private key. Generally, this private key must match the
+# public key that is containing in the GID that the client is providing for
+# those functions that take a GID.
+
 class GeniClient():
     ##
     # Create a new GeniClient object.
index 65aff6b..c919605 100644 (file)
@@ -20,12 +20,12 @@ def create_uuid():
 # UUID is a unique identifier and is created by the python uuid module
 #    (or the utility function create_uuid() in gid.py).
 #
-# HRN is a human readable name. It is a dotted form similar to a backward domain\r
-#    name. For example, planetlab.us.arizona.bakers.\r
-#\r
-# PUBLIC_KEY is the public key of the principal identified by the UUID/HRN.\r
-# It is a Keypair object as defined in the cert.py module.\r
-#\r
+# HRN is a human readable name. It is a dotted form similar to a backward domain
+#    name. For example, planetlab.us.arizona.bakers.
+#
+# PUBLIC_KEY is the public key of the principal identified by the UUID/HRN.
+# It is a Keypair object as defined in the cert.py module.
+#
 # It is expected that there is a one-to-one pairing between UUIDs and HRN,
 # but it is uncertain how this would be inforced or if it needs to be enforced.
 #
index 742ab8b..1146963 100644 (file)
@@ -78,24 +78,24 @@ class AuthInfo():
         f.close()
         return dict
 
-    ##\r
-    # Replace the GID with a new one. The file specified by gid_filename is\r
-    # overwritten with the new GID object\r
-    #\r
-    # @param gid object containing new GID\r
+    ##
+    # Replace the GID with a new one. The file specified by gid_filename is
+    # overwritten with the new GID object
+    #
+    # @param gid object containing new GID
 
     def update_gid_object(self, gid):
         gid.save_to_file(self.gid_filename)
         self.gid_object = gid
 
-##\r
-# The Hierarchy class is responsible for managing the tree of authorities.\r
-# Each authority is a node in the tree and exists as an AuthInfo object.\r
-#\r
-# The tree is stored on disk in a hierarchical manner than reflects the\r
-# structure of the tree. Each authority is a subdirectory, and each subdirectory\r
-# contains the GID, pkey, and dbinfo files for that authority (as well as\r
-# subdirectories for each sub-authority)\r
+##
+# The Hierarchy class is responsible for managing the tree of authorities.
+# Each authority is a node in the tree and exists as an AuthInfo object.
+#
+# The tree is stored on disk in a hierarchical manner than reflects the
+# structure of the tree. Each authority is a subdirectory, and each subdirectory
+# contains the GID, pkey, and dbinfo files for that authority (as well as
+# subdirectories for each sub-authority)
 
 class Hierarchy():
     ##
@@ -159,10 +159,10 @@ class Hierarchy():
 
         # create the directory to hold the files
         try:
-            os.makedirs(directory)\r
-        # if the path already exists then pass\r
-        except OSError, (errno, strerr):\r
-            if errno == 17:\r
+            os.makedirs(directory)
+        # if the path already exists then pass
+        except OSError, (errno, strerr):
+            if errno == 17:
                 pass
 
         if os.path.exists(privkey_filename):
@@ -179,7 +179,7 @@ class Hierarchy():
 
         dbinfo = get_default_dbinfo()
         dbinfo_file = file(dbinfo_filename, "w")
-        dbinfo_file.write(str(dbinfo))\r
+        dbinfo_file.write(str(dbinfo))
         dbinfo_file.close()
 
     ##
index 67ad129..f2ec35a 100644 (file)
@@ -12,10 +12,10 @@ class TrustedRootList():
         
         # create the directory to hold the files
         try:
-            os.makedirs(self.basedir)\r
-        # if the path already exists then pass\r
-        except OSError, (errno, strerr):\r
-            if errno == 17:\r
+            os.makedirs(self.basedir)
+        # if the path already exists then pass
+        except OSError, (errno, strerr):
+            if errno == 17:
                 pass
 
     def add_gid(self, gid):