예제 #1
0
 def __init__(self):
     self._log = fgLog.fgLog(IRUtil.getLogFile(), IRUtil.getLogLevel(), "getDistributions", False)
     self.returnCode = 0
     kernel = self.runCmd('uname -s')
     if kernel == "Darwin\n" :
         self._log.info("Using Darwin kernel ")
         self.openssl_dist = 'http://www.openssl.org/source/openssl-1.0.0d.tar.gz'
         self.openssl_dir = 'openssl-1.0.0d'
         self.cherrypy_dist = 'http://download.cherrypy.org/cherrypy/3.2.0/CherryPy-3.2.0.tar.gz'
         self.cherrypy_dir = 'CherryPy-3.2.0'
         cmdOutput = 'x86_64\n'#runCmd('uname -p')
     if cmdOutput == "i386\n" :
         self.mongo_dist = 'http://fastdl.mongodb.org/osx/mongodb-osx-i386-1.8.2.tgz'
         self.mongo_dir = 'mongodb-osx-i386-1.8.2'
     elif cmdOutput == 'x86_64\n' :
         self._log.info('Using osx x86_64')
         self.mongo_dist = 'http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-1.8.2.tgz'
         self.mongo_dir = 'mongodb-osx-x86_64-1.8.2'            
     elif kernel == "Linux\n" :
         self.info('Using Linux kernel')
         self.openssl_dist = 'http://www.openssl.org/source/openssl-1.0.0d.tar.gz'
         self.openssl_dir = 'openssl-1.0.0d'
         self.cherrypy_dist = 'http://download.cherrypy.org/cherrypy/3.2.0/CherryPy-3.2.0.tar.gz'
         self.cherrypy_dir = 'CherryPy-3.2.0'
         cmdOutput = 'x86_64\n' #runCmd('uname -p')
         if cmdOutput == "i386\n" :
             self.mongo_dist = 'http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz'
             self.mongo_dir = 'mongodb-linux-i686-1.8.2'
         elif cmdOutput == "x86_64\n" :
             self.mongo_dist = 'http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-1.8.2.tgz'
             self.mongo_dir = 'mongodb-linux-x86_64-1.8.2'
예제 #2
0
    def __init__(self):
        super(IRService, self).__init__()

        # load config
        self._repoConf = IRServerConf()
        self._repoConf.loadRepoServerConfig()

        # self._authorizedUsers=self._repoConf.getAuthorizedUsers()  #to be removed
        self._backend = self._repoConf.getBackend()

        self._address = self._repoConf.getAddress()
        self._userAdmin = self._repoConf.getUserAdmin()
        self._configFile = self._repoConf.getConfigFile()
        self._imgStore = self._repoConf.getImgStore()
        self._addressS = self._repoConf.getAddressS()
        self._userAdminS = self._repoConf.getUserAdminS()
        self._configFileS = self._repoConf.getConfigFileS()
        # self._idp = self._repoConf.getIdp()

        print "\nReading Configuration file from " + self._repoConf.getServerConfig() + "\n"

        # Setup log.
        # When integrate ALL FG software, we may need to create this somewhere else and send the log object to all classes like this
        self._log = fgLog.fgLog(self._repoConf.getLogRepo(), self._repoConf.getLogLevelRepo(), "Img Repo Server", False)

        if self._backend == "mongodb":
            from IRDataAccessMongo import ImgStoreMongo
            from IRDataAccessMongo import ImgMetaStoreMongo
            from IRDataAccessMongo import IRUserStoreMongo

            self.metaStore = ImgMetaStoreMongo(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreMongo(self._address, self._userAdmin, self._configFile, self._imgStore, self._log)
            self.userStore = IRUserStoreMongo(self._address, self._userAdmin, self._configFile, self._log)
        elif self._backend == "mysql":
            from IRDataAccessMysql import ImgStoreMysql
            from IRDataAccessMysql import ImgMetaStoreMysql
            from IRDataAccessMysql import IRUserStoreMysql

            self.metaStore = ImgMetaStoreMysql(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreMysql(self._address, self._userAdmin, self._configFile, self._imgStore, self._log)
            self.userStore = IRUserStoreMysql(self._address, self._userAdmin, self._configFile, self._log)
        elif self._backend == "swiftmysql":
            from IRDataAccessSwiftMysql import ImgStoreSwiftMysql
            from IRDataAccessSwiftMysql import ImgMetaStoreSwiftMysql
            from IRDataAccessSwiftMysql import IRUserStoreSwiftMysql

            self.metaStore = ImgMetaStoreSwiftMysql(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreSwiftMysql(
                self._address,
                self._userAdmin,
                self._configFile,
                self._addressS,
                self._userAdminS,
                self._configFileS,
                self._imgStore,
                self._log,
            )
            self.userStore = IRUserStoreSwiftMysql(self._address, self._userAdmin, self._configFile, self._log)
        elif self._backend == "swiftmongo":
            from IRDataAccessSwiftMongo import ImgStoreSwiftMongo
            from IRDataAccessSwiftMongo import ImgMetaStoreSwiftMongo
            from IRDataAccessSwiftMongo import IRUserStoreSwiftMongo

            self.metaStore = ImgMetaStoreSwiftMongo(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreSwiftMongo(
                self._address,
                self._userAdmin,
                self._configFile,
                self._addressS,
                self._userAdminS,
                self._configFileS,
                self._imgStore,
                self._log,
            )
            self.userStore = IRUserStoreSwiftMongo(self._address, self._userAdmin, self._configFile, self._log)
        elif self._backend == "cumulusmysql":
            from IRDataAccessCumulusMysql import ImgStoreCumulusMysql
            from IRDataAccessCumulusMysql import ImgMetaStoreCumulusMysql
            from IRDataAccessCumulusMysql import IRUserStoreCumulusMysql

            self.metaStore = ImgMetaStoreCumulusMysql(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreCumulusMysql(
                self._address,
                self._userAdmin,
                self._configFile,
                self._addressS,
                self._userAdminS,
                self._configFileS,
                self._imgStore,
                self._log,
            )
            self.userStore = IRUserStoreCumulusMysql(self._address, self._userAdmin, self._configFile, self._log)
        elif self._backend == "cumulusmongo":
            from IRDataAccessCumulusMongo import ImgStoreCumulusMongo
            from IRDataAccessCumulusMongo import ImgMetaStoreCumulusMongo
            from IRDataAccessCumulusMongo import IRUserStoreCumulusMongo

            self.metaStore = ImgMetaStoreCumulusMongo(self._address, self._userAdmin, self._configFile, self._log)
            self.imgStore = ImgStoreCumulusMongo(
                self._address,
                self._userAdmin,
                self._configFile,
                self._addressS,
                self._userAdminS,
                self._configFileS,
                self._imgStore,
                self._log,
            )
            self.userStore = IRUserStoreCumulusMongo(self._address, self._userAdmin, self._configFile, self._log)
        else:
            self.metaStore = ImgMetaStoreFS()
            self.imgStore = ImgStoreFS()
            self.userStore = IRUserStoreFS()