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
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
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
def execute(self): if self.content: content = CocaineConfigReader.load(self.content, validate=self._validate) else: content = msgpack.dumps({}) yield self.storage.write(GROUP_COLLECTION, self.name, content, GROUPS_TAGS)
def execute(self): """ Encodes manifest and package files and (if successful) uploads them into storage """ log.info('Uploading "%s"... ', self.name) manifest = CocaineConfigReader.load(self.manifest) package = msgpack.dumps(readArchive(self.package)) yield self.storage.write('manifests', self.name, manifest, APPS_TAGS) yield self.storage.write('apps', self.name, package, APPS_TAGS) log.info('OK')
def execute(self): with printer('Loading manifest'): manifest = CocaineConfigReader.load(self.manifest) with printer('Reading package "%s"', self.package): package = msgpack.dumps(readArchive(self.package)) with printer('Uploading manifest'): yield self.storage.write('manifests', self.name, manifest, APPS_TAGS) with printer('Uploading application "%s"', self.name): yield self.storage.write('apps', self.name, package, APPS_TAGS)
def execute(self): with printer('Loading manifest'): manifest = CocaineConfigReader.load(self.manifest) # Not only a manifest is being uploaded, # self.package could be None if manifest_only=True if self.package is not None: with printer('Reading package "%s"', self.package): package = msgpack.dumps(readArchive(self.package)) with printer('Uploading application "%s"', self.name): yield self.storage.write('apps', self.name, package, APPS_TAGS) with printer('Uploading manifest'): yield self.storage.write('manifests', self.name, manifest, APPS_TAGS)
def execute(self): with printer('Loading manifest'): manifest = CocaineConfigReader.load(self.manifest) # Not only a manifest is being uploaded, # self.package could be None if manifest_only=True if self.package is not None: with printer('Reading package "%s"', self.package): package = msgpack.dumps(readArchive(self.package)) with printer('Uploading application "%s"', self.name): channel = yield self.storage.write('apps', self.name, package, APPS_TAGS) yield channel.rx.get() with printer('Uploading manifest'): channel = yield self.storage.write('manifests', self.name, manifest, APPS_TAGS) yield channel.rx.get() raise gen.Return("Uploaded successfully")
def execute(self): with printer('Loading profile'): profile = CocaineConfigReader.load(self.profile) with printer('Uploading "%s"', self.name): yield self.storage.write('profiles', self.name, profile, PROFILES_TAGS)
def execute(self): runlist = CocaineConfigReader.load(self.runlist) log.info('Uploading "%s"... ', self.name) yield self.storage.write('runlists', self.name, runlist, RUNLISTS_TAGS) log.info('OK')
def execute(self): with printer('Loading profile'): profile = CocaineConfigReader.load(self.profile) with printer('Uploading "%s"', self.name): yield upload_profile(self.storage, self.name, profile)
def execute(self): log.info('Uploading "%s"... ', self.name) profile = CocaineConfigReader.load(self.profile) yield self.storage.write('profiles', self.name, profile, PROFILES_TAGS) log.info('OK')
def __init__(self, storage, name, content): super(Create, self).__init__(storage, 'group', name) self.content = CocaineConfigReader.load(content, validate=validate_routing_group)
def test_config_reader(): CocaineConfigReader.load(os.path.join(os.path.abspath(os.path.dirname(__file__)), "fixtures/simple_app/manifest.json"))
def execute(self): runlist = CocaineConfigReader.load(self.runlist) with printer('Uploading "%s"', self.name): yield self.storage.write('runlists', self.name, runlist, RUNLISTS_TAGS)