def disable_repos(org, prod_id, repo_set_id, info, channel_label)
repo = lookup_entity_in_cache(
:redhat_repositories,
{
'content_id' => repo_set_id,
'organization' => {'label' => org['label']}
})
unless repo
error "Unknown repository (#{channel_label} equivalent) to disable."
return
end
info "Disabling #{info['url']} for channel #{channel_label} in org #{org['id']}"
begin
unless option_dry_run?
rc = api_call(
:repository_sets,
:disable,
'product_id' => prod_id,
'id' => repo_set_id,
'basearch' => info['arch'],
'releasever' => info['version'])
unmap_entity(:redhat_repositories, rc['input']['repository']['id'])
get_cache(:redhat_repositories).delete(rc['input']['repository']['id'])
return rc['input']['repository']
end
rescue RestClient::Exception => e
if e.http_code == 404
error '...no such repository to disable.'
else
error "...unknown error #{e.http_code}, #{e.message} - skipping."
end
end
end