Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active February 28, 2019 15:24
Show Gist options
  • Save jlsherrill/78884fb933e06e26b8e6 to your computer and use it in GitHub Desktop.
Save jlsherrill/78884fb933e06e26b8e6 to your computer and use it in GitHub Desktop.
clearing ListenOnCandlepin Events

Shut down foreman-tasks:

  service foreman-tasks stop

Open the rails console:

foreman-rake console

and run:

ForemanTasks::Task.where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all
exit

start foreman-tasks:

service foreman-tasks start
@johnpmitsch
Copy link

I have used this many times, so many thanks for posting this! 😀

@snecklifter
Copy link

Hello,

Thanks for this. Can I suggest a slight modification:

ForemanTasks::Task.where(:state => :paused).where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all

which will prevent destruction of task history.

@MartijntenHeuvel
Copy link

Thanks for this, use it more then one would like to admit..

@jgkootstra
Copy link

jgkootstra commented May 5, 2018

Just a little update for RHEL 7 and CENTOS 7, this original poster has done a great job.

RHEL 6 / CENTOS 6:

Shut down foreman-tasks:

service foreman-tasks stop

Open the rails console:
foreman-rake console

and run:

ForemanTasks::Task.where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all
 exit

start foreman-tasks:
` service foreman-tasks start

RHEL 7 / CENTOS 7:

Shut down foreman-tasks:
systemctl stop foreman-tasks

Open the rails console:
foreman-rake console

and run:

ForemanTasks::Task.where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all
 exit

start foreman-tasks:
systemctl start foreman-tasks

@jgkootstra
Copy link

jgkootstra commented Feb 28, 2019

For those of us that like a batch mode approach

combining my and @sneckfilter's contribution and some other input

RHEL7/CentOS7

stop foreman tasks:
systemctl stop foreman-tasks

destroy paused tasks:

foreman-rake console <<< 'ForemanTasks::Task.where(:state => :paused).where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all' 

start foreman tasks:
systemctl start foreman-tasks

RHEL6/CentOS6

stop foreman tasks:
service foreman-tasks stop

destroy paused tasks:

foreman-rake console <<< 'ForemanTasks::Task.where(:state => :paused).where(:label => 'Actions::Candlepin::ListenOnCandlepinEvents').destroy_all'

start foreman tasks:
service foreman-tasks stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment