Example #1
0
    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
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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)
Example #5
0
    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)