def test_installed_content_db_match_names(galaxy_context): icd = installed_content_item_db.InstalledContentItemDatabase( galaxy_context) match_filter = matchers.MatchLabels(['foo.bar']) for x in icd.select(content_match_filter=match_filter): log.debug('x: %s', x)
def info_repository_specs(galaxy_context, api, repository_spec_strings, display_callback=None, offline=None): online = not offline display_callback = display_callback or display.display_callback offline = offline or False irdb = installed_repository_db.InstalledRepositoryDatabase(galaxy_context) labels_to_match = [] all_labels_to_match = [] for repository_spec_string in repository_spec_strings: galaxy_namespace, repository_name, content_name = parse_repository_name( repository_spec_string) log.debug('showing info for repository spec: %s', repository_spec_string) repository_name = repository_name or content_name if online: remote_data = api.lookup_repo_by_name(galaxy_namespace, repository_name) if remote_data: display_callback(_repr_remote_repo(remote_data)) label_to_match = '%s.%s' % (galaxy_namespace, repository_name) all_labels_to_match.append(label_to_match) labels_to_match.append(label_to_match) matcher = matchers.MatchRepositorySpec( [label_and_spec[1] for label_and_spec in labels_to_match]) matcher = matchers.MatchLabels(labels_to_match) matched_repositories = irdb.select(repository_spec_match_filter=matcher) remote_data = False matched_labels = [] for matched_repository in matched_repositories: display_callback(_repr_installed_repository(matched_repository)) matched_labels.append(matched_repository.repository_spec.label) unmatched_labels = set(all_labels_to_match).difference(set(matched_labels)) if unmatched_labels: display_callback('These repositories were not found:') for unmatched_label in sorted(unmatched_labels): display_callback(_repr_unmatched_label(unmatched_label)) return
def execute_remove(self): """ Remove a list of collections from the local system. """ if len(self.args) == 0: raise cli_exceptions.CliOptionsError('- you must specify at least one collection to remove.') galaxy_context = self._get_galaxy_context(self.options, self.config) if self.args: match_filter = matchers.MatchLabels(self.args) return remove.remove(galaxy_context, repository_spec_match_filter=match_filter, display_callback=self.display)
def test_installed_repository_db_match_names(galaxy_context): icdb = installed_repository_db.InstalledRepositoryDatabase(galaxy_context) match_filter = matchers.MatchLabels(['foo.bar']) for x in icdb.select(match_filter): log.debug('x: %s', x)