Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
def Print print
return print.size
end
def _Print print
return print.chr
end
def _print *print
return Print([print]) << Print(print)
@jlsherrill
jlsherrill / gist:26eeca53f66879a3dc66
Created January 7, 2015 18:46
Removing a distribution for a repo
yum install pulp-admin-client pulp-rpm-admin-extensions
# edit /etc/pulp/admin/admin.conf and change:
host = localhost.localdomain
# to
host = myhost.domain.com
# and change
@jlsherrill
jlsherrill / gist:66842924e4248900ef77
Last active August 29, 2015 14:13
Fixing clean_backend_objects

find the file:

/opt/rh/ruby193/root/usr/share/gems/gems/katello-2.0.0/lib/katello/tasks/clean_backend_objects.rake

###1. on line 13 change:

system.facts to

@jlsherrill
jlsherrill / export_tasks.rake
Last active August 29, 2015 14:13
export tasks
# Drop this file in /usr/share/foreman/lib/tasks
# and then run "foreman-rake export_tasks"
# To export all tasks "foreman-rake export_tasks tasks=all"
desc 'Export Dynflow Tasks'
task :export_tasks => :environment do
class TaskRender
def initialize
@cache = {}
diff --git a/app/models/host/managed.rb b/app/models/host/managed.rb
index b2a718b..117c306 100644
--- a/app/models/host/managed.rb
+++ b/app/models/host/managed.rb
@@ -121,7 +121,7 @@ class Host::Managed < Host::Base
scope :for_vm, lambda { |cr,vm| where(:compute_resource_id => cr.id, :uuid => Array.wrap(vm).compact.map(&:ide
# audit the changes to this model
- audited :except => [:last_report, :puppet_status, :last_compile], :allow_mass_assignment => true
+ audited :except => [:last_report, :puppet_status, :last_compile, :primary_interface], :allow_mass_assignment =

Go into the rails console:

# foreman-rake console

Then run the following:

 Katello::Distribution.search{ filter :terms, :repoids => Katello::ContentView.find(5).repositories_to_publish.pluck(:pulp_id); size 100 }.as_json
if $operatingsystemrelease =~ /^6.*/ {
Puppet::Type.type(:service).provide :service_wait, :parent => :redhat do
desc "Manages services using `service-wait` command."
commands :service => File.expand_path("../../../../../bin/service-wait", __FILE__)
defaultfor :osfamily => [:redhat]
def self.specificity
super + 10000
@jlsherrill
jlsherrill / dynflowissue.md
Last active August 29, 2015 14:15
weird dynflow issue
1.9.3-p448 :004 > ForemanTasks::Task.find('a326a604-e63b-4ff0-8634-e890c406963b')
  ForemanTasks::Task Load (0.3ms)  SELECT "foreman_tasks_tasks".* FROM "foreman_tasks_tasks" WHERE "foreman_tasks_tasks"."id" = $1 LIMIT 1  [["id", "a326a604-e63b-4ff0-8634-e890c406963b"]]
+-------------------+--------------------+-------------------+-------------------+----------+---------+---------+-------------------+----------------+
| id                | type               | label             | started_at        | ended_at | state   | result  | external_id       | parent_task_id |
+-------------------+--------------------+-------------------+-------------------+----------+---------+---------+-------------------+----------------+
| a326a604-e63b-... | ForemanTasks::T... | Actions::Katel... | 2015-02-16 21:... |          | planned | pending | 5e72e68b-0e49-... |                |
+-------------------+--------------------+-------------------+-------------------+----------+---------+---------+-------------------+------------
@jlsherrill
jlsherrill / bulk_task_searching.md
Created February 16, 2015 18:35
Bulk task searching

POST /foreman_tasks/api/tasks/bulk_search

{
  "searches" : [   
    { 
      "type": "all",
      "resource_type": "Organization", 
 "resource_id": 1,
@jlsherrill
jlsherrill / pulp_fix.md
Last active August 29, 2015 14:15
Pulp fix for long titles (epel 7)