Skip to content

Instantly share code, notes, and snippets.

  1. Install Ruby Development RPMs
# yum -y install ruby193-scldevel.x86_64  ruby193-rubygems-devel.noarch ruby193-ruby-devel.x86_64  gcc cpp
  1. Install profiling gems
# scl enable ruby193 bash
desc 'Create an Organization Administrator Role for each Organization defined'
task :create_org_admins => :environment do
puts "Creating Roles for every Organization with all Permissions except Organization and Role objects."
puts ""
orgs = Organization.all
for o in orgs
role_name = "Org Admin - #{o.name}"
puts " ** Creating ROLE: #{role_name}"
r = Role.new(:name => role_name)
#!/bin/bash
i="0"
while [ $i -lt 1000 ]
do
subscription-manager clean
subscription-manager register --activation-key=test-key --force
i=$[$i+1]
done
namespace :katello do
task :bulk_resume => ["environment"] do
User.current = User.anonymous_admin
tasks = ForemanTasks::Task.where(:state => :paused).where(:label => "Actions::Katello::System::GenerateApplicability")
puts "Found [#{tasks.length}] tasks that are Paused. Resuming!"
resumed = []
failed = []
skipped = []
tasks.each do |task|
if task.resumable?
katello-service stop
service tomcat stop
su - postgres -c "dropdb candlepin && createdb candlepin"
su - postgres -c "pg_restore -d candlepin candlepin.dump"
service tomcat start
katello-service start
namespace :katello do
task :duplicate_content_hosts => ["environment"] do
User.current = User.first
dup_systems = Katello::System.select(:name).group(:name).having("count(*) > 1")
systems = dup_systems.map {|sys| ::Katello::System.where(:name => sys.name)}
bad_systems = systems.map { |sys_list| sys_list - [sys_list.max_by(&:created)] }
systems_to_purge = bad_systems.flatten
puts "--- Content Host UUIDs for Dupliate Hosts ---\n\n", systems_to_purge.map(&:uuid).join("\n"), "\n"
end
end
== Server HOTFIX instructions ==
1) Edit /etc/foreman/plugins/katello.yaml, update rest_client_timeout to 3600
2) Save file
3) katello-service restart
If katello-installer --upgrade is re-run you will need to re-apply this configuration change.
== Client HOTFIX Instructions ==
Common subdirectories: 266/gofer-2.6.6/bin and 267/gofer-2.6.7/bin
Common subdirectories: 266/gofer-2.6.6/docs and 267/gofer-2.6.7/docs
Common subdirectories: 266/gofer-2.6.6/etc and 267/gofer-2.6.7/etc
diff -uw 266/gofer-2.6.6/.gitignore 267/gofer-2.6.7/.gitignore
--- 266/gofer-2.6.6/.gitignore 2015-09-25 12:26:29.000000000 -0700
+++ 267/gofer-2.6.7/.gitignore 2015-11-20 13:31:37.000000000 -0800
@@ -1,5 +1,6 @@
*svn*
*.pyc
+*.pyo
# From your terminal
$ foreman-rake console
# Paste below commands
User.current = User.first
owners = JSON.parse(Katello::Resources::Candlepin::Owner.get(Katello::Resources::Candlepin::Owner.path)).map {|owner| owner["key"]}
Organization.pluck(:label) - owners
@mccun934
mccun934 / kt-dbrestore.bash
Last active March 22, 2022 19:07
quick DB restore
## You probably shouldn't run this!
foreman-maintain service stop
systemctl start mongod
systemctl start postgresql
su - postgres -c "dropdb candlepin && createdb candlepin"
su - postgres -c "dropdb foreman && createdb foreman"
mongo pulp_database --eval "db.dropDatabase()"
mongorestore --db pulp_database --host localhost /backup/mongo_dump/pulp_database/
su - postgres -c "pg_restore --disable-triggers -v -d candlepin /backup/candlepin.dump"