Skip to content

Instantly share code, notes, and snippets.

@jturel
jturel / partha-cv-autopublish-concurrent.sh
Last active January 23, 2026 16:52
partha-cv-autopublish-ten-async
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
COMPONENT_COUNT=3
ORG="org-$RANDOM"
PRODUCT="test_product"
@jturel
jturel / partha-cv-auto-publish.sh
Created January 20, 2026 01:36
CV auto publish testing
#!/bin/bash
shopt -s expand_aliases
#alias hammer='BUNDLE_GEMFILE=~/git/hammer-cli-katello/Gemfile bundle exec hammer'
set -e
set -x
ORG="org-$RANDOM"
PRODUCT="test_product"
hammer organization create --name=$ORG
@jturel
jturel / foreman_plugin_registry_loading.md
Created May 18, 2025 20:03
Foreman Plugin Registry Loading

Observations

One

(Some/all?) plugins call Foreman::Plugin.register in a reloader.to_prepare callback which could imply a few things:

  • this needs to happen on app startup
  • this needs to happen on code reload
  • this involves application code

Two

Plugin registration is not consistent across plugins. Katello calls Foreman::Plugin.register via a required file which won't be executed again on reload!. REX and Foreman Tasks do invoke register on dev code reload and that's why reload! is broken.

@jturel
jturel / setup_iss.sh
Created October 27, 2021 14:24
ISS setup script
#!/bin/bash
set -x
HAMMER_USER=admin
HAMMER_PASSWORD=changeme
DEFAULT_ORG=Default_Organization
ISS_ORG=ISS
ISS_CA=ISS_CA
ISS_TOKEN=ISS_TOKEN
ISS_SERVER=$(hostname)
class MemoryEndpoint
def call(env)
time_str = Time.now.strftime('%Y-%m-%d_%H-%M-%S')
File.open("/tmp/dump-#{Process.pid}-#{time_str}.json", 'w') do |file|
dump_memory(file)
end
[200, { 'Content-Type' => 'text/plain' }, ["Dumped Memory #{Process.pid}"]]
end
private
function extract_request_id(str) {
reqidIdx = match(str, /[a-z0-9]{8}/)
return substr(str, reqidIdx, 8)
}
BEGIN {
}
/Processing by/ {
{
@jturel
jturel / test_pr_in_production.md
Last active July 23, 2021 17:23
Testing PRs in a production environment

Two options

  1. Add the github or gitlab repo as a remote and cherry-pick the PR on top. Good for large PRs with multiple commits that you may wish to apply independently or omit completely.
  2. Use curl to download the patch file from the PR. Good for small PRs!

Steps

Find the katello source code location and cd into it:

diff --git a/lib/katello/tasks/pulp3_migration.rake b/lib/katello/tasks/pulp3_migration.rake
index 2106b38..d5645b9 100644
--- a/lib/katello/tasks/pulp3_migration.rake
+++ b/lib/katello/tasks/pulp3_migration.rake
@@ -1,6 +1,9 @@
namespace :katello do
desc "Runs a Pulp 2 to 3 Content Migration for supported types. May be run multiple times. Use wait=false to immediately return with a task url."
- task :pulp3_migration => ["dynflow:client", "check_ping"] do
+ task :pulp3_migration => ["dynflow:client"] do
+ Thread.current[:check_ping_services] = [:candlepin, :foreman_tasks, :pulp3, :pulp, :pulp_auth]
@jturel
jturel / gist:317e9f892fb19e84480880f1f674e74e
Last active February 11, 2022 16:21
SubscriptionFacetPools
# create a new organization $MYORG
org = Organization.find_by_name($MYORG)
hosts = []
50000.times { hosts << { name: SecureRandom.uuid, organization_id: org.id } }
host_ids = ::Host::Managed.import(hosts, validate: false).ids
facets = host_ids.map { |id| { host_id: id } }
facet_ids = Katello::Host::SubscriptionFacet.import(facets, validate: false).ids
@jturel
jturel / tracer_benchmark.rb
Created March 26, 2020 02:44
Tracer benchmark
require 'faraday'
require 'json'
require 'securerandom'