Skip to content

Instantly share code, notes, and snippets.

View GregSutcliffe's full-sized avatar

Greg "Gwmngilfen" Sutcliffe GregSutcliffe

  • Red Hat
  • Scotland
View GitHub Profile
curl --user "redacted" 'http://projects.theforeman.org/issues.json?status_id=closed&project_id=6&release_id=189|210'|json_reformat
...
{
"id": 14023,
"project": {
"id": 6,
"name": "Installer"
},
"tracker": {
"id": 1,
" NeoVim Config
" Useful for debugging Vundle errors
" set shell=bash
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.config/nvim/bundle/Vundle.vim
" call vundle#begin()
# These facts don't update pkg database (apt-get update, pacman -Sy, etc)
# Make sure that part is handled by cron, as it can take a while
# Archlinux
Facter.add('pkg_updates') do
confine :operatingsystem => 'Archlinux'
setcode do
Facter::Core::Execution.exec('/usr/bin/pacman -Qu|/usr/bin/wc -l')
end
end
@GregSutcliffe
GregSutcliffe / keybase.md
Created August 26, 2016 14:38
keybase.md

Keybase proof

I hereby claim:

  • I am gregsutcliffe on github.
  • I am gwmngilfen (https://keybase.io/gwmngilfen) on keybase.
  • I have a public key ASAwYGoMLwQT6pgI_N4FtnfJgkotw1Oxv5UF7xq2gjT6Uwo

To claim this, I am signing this object:

$foo=foreman({
'item' => 'puppetclasses',
'search' => 'host = host.example.org',
'foreman_url' => 'https://foreman.example.org',
'foreman_user' => 'admin',
'foreman_pass' => 'changeme',
})
notify { 'test-classes':
message => inline_template("<%=@foo['results'].keys.inspect%>")
@GregSutcliffe
GregSutcliffe / db:seeds.d:99-local-seed.rb
Last active February 29, 2016 10:51
Foreman Dev Seeds - replace : with / in the filenames to get the paths, use rake db:seed to use
# This file just loads all my local seeds from local-seeds.d in much the same
# way as the main seed loader.
unless ENV['NOLOCAL'] == 'true'
local_seeds = Dir.glob(Rails.root + 'db/seeds.d/local-seeds.d/*.rb')
local_seeds = local_seeds.sort do |a, b|
a.split('/').last <=> b.split('/').last
end
# These facts don't update pkg database (apt-get update, pacman -Sy, etc)
# Make sure that executing it is handled by cron, as it can take a while
# Archlinux
Facter.add('pkg_updates') do
confine :operatingsystem => 'Archlinux'
setcode do
Facter::Core::Execution.exec('/usr/bin/pacman -Qu|/usr/bin/wc -l')
end
end
@GregSutcliffe
GregSutcliffe / new-host
Created March 10, 2015 10:03
New-host script for hammer - use it like "./new-host wheezy"
#!/bin/bash
# Script to create a new host quickly
cd ~/github/hammer-cli
case $1 in
# Some shortcuts
list)
bundle exec bin/hammer host list
FactoryGirl.define do
factory :discovered_host, class: 'Host::Discovered' do
sequence(:name) { |n| "host#{n}" }
sequence(:ip) { |n| IPAddr.new(n, Socket::AF_INET).to_s }
sequence(:mac) { |n| "02:23:45:67:" + n.to_s(16).rjust(4, '0').insert(2, ':') }
end
end
diff --git a/app/services/foreman_bootdisk/iso_generator.rb b/app/services/foreman_bootdisk/iso_generator.rb
index b0d3780..e5c3dbd 100644
--- a/app/services/foreman_bootdisk/iso_generator.rb
+++ b/app/services/foreman_bootdisk/iso_generator.rb
@@ -47,6 +47,7 @@ class ForemanBootdisk::ISOGenerator
raise ::Foreman::Exception.new(N_("Please ensure the ipxe-bootimgs and syslinux packages are installed."))
end
FileUtils.cp(File.join(Setting[:bootdisk_syslinux_dir], 'isolinux.bin'), File.join(wd, 'build', 'isolinux.bin'))
+ FileUtils.cp(File.join(Setting[:bootdisk_syslinux_dir], 'ldlinux.c32'), File.join(wd, 'build', 'ldlinux.c32'))
File.open(File.join(wd, 'build', 'isolinux.cfg'), 'w') do |file|