Skip to content

Instantly share code, notes, and snippets.

@adamruzicka
Created June 9, 2021 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamruzicka/3a4681f488e5978c7bd49e544f1ce124 to your computer and use it in GitHub Desktop.
Save adamruzicka/3a4681f488e5978c7bd49e544f1ce124 to your computer and use it in GitHub Desktop.
BZ1877917 reproducer
TASKS_ROOT=/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-4.1.1
cd $TASKS_ROOT
if [ ! -d .git ]; then
echo "Setting up new git repository"
git init .
git add .
git commit -m 'rpm'
git tag rpm
else
echo "Resetting git repository to rpm tag"
git reset --hard rpm
fi
echo
echo "Patching sources"
cat <<EOF >app/lib/actions/bz_1877917_reproducer.rb
class BZ1877917Reproducer < Dynflow::Action
def run(event = nil)
output[:counter] ||= (input[:count] || 100).to_i
if output[:counter] > 0
output[:counter] -= 1
plan_event(output[:counter])
suspend
else
raise "Halt"
end
end
end
EOF
echo
echo "Stopping dynflow-sidekiq services"
systemctl restart foreman 'dynflow-sidekiq@*'
echo
echo 'Start a "old-style" dynflow executor with foreman-rake dynflow:executor'
echo 'In another terminal run the following command in foreman-rake console:'
echo 'ForemanTasks.sync_task(BZ1877917Reproducer, :count => 100)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment