コード例 #1
0
ファイル: app.py プロジェクト: Alukardd/cocaine-tools
    def execute(self):
        log.debug('application name will be: %s', self.fullname)

        if self.manifest:
            manifestPath = self.manifest
        else:
            try:
                manifestPath = _locateFile(self.path, 'manifest.json')
            except IOError:
                log.error("unable to locate manifest.json")
                raise ToolsError("unable to locate manifest.json")

        with printer('Loading manifest'):
            manifest = CocaineConfigReader.load(manifestPath)

        with printer('Uploading manifest'):
            channel = yield self.storage.write('manifests', self.name, manifest, APPS_TAGS)
            yield channel.rx.get()

        try:
            response = yield self.client.build(self.path, tag=self.fullname, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('building failed with error code {0} {1}'.format(response.code,
                                                                                  response.body))
            response = yield self.client.push(self.fullname, auth={}, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('pushing failed with error code {0} {1}'.format(response.code,
                                                                                 response.body))
        except Exception as err:
            log.error("Error occurred. %s Erase manifest" % err)
            channel = yield self.storage.remove('manifests', self.name)
            yield channel.rx.get()
            raise err
コード例 #2
0
ファイル: app.py プロジェクト: terrible-broom/cocaine-tools
    def execute(self):
        log.debug('application name will be: %s', self.fullname)

        if self.manifest:
            manifestPath = self.manifest
        else:
            try:
                manifestPath = _locateFile(self.path, 'manifest.json')
            except IOError:
                log.error("unable to locate manifest.json")
                raise ToolsError("unable to locate manifest.json")

        with printer('Loading manifest'):
            manifest = CocaineConfigReader.load(manifestPath)

        with printer('Uploading manifest'):
            channel = yield self.storage.write('manifests', self.name, manifest, APPS_TAGS)
            yield channel.rx.get()

        try:
            response = yield self.client.build(self.path, tag=self.fullname, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('building failed with error code {0} {1}'.format(response.code,
                                                                                  response.body))
            response = yield self.client.push(self.fullname, auth={}, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('pushing failed with error code {0} {1}'.format(response.code,
                                                                                 response.body))
        except Exception as err:
            log.error("Error occurred. %s Erase manifest", err)
            channel = yield self.storage.remove('manifests', self.name)
            yield channel.rx.get()
            raise err
コード例 #3
0
ファイル: app.py プロジェクト: padm/cocaine-tools
    def execute(self):
        log.debug('application name will be: %s', self.fullname)

        if self.manifest:
            manifestPath = self.manifest
        else:
            manifestPath = _locateFile(self.path, 'manifest.json')

        with printer('Loading manifest'):
            manifest = CocaineConfigReader.load(manifestPath)

        with printer('Uploading manifest'):
            yield self.storage.write('manifests', self.name, manifest, APPS_TAGS)

        try:
            response = yield self.client.build(self.path, tag=self.fullname, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('upload failed with error code {0}'.format(response.code))

            response = yield self.client.push(self.fullname, {}, streaming=self._on_read)
            if response.code != 200:
                raise ToolsError('upload failed with error code {0}'.format(response.code))
        except Exception as err:
            log.error("Error occurred. Erase manifest")
            yield self.storage.remove('manifests', self.name)
            raise err
コード例 #4
0
ファイル: app.py プロジェクト: Alukardd/cocaine-tools
    def execute(self):
        try:
            repositoryPath = self._createRepository()
            if self.manifest:
                manifestPath = self.manifest
            else:
                manifestPath = _locateFile(self.path, 'manifest.json')
            Installer = venvFactory[self.virtualEnvironmentType]
            if Installer:
                yield self._createVirtualEnvironment(repositoryPath, manifestPath, Installer)
                manifestPath = os.path.join(repositoryPath, 'manifest.json')
            else:
                pass

            packagePath = self._createPackage(repositoryPath)
            yield Upload(self.storage, **{
                'name': self.name,
                'manifest': manifestPath,
                'package': packagePath
            }).execute()
        except (RepositoryDownloadError, ModuleInstallError) as err:
            log.error(err)
コード例 #5
0
ファイル: app.py プロジェクト: terrible-broom/cocaine-tools
    def execute(self):
        try:
            repositoryPath = self._createRepository()
            if self.manifest:
                manifestPath = self.manifest
            else:
                manifestPath = _locateFile(self.path, 'manifest.json')
            Installer = venvFactory[self.virtualEnvironmentType]
            if Installer:
                yield self._createVirtualEnvironment(repositoryPath, manifestPath, Installer)
                manifestPath = os.path.join(repositoryPath, 'manifest.json')
            else:
                pass

            packagePath = self._createPackage(repositoryPath)
            yield Upload(self.storage, **{
                'name': self.name,
                'manifest': manifestPath,
                'package': packagePath
            }).execute()
        except (RepositoryDownloadError, ModuleInstallError) as err:
            log.error(err)