Skip to content

Instantly share code, notes, and snippets.

View johnpmitsch's full-sized avatar

John Mitsch johnpmitsch

View GitHub Profile
@johnpmitsch
johnpmitsch / smoker.txt
Created December 11, 2019 16:50
Foreman smoker install and run on centos8
# Spin up centos8 box
sudo yum install -y epel-release
yum install -y --nogpgcheck python3 git chromedriver chromium
git clone https://github.com/theforeman/smoker
cd smoker
pip3 install -r requirements.txt
add box to /etc/hosts
pytest --driver Chrome --base-url https://centos7-katello-nightly.jomitsch.example.com
@johnpmitsch
johnpmitsch / has_many_association.rb
Created October 30, 2019 18:25
Debug audit assocation issue in rails
# 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 October 18, 2019 14:14
vagrant cloud publish box with date as version command
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 October 16, 2019 18:05
hammer concurrent requests on centos7-hammer-devel box
#!/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 October 11, 2019 17:41
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 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 September 16, 2019 21:23
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.
http://errors.angularjs.org/1.5.5/$injector/nomod?p0=react
@johnpmitsch
johnpmitsch / notes.md
Last active October 19, 2019 00:59
Bradfield Networking class notes

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 September 10, 2019 20:55
Repository disable bug explanation

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 September 4, 2019 18:06
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

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 # (RuntimeError)
@johnpmitsch
johnpmitsch / gist:d792ba46d4169744eb3f02114490d321
Last active August 30, 2019 17:21
centos container setup katello circleci
# 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