Skip to content

Instantly share code, notes, and snippets.

John Mitsch johnpmitsch

  • Red Hat
  • Norwalk, CT
Block or report user

Report or block johnpmitsch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
johnpmitsch / has_many_association.rb
Created Oct 30, 2019
Debug audit assocation issue in rails
View has_many_association.rb
# Context:
# Update activerecord-5.2.1/lib/active_record/associations/has_many_association.rb on line 105 to log which association is causing issues
def delete_records(records, method)
if method == :destroy
rescue => e
logger ='/tmp/rails.log')
johnpmitsch / gist:b16060b99c33a548631ce37cf50eb589
Created Oct 18, 2019
vagrant cloud publish box with date as version command
View gist:b16060b99c33a548631ce37cf50eb589
vagrant cloud publish katello/katello-devel $(date '+%Y.%m%d.%H%M') libvirt -d "A stable katello devel environment created with packer" --version-description "nightly publish" --release --short-description "stable katello devel box"
johnpmitsch / hammer_concurrent.rb
Last active Oct 16, 2019
hammer concurrent requests on centos7-hammer-devel box
View hammer_concurrent.rb
#!/usr/bin/env ruby
# This will send concurrent hammer requests from a centos7-hammer-devel box. Update the commands below to alter the request
require 'net/http'
hammer="BUNDLE_GEMFILE=~/hammer-cli-foreman/Gemfile bundle exec hammer"
# create base command
base_command = "repository info "
johnpmitsch /
Last active Oct 11, 2019
Foreman - create a host for development purposes

A quick and dirty way to create a host for development purposes

  1. Create operating system if none exist, for example CentOS 7.5
  2. Create a domain
  3. Set up Host parameters here
  4. Set up Operating System params h
  5. Set up an interface with fake MAC address and use the example domain h
johnpmitsch /
Last active Sep 16, 2019
Satellite ngReact JS error

Cloned Satellite 6.6 seeing this error on any bastion page:

Error: [$injector:modulerr] Failed to instantiate module Bastion.content-views.versions due to:
Error: [$injector:modulerr] Failed to instantiate module Bastion.errata due to:
Error: [$injector:modulerr] Failed to instantiate module Bastion.dates due to:
Error: [$injector:modulerr] Failed to instantiate module react due to:
Error: [$injector:nomod] Module 'react' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.$injector/nomod?p0=react
johnpmitsch /
Last active Oct 19, 2019
Bradfield Networking class notes

Networking class

Class 1

Browser example and basic networking

  • Typing in the browser
  • We need DNS server for domain to ip address mapping
  • Before that, we can use DHCP (which does a number of things). DHCP can ask the ISP provider for a DNS server to use
    • DHCP
    • can also provide Static IP address
johnpmitsch / gist:f3bd094d5a7afc82887bd8554303cc7c
Last active Sep 10, 2019
Repository disable bug explanation
View gist:f3bd094d5a7afc82887bd8554303cc7c

With dynflow actions, the disable repository tasks are run concurrently, and there are race conditions. I used the following to debug:

diff --git a/app/lib/actions/candlepin/environment/set_content.rb b/app/lib/actions/candlepin/environment/set_content.rb
index e78fcd7..87659ba 100644
--- a/app/lib/actions/candlepin/environment/set_content.rb
+++ b/app/lib/actions/candlepin/environment/set_content.rb
@@ -12,7 +12,9 @@ module Actions
         def finalize
           content_view = ::Katello::ContentView.find(input[:content_view_id])
johnpmitsch /
Created Sep 4, 2019
Collecting dynflow errors from Katello dev box

Seeing dynflow/foreman-task errors and strange behavior on the dev box. Using this gist to collect the errrors. Not sure what is related, but documenting everything here.

Odd Behaviors:

  • Tasks stuck in "planning" state


  • Seeing this one on a fresh box while enabling and disabling RH repos
2019-09-04T18:01:58 [E|dyn|f45e65f7] invalid state transition pending >> planned in #<Dynflow::ExecutionPlan:0x00007f8b1a229848> (RuntimeError)
johnpmitsch / gist:d792ba46d4169744eb3f02114490d321
Last active Aug 30, 2019
centos container setup katello circleci
View gist:d792ba46d4169744eb3f02114490d321
# Run container
docker run -u 0 -e RAILS_ENV=production -p 8080:8080 -it centos/ruby-25-centos7 /bin/bash
# clone repos
cd ~ && git clone
cd ~ && git clone
echo "gemspec :path => '../katello', :development_group => 'katello_dev', :name => 'katello'" >> ~/foreman/bundler.d/katello.rb
# install system dependencies and gems
rpm -i
johnpmitsch / gist:fc2ed21982450a1b6f602be1da3def75
Last active Aug 26, 2019
ruby/nodejs debian circleci container setup
View gist:fc2ed21982450a1b6f602be1da3def75
sudo apt-get install curl software-properties-common
curl -sL | sudo bash -
sudo apt-get install nodejs=6.14.4-1nodesource1
cd ~ && git clone
cd ~ && git clone
echo "gemspec :path => '../katello', :development_group => 'katello_dev', :name => 'katello'" >> ~/foreman/bundler.d/katello.rb
sudo apt-get install software-properties-common
sudo add-apt-repository -y -e ppa:qpid/released
sudo sed -i 's/eoan/bionic/' /etc/apt/sources.list.d/qpid-ubuntu-released-eoan.list
sudo sed -i 's/^deb /# deb /' /etc/apt/sources.list.d/qpid-ubuntu-released-eoan.list
You can’t perform that action at this time.