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 test_read_archive(): readArchive(os.path.join(os.path.abspath(os.path.dirname(__file__)), "fixtures/simple_app/manifest.json"))