Skip to content

Instantly share code, notes, and snippets.

@jturel
jturel / gist:dc9e405cb0930e429cf7ce7e76ff238d
Created August 2, 2019 18:03
generate and import a manifest into local candlepin
in the console:
# find library environment of default org
environment_id = Katello::ContentViewEnvironment.first.cp_id
# create the consumer in the environment
consumer = Katello::Resources::Candlepin::Consumer.create(environment_id, {name: "you-will-export-me", type: {"label": "candlepin"}}, [])
# export the consumer's manifest to a .zip
data = Katello::Resources::Candlepin::CandlepinResource.get("/candlepin/consumers/#{consumer['uuid']}/export")
@jturel
jturel / gist:c001c0548cfe64a5b9950711752cdf7f
Last active February 5, 2020 19:53
Generate Swagger definitions
mkdir -p /tmp/apidoc
chown foreman:foreman /tmp/apidoc
foreman-rake apipie:static_swagger_json OUT=/tmp/apidoc

results in:

[root@sat]# ll /tmp/apidoc
total 27712
ln -s `ls -d /tmp/systemd-private-*httpd*/tmp/passenger*` /tmp/
scl enable tfm-ror52 passenger-status
@jturel
jturel / gist:bc0d428b473ed5d6adfb8adc08408184
Last active January 17, 2020 16:50
katello artemis broker.xml
<?xml version='1.0' encoding="UTF-8"?>
<!--
Copyright (c) 2009 - 2018 Red Hat, Inc.
This software is licensed to you under the GNU General Public License,
version 2 (GPLv2). There is NO WARRANTY for this software, express or
implied, including the implied warranties of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
along with this software; if not, see
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
@jturel
jturel / broker.xml
Last active March 22, 2020 19:20
katello candlepin broker.xml
<?xml version='1.0' encoding="UTF-8"?>
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<acceptors>
@jturel
jturel / tracer_benchmark.rb
Created March 26, 2020 02:44
Tracer benchmark
require 'faraday'
require 'json'
require 'securerandom'
@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
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 / 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:

function extract_request_id(str) {
reqidIdx = match(str, /[a-z0-9]{8}/)
return substr(str, reqidIdx, 8)
}
BEGIN {
}
/Processing by/ {
{