Skip to content

Instantly share code, notes, and snippets.

View jlsherrill's full-sized avatar

Justin Sherrill jlsherrill

View GitHub Profile
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 / remove_key.md
Last active September 28, 2018 14:01
Removing an activation key

Go into the console:

# foreman-rake console

and then run:

User.current = User.first
key = Katello::ActivationKey.find(99999)
@jlsherrill
jlsherrill / update_paused_tasks.md
Last active September 28, 2018 14:01
Update paused tasks

Destroy

 ForemanTasks::Task.where(:state => :paused).where(:label => "Actions::Katello::Repository::Sync").destroy_all

Force stop:

ForemanTasks::Task.where(:state => 'paused').all.each{|t| t.update_attributes!(:state => 'stopped') }
@jlsherrill
jlsherrill / repos_in_pulp.md
Last active September 28, 2018 14:01
Repositories in pulp, not in katello

To see the list of repo ids in pulp that are not in katello:

# foreman-rake console

> User.current = User.anonymous_admin
> Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)

To remove said repositories

> (Katello.pulp_server.resources.repository.retrieve_all.map{|i| i['id']} - Katello::Repository.pluck(:pulp_id) - Katello::ContentViewPuppetEnvironment.pluck(:pulp_id)).each{|pulp_id| Katello.pulp_server.resources.repository.delete(pulp_id)}
@jlsherrill
jlsherrill / Remove-pulp-tasks 2.4.md
Created February 12, 2015 20:31
Remove pulp tasks

To remove the finished pulp tasks:

# mongo
> use pulp_database
> db.task_status.remove({state:"finished"})
> quit()
@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)

Keybase proof

I hereby claim:

  • I am jlsherrill on github.
  • I am jlsherrill (https://keybase.io/jlsherrill) on keybase.
  • I have a public key whose fingerprint is B564 A656 C946 09B9 03A1 B2C2 D041 9DEF 5E85 2EC7

To claim this, I am signing this object:

@jlsherrill
jlsherrill / ListenOnCandlepin.md
Last active February 28, 2019 15:24
clearing ListenOnCandlepin Events

Shut down foreman-tasks:

  service foreman-tasks stop

Open the rails console:

foreman-rake console