Skip to content

Instantly share code, notes, and snippets.

View jbd's full-sized avatar

Jean-Baptiste Denis jbd

View GitHub Profile
@jbd
jbd / gist:974757
Created May 16, 2011 16:16
Couchdbkit and unicode
#!/usr/bin/env python
# -*- coding: utf8 -*-
# couchdbkit.__version__ '0.5.4'
# restkit.__version__ '3.2.3'
# couchdb - Apache CouchDB '1.0.2'
import couchdbkit
import restkit
@jbd
jbd / cf-agent.output
Created May 16, 2012 10:05
Policy example for readstringarray
$ /usr/local/sbin/cf-agent -KI -f ./test_readstringarray.cf
R: $(array_name[grouptest])
R: $(array_name[80,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311])
R: $(array_name[36,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567])
R: $(array_name[92,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,815,816,817,818,819,820,821,822,823])
@jbd
jbd / power_officeblade.template
Created July 17, 2012 16:29
Cobbler template file for supermicro officeblade chassis
#if $power_mode == "on"
#set operation = "up"
#else
#set operation = "down"
#end if
cd /etc/SMCIPMITool/ && java -jar /etc/SMCIPMITool/SMCIPMITool.jar "$power_address" "$power_user" "$power_pass" blade $power_id power "$operation" && cd -
@jbd
jbd / fence_smcipmitool
Created July 19, 2012 08:47
Quick'n dirty supermicro smcipmitool fence agent
#!/usr/bin/python
# The Following Agent Has Been Tested On:
#
# Virsh 0.3.3 on RHEL 5.2 with xen-3.0.3-51
#
import sys
import os
import subprocess
@jbd
jbd / example.cf
Created July 19, 2012 22:33
CFEngine whitespace policy
body common control
{
bundlesequence => { example };
inputs => { "cfengine_stdlib.cf" };
}
bundle agent example
{
files:
"/tmp/myfile"
@jbd
jbd / edit_line_verbose_output
Created July 24, 2012 16:52
edit_line bundle verbose output
cf3> CFEngine - autonomous configuration engine - commence self-diagnostic prelude
cf3> ------------------------------------------------------------------------
cf3> Work directory is /var/cfengine
cf3> Looking for a source of entropy in /var/cfengine/randseed
cf3> Making sure that locks are private...
cf3> Checking integrity of the state database
cf3> Checking integrity of the module directory
cf3> Checking integrity of the PKI directory
cf3> -> Loaded private key /var/cfengine/ppkeys/localhost.priv
cf3> -> Loaded public key /var/cfengine/ppkeys/localhost.pub
@jbd
jbd / gist:3182848
Created July 26, 2012 15:50
Trying to find the best way to append a file at the end of the other
body common control
{
bundlesequence => { "biginsert" };
inputs => { "cfengine_stdlib.cf" };
}
body agent control
{
editfilesize => "1M";
}
@jbd
jbd / gist:3437351
Created August 23, 2012 14:49
Iteration problem in cfengine
body common control
{
bundlesequence => { busers };
}
bundle agent busers
{
vars:
"musers[root][gecos]" string => "System administrator";
"musers[root][uid]" string => "0";
@jbd
jbd / cfagent-verbose.output
Created August 28, 2012 09:44
Why imyarray is empty ?
cf3> CFEngine - autonomous configuration engine - commence self-diagnostic prelude
cf3> ------------------------------------------------------------------------
cf3> Work directory is /var/cfengine
cf3> Looking for a source of entropy in /var/cfengine/randseed
cf3> Making sure that locks are private...
cf3> Checking integrity of the state database
cf3> Checking integrity of the module directory
cf3> Checking integrity of the PKI directory
cf3> -> Loaded private key /var/cfengine/ppkeys/localhost.priv
cf3> -> Loaded public key /var/cfengine/ppkeys/localhost.pub
@jbd
jbd / gist:3898953
Created October 16, 2012 12:26
gmond python module for tracking Open Grid Scheduler queue state
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of