Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
@jlsherrill
jlsherrill / gist:e570c257494c41cb28b8
Created March 20, 2015 17:54
apply puppet modules locally
puppet apply --noop --modulepath=./modules "class { 'proxy_arp': }
@jlsherrill
jlsherrill / qpid-stat.md
Last active September 28, 2018 14:01
qpid-stat
qpid-stat --ssl-certificate /etc/pki/katello/certs/java-client.crt --ssl-key /etc/pki/katello/private/java-client.key -b "amqps://$(hostname -f):5671" -q

qpid-stat --ssl-certificate /etc/pki/katello/certs/java-client.crt --ssl-key /etc/pki/katello/private/java-client.key -b "amqps://$(hostname -f):5671" -c

@jlsherrill
jlsherrill / gist:b726468444d5372bbf78
Last active September 28, 2018 13:59
Errata debugging
6.0/2.0
> foreman-rake console
> User.current = User.first
check to make sure we know which repos the system is using (this is sent by katello-agent)
> Katello::System.where(:name => 'hp-dl580g5-01.rhts.eng.bos.redhat.com').first.bound_yum_repos
Ask pulp directly what errata it thinks are applicable
@jlsherrill
jlsherrill / regen_applicability.md
Last active September 28, 2018 14:00
Regenerating Applicability

This will force applicability regeneration for all systems:

# mongodb pulp_database
 
 db.repo_profile_applicability.drop()
 quit()
@jlsherrill
jlsherrill / upload_enabled_repos.py
Created April 22, 2015 14:13
initiate enabled repos upload
#!/bin/env python
import sys
sys.path.append('/usr/lib/gofer/plugins/')
import katelloplugin
katelloplugin.validate_registration()
katelloplugin.send_enabled_report()
@jlsherrill
jlsherrill / deleted_puppet_envs.md
Last active February 24, 2020 20:30
recover from deleted puppet environments

when publishing a content view if you get:

Validation failed: Puppet environment can't be blank

or

ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
@jlsherrill
jlsherrill / repair_repos.rake
Last active August 29, 2015 14:21
RemoveAllRepos
namespace :katello do
PULP_IDS_FILE = "/tmp/foreman_pulp_ids_to_fix"
def find_ids_not_in_pulp
(Katello::Repository.pluck(:pulp_id))-
Katello.pulp_server.extensions.repository.retrieve_all.map {|repo| repo["id"] }
end
def repository_info(repo)
%{
name: #{repo.name}
@jlsherrill
jlsherrill / action_not_allowed_def_capsule.md
Created June 9, 2015 01:49
debugging action not allowed for default capsule

In katello 2.0/Satellite 6.0:

foreman-rake console

 SmartProxy.all.map do |sp|
   { 
   :name => sp.name,
 :envs => sp.lifecycle_environments.pluck(:name),
@jlsherrill
jlsherrill / activation_keys_hostgroup.md
Last active August 29, 2015 14:23
Using activation keys with hostgroups for kickstarting that have no content view/lifecycle env

Go to Hosts > provisioning templates and find the "subscription_manager_registration" template. You'll need to clone the snippet in order to edit it, you can do that from the actions button on the right of the template list. We'll name our clone "custom_registration".

Katello 2.1/2.2 & Satellite 6.1

Once you clone it, find this line:

subscription-manager register --org="<%= @host.rhsm_organization_label %>" --name="<%= @host.name %>" --activationkey="<%= @host.params['kt_activation_keys'] %>"

and change it to:

@jlsherrill
jlsherrill / gist:4477bc310601ad6ba5aa
Last active August 29, 2015 14:23
clearing pulp incremental distributor publish
# mongo
> use pulp_database
> db.repo_distributors.update({repo_id: '<repo_id>'}, {$set: {"last_publish": null}}, {"multi": true})
replacing <repo_id> with the pulp repo_id.
Then follow this step to re-publish the repo:
https://gist.github.com/jlsherrill/c5916a1c2b04bf58b54e