def update_tags(repo_id, tarfile_path): """ Gets the current scratchpad's tags and updates them with the tags contained in the tarfile. :param repo_id: unique ID of a repository :type repo_id: basestring :param tarfile_path: full path to a tarfile that is the product of "docker save" :type tarfile_path: basestring """ new_tags = tarutils.get_tags(tarfile_path) tags.update_tags(repo_id, new_tags)
def process_main(self, item=None): """ Pull the metadata out of the tar file :param item: Not used by this Step :type item: None """ # retrieve metadata from the tarball metadata = tarutils.get_metadata(self.parent.file_path) # turn that metadata into a collection of models mask_id = self.get_config().get(constants.CONFIG_KEY_MASK_ID) self.parent.metadata = metadata self.parent.available_units = self.get_models(metadata, mask_id) self.parent.v1_tags = tarutils.get_tags(self.parent.file_path)
def update_tags(repo_id, tarfile_path): """ Gets the current scratchpad's tags and updates them with the tags contained in the tarfile. :param repo_id: unique ID of a repository :type repo_id: basestring :param tarfile_path: full path to a tarfile that is the product of "docker save" :type tarfile_path: basestring """ repo_manager = factory.repo_manager() new_tags = tarutils.get_tags(tarfile_path) scratchpad = repo_manager.get_repo_scratchpad(repo_id) tags = generate_updated_tags(scratchpad, new_tags) repo_manager.update_repo_scratchpad(repo_id, {'tags': tags})
def test_normal(self): tags = tarutils.get_tags(busybox_tar_path) self.assertEqual(tags, {'latest': busybox_ids[0]})