Skip to content

Instantly share code, notes, and snippets.

View ekohl's full-sized avatar

Ewoud Kohl van Wijngaarden ekohl

View GitHub Profile
#!/usr/bin/env python3
import os
from github import Github
TO_CLEAN = (
'https://prprocessor.theforeman.org',
'https://notify.travis-ci.org',
'https://ossistant-inecas.rhcloud.com',
@ekohl
ekohl / rubocop-fixer
Created December 29, 2022 12:42
A script to fix things in rubocop_todo.yml
#!/bin/bash
set -e
set -x
bundle exec rubocop --auto-gen-config --no-auto-gen-timestamp --no-offense-counts
TODO=$(~/.local/bin/yq -r '. | keys[]' .rubocop_todo.yml | grep -vE 'Layout/LineLength|Lint/UriEscapeUnescape|Naming/MethodParameterName|Layout/DefEndAlignment|Layout/IndentationConsistency')
echo > .rubocop_todo.yml
if [[ -n "$(git status --porcelain)" ]] ; then
git commit -m '[TMP] clean Rubocop TODO' .rubocop_todo.yml
@ekohl
ekohl / plugins.json
Created October 14, 2022 17:19
Foreman Plugins
[
{
"url": "https://github.com/ATIX-AG/foreman_acd",
"last_commit": "2022-09-26T06:28:14"
},
{
"url": "https://github.com/ATIX-AG/foreman_scc_manager",
"last_commit": "2022-09-21T08:20:46"
},
{
#!/bin/bash -e
# Intended as a proof of concept to see if we can purge the NPM cache in npm2rpm
cd "$1"
package="$(basename $(realpath .))"
spectool --get-files "${package}.spec"
@ekohl
ekohl / network.py
Last active November 9, 2023 15:40
Libvirt with domain and resolvectl
#!/usr/bin/env python3
# https://www.libvirt.org/hooks.html#network
# Place this as /etc/libvirt/hooks/network
import logging
import sys
from argparse import ArgumentParser
from subprocess import CalledProcessError, check_output
@ekohl
ekohl / pick.py
Created October 13, 2021 12:57
Foreman Cherry Pick tool
#!/usr/bin/python3
from argparse import ArgumentParser
from collections import defaultdict
from itertools import chain
from redminelib import Redmine
def get_picks(project_id, query_id):
redmine = Redmine('https://projects.theforeman.org')
@ekohl
ekohl / check_puppet_dependencies.rb
Created April 2, 2021 10:27
A script to check Puppet dependencies based on semantic_puppet
#!/usr/bin/env ruby
require 'puppet_metadata'
require 'semantic_puppet'
def normalize_name(name)
name.tr('-', '/')
end
class LocalModules < SemanticPuppet::Dependency::Source
#!/usr/bin/env ruby
require 'yaml'
filenames = ARGV
filenames.each do |filename|
msync = YAML.safe_load(File.read(filename)).reject{ |k,v| k == '.travis.yml' }
if msync.any?
File.write(filename, YAML.dump(msync))
else
@ekohl
ekohl / Rakefile
Created November 22, 2020 20:53
Rakefile to deploy Puppet environment
require 'rake/clean'
require 'puppet/modulebuilder'
# Set defaults for the deployment step
DEFAULT_SERVER='puppet.example.com'
DEFAULT_DIRECTORY="/etc/puppetlabs/code/environments/production"
# What to copy
MODULE_DIRS = ['modules']
FILES_TO_COPY = FileList['environment.conf', 'hiera.yaml', 'data/**/*.yaml']
@ekohl
ekohl / README.md
Last active August 11, 2020 00:31
Explode Hiera

This script explodes Hiera. That means it reads a hiera config inside a module and converts all possible paths into the various interpolated parts.

The goal is to provide a possible solution to puppetlabs/puppet-strings#250.

Example output from puppet-openvmtools:

# Files

data/Debian.Debian.7.yaml