Beispiel #1
0
    def create(self, config=None, profile=None):
        if os.path.isdir(self.enginePath):
            return Fail(
                EngineExistsError("Engine \"%s\" already exists." % self.name))

        return Shell.makeDirectory(self.enginePath) \
            .then(defer(self.makeDefaultConfig, config=config, profile=profile)) \
            .bind(self.__ensureDevroot) \
            .bind(self.validateConfig) \
            .then(self.config.saveConfig) \
            .bind(dinfo("Generated default engine configuration in %s", self.config.configFile)) \
            .map(self.chainSelf)
Beispiel #2
0
    def download(self, boxResult):
        archiveURL = boxResult['archiveURL']
        archiveSHA = boxResult['archiveSHA1']
        archive = self.getArchivePath()

        logger.info("Downloading %s:%s (%s)", self.name,
                    self.version, boxResult['archiveURL'])

        return Try.sequence([
            Shell.makeDirectory(os.path.dirname(archive)),
            Try.attempt(streamDownload, url=archiveURL, destination=archive)
            .then(defer(self.verifyArchive, expectedSHA=archiveSHA))
            .then(defer(self.unpackArchive)),
            self.core.getDB().updateBoxRecord(self, boxResult)
        ]).map(lambda x: self)
Beispiel #3
0
 def __ensureDevroot(self, config):
     devroot = os.path.expanduser(config.get('devroot', {}).get('path'))
     if not os.path.isdir(devroot):
         self.logAdapter.info("Creating devroot at %s" % devroot)
         return Shell.makeDirectory(devroot).then(lambda: OK(config))
     return OK(config)