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
johnpmitsch / has_many_association.rb
Created Oct 30, 2019
Debug audit assocation issue in rails
View has_many_association.rb
# Context: https://bugzilla.redhat.com/show_bug.cgi?id=1613391
# 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
begin
records.each(&:destroy!)
rescue => e
logger = Logger.new('/tmp/rails.log')
logger.info(self.owner)
@johnpmitsch
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 centos7-katello-devel-stable.box -d "A stable katello devel environment created with packer" --version-description "nightly publish" --release --short-description "stable katello devel box"
@johnpmitsch
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
johnpmitsch / h.md
Last active Oct 11, 2019
Foreman - create a host for development purposes
View h.md

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 example.com
  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
johnpmitsch / a.md
Last active Sep 16, 2019
Satellite ngReact JS error
View a.md

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.
http://errors.angularjs.org/1.5.5/$injector/nomod?p0=react
@johnpmitsch
johnpmitsch / notes.md
Last active Oct 19, 2019
Bradfield Networking class notes
View notes.md

Networking class

Class 1

Browser example and basic networking

  • Typing www.wikipedia.com 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
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
johnpmitsch / gist.md
Created Sep 4, 2019
Collecting dynflow errors from Katello dev box
View gist.md

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

Tracebacks

  • 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
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 https://github.com/theforeman/foreman.git
cd ~ && git clone https://github.com/Katello/katello.git
echo "gemspec :path => '../katello', :development_group => 'katello_dev', :name => 'katello'" >> ~/foreman/bundler.d/katello.rb
# install system dependencies and gems
rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@johnpmitsch
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 https://deb.nodesource.com/setup_6.x | sudo bash -
sudo apt-get install nodejs=6.14.4-1nodesource1
cd ~ && git clone https://github.com/theforeman/foreman.git
cd ~ && git clone https://github.com/Katello/katello.git
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.