Skip to content

Instantly share code, notes, and snippets.

View wbclark's full-sized avatar

William Bradford Clark wbclark

View GitHub Profile
Katello::ContentViewEnvironment.all.each do |cve|
ForemanTasks.async_task(
Actions::Candlepin::Environment::SetContent,
cve.content_view,
cve.owner,
cve,
)
end
@wbclark
wbclark / clear_smart_proxy_sync_histories.rb
Created June 28, 2022 23:06
Clear smart_proxy_sync_histories for repositories for repositories on Red Hat Satellite, by passing a list of repository IDs
# This script clears the smart_proxy_sync_history for a set of repositories on Satellite, from a list of repository IDs.
#
# This is useful when you want to guarantee these repositories are synchronized on Capsules (with the Library environment) on the
# next 'Optimized' sync that is run, without having to run a full 'Complete' sync of the Capsule.
#
# The only required input is a list (Ruby Array) of repository_ids, on the first non-comment line below this documentation.
# Edit this Array of repository_ids to match the repository IDs that should be eligible for the next optimized syncs.
#
# For example, if I have the following repositories on Satellite:
#
@wbclark
wbclark / entitlement_status.sh
Created September 4, 2020 20:47
Host entitlement status
#!/bin/bash
echo '
myHost = Host.find_by_name("myhost.example.com")
Katello::Candlepin::Consumer.new(myHost.subscription_facet.uuid, myHost.organization.label).entitlement_status
' | foreman-rake console
#!/bin/bash
echo "Importing Subscription Pools from Candlepin to Katello (what is displayed on the WebUI)."
echo '
namespace :katello do
task :import_subscriptions => ["environment"] do
User.current = User.anonymous_api_admin
puts _("Importing Subscriptions")
Katello::Subscription.import_all
#!/bin/bash
echo "Importing Subscription Pools from Candlepin."
echo '
namespace :katello do
task :import_subscriptions => ["environment"] do
User.current = User.anonymous_api_admin
puts _("Importing Subscriptions")
Katello::Subscription.import_all