Skip to content

Instantly share code, notes, and snippets.

🙃

Stephen Benjamin stbenjam

🙃
Block or report user

Report or block stbenjam

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:2aa8f31bc869231d5f18
/etc/salt/master:
external_auth:
pam:
saltuser:
- '@runner'
rest_cherrypy:
port: 9191
View gist:40942ca0cf7104d3f23f
#!/usr/bin/env ruby
# This is the external nodes script to allow Salt to retrieve info about a host
# from Foreman. It also uploads a node's grains to Foreman, if the setting is
# enabled.
require 'yaml'
$settings_file = '/etc/salt/foreman.yaml'
SETTINGS = YAML.load_file($settings_file)
View gist:226f6939e981f1bca156
log {
module: DEFAULT
enable: debug+
timestamp: true
output: /var/log/qdrouterd.log
}
View gist:c55ff6cbd3354d79d88d
echo 'ForemanTasks::Task.where(:label => "Actions::Candlepin::ListenOnCandlepinEvents", :state => "running").map { |task| task.update_column(:state, "stopped") }' | foreman-rake console
View reconnect-capsules.console
User.current = User.anonymous_admin
SmartProxy.all.each do |proxy|
content_host = ::Katello::System.where(:name => proxy.name).order("created_at DESC").first
if content_host
proxy.content_host_id = content_host.id
proxy.save!
puts "Capsule #{proxy} has Content Host #{content_host}"
else
View reconnect_capsule.rake
namespace :katello do
task :reconnect_capsule do
User.current = User.anonymous_admin
SmartProxy.all.each do |proxy|
content_host = ::Katello::System.where(:name => proxy.name).order("created_at DESC").first
if content_host
proxy.content_host_id = content_host.id
proxy.save!
View gist:01ad182dbb96bd226a1e
cat <<EOF > /root/freeipa.txt
FreeIPA debug info:
Parameter: <%= @host.info['parameters']['realm'] %>
OTP: <%= @host.otp %>
Realm: <%= @host.realm %>
Realm Type: <%= @host.realm.realm_type %>
EOF
@stbenjam
stbenjam / gist:7a3d7668f37613ecab72
Last active Aug 29, 2015
Fix upload salt-reports
View gist:7a3d7668f37613ecab72
1. Edit /usr/sbin/upload-salt-reports
2. On line 55 change the {} to [] so it looks like this:
def run(function, argument=[]):
3. On Line 65 change return ret to this:
return ret['data'] if 'data' in ret else ret
4. Run upload-salt-reports by hand and see that it's uploading reports again
View gist:8c4e3e5a31887533b2e2
In usr/share/foreman/vendor/ruby/1.9.1/gems/foreman_salt-2.0.2/app/services/foreman_salt/report_importer.rb:
Change this line:
time[:total] = time.values.inject(&:+)
To this:
time[:total] = time.values.compact.inject(&:+)
View gist:30868e675d0eeae8d337
#!/usr/bin/env python
import json
import os
import sys
import salt.config
import salt.runner
if __name__ == '__main__':
__opts__ = salt.config.master_config(
You can’t perform that action at this time.