Skip to content

Instantly share code, notes, and snippets.

def report
rows = []
Organization.all.each do |org|
org.kt_environments.each do |env|
env.content_view_versions.not_ignorable.each do |cvv|
nvra = Katello::Rpm.latest(::Katello::Rpm.where(name: "kernel", id: cvv.packages)).first&.nvra
if nvra
rows << { organization: org.title,
lifecycle_environment: env.label,
version: cvv.name,
diff --git a/app/tasks/export.py b/app/tasks/export.py
index 5ad7931..5e1baf6 100644
--- a/app/tasks/export.py
+++ b/app/tasks/export.py
@@ -4,13 +4,11 @@ import logging
import os
import subprocess
import tarfile
-
from distutils.util import strtobool
reset
cd ~/foreman
rm log/*
./node_modules/.bin/webpack-dev-server-without-h2 --config config/webpack.config.js --host 0.0.0.0 --disable-host-check=true $WEBPACK_OPTS --watch-poll 1000 &
DISABLE_SPRING=1 BIND=0.0.0.0 bundle exec rails server -b 0.0.0.0
100.times { |count| ::Katello::HostTracer.create!(application: "foo-#{count}", helper: "systemctl restart foo-#{count}",
app_type: ["session", "static", "daemon"][count % 3], host_id: 2)}
@parthaa
parthaa / purl.sh
Last active January 20, 2023 19:47
#!/bin/bash
curl --cert /home/vagrant/foreman-certs/client_cert.pem --key /home/vagrant/foreman-certs/client_key.pem https://`hostname`/$*
def interested_hostgroups
Hostgroup.where(id: Katello::Hostgroup::ContentFacet.where(content_source_id: nil, kickstart_repository_id: nil, content_view_id: nil, lifecycle_environment_id: nil).select(:hostgroup_id))
end
def pick_facet_values(hg)
facet_values = {}
hg.audits.reverse.each do |audit|
hg_changes = audit.audited_changes.slice("lifecycle_environment_id", "kickstart_repository_id", "content_view_id", "content_source_id")
facet_values = hg_changes.merge(facet_values)
end
HAMMER_KATELLO_PATH="${HAMMER_KATELLO_PATH:-/home/vagrant/git/hammer-cli-katello}"
pushd .
rm /var/log/hammer/*
FILES=$(find $HAMMER_KATELLO_PATH/test -type f -path "**/*$1*test.rb"|tr '\n' ' ')
cd $HAMMER_KATELLO_PATH
RAKE_PATH=`bundle show rake`
set -x
for fl in $FILES; do
bundle exec ruby -I"lib:lib" -I"$RAKE_PATH/lib" "$RAKE_PATH/lib/rake/rake_test_loader.rb" "test/functional/repository/delete_test.rb" $fl
done
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
IMPORT_ORG="import-$RANDOM"
PRODUCT="prod"
REPO1="katello"
REPO2="misc"
REPO3="candlepin"
#!/bin/bash
shopt -s expand_aliases
set -e
set -x
EXPORT_ORG="export-$RANDOM"
PRODUCT="prod"
REPO1="katello"
REPO1_URL="https://fedorapeople.org/groups/katello/releases/yum/3.8/katello/el7/x86_64/"
REPO2="misc"
REPO2_URL="https://fixtures.pulpproject.org/rpm-with-modules/"
#!/bin/env python
import json
import requests
import sys
from requests.auth import HTTPBasicAuth
from pprint import pprint
def fetch_metadata(fl):
with open(fl, "r") as content:
data = json.load(content)