Commit 3c091245 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Renamed old 'getStorageList()' method in 'getStorageListByType()' + added...


Renamed old 'getStorageList()' method in 'getStorageListByType()' + added 'getStorageList()' method.

Signed-off-by: default avatarCristiano Urban <cristiano.urban@inaf.it>
parent c2b918ef
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -164,7 +164,14 @@ class DbConnector(object):
            self.cursor.execute("SELECT base_path FROM storage WHERE storage_id = %s;", (storageId,))
            return self.cursor.fetchall()[0]["base_path"]

    def getStorageList(self, storageType):
    def getStorageList(self):
        """Returns the full storage base list. Local storage points are excluded by default."""
        if self.conn:
            self.cursor.execute("SELECT * FROM storage WHERE storage_type <> 'local';")
            result = self.cursor.fetchall()
            return result
    
    def getStorageListByType(self, storageType):
        """Returns a list of storage locations for a given storage type"""
        if self.conn:
            self.cursor.execute("SELECT * FROM storage WHERE storage_type = %s;", (storageType,))
+2 −2
Original line number Diff line number Diff line
@@ -52,9 +52,9 @@ class StoreAMQPServer(AMQPServer):
            self.dbConn.connect()
            userInDb = self.dbConn.userExists(user)
            if requestBody["requestType"] == "CSTORE":
                storageList = self.dbConn.getStorageList("cold")
                storageList = self.dbConn.getStorageListByType("cold")
            else:
                storageList = self.dbConn.getStorageList("hot")
                storageList = self.dbConn.getStorageListByType("hot")
            self.dbConn.disconnect()
            #folderPath = "/home/" + user + "/store"
            folderPath = self.storageStorePath.replace("{username}", user)