This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from sys import * | |
import os | |
import re | |
## Variables | |
# Which parameter to use for the resource's title for each nagios define type | |
# NOTE: If you use the name_map dictionary, the values in the name_map dictionary | |
# should be used in the values for the title_parameters dictionary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'facter' | |
if Facter.value('kernel') == 'Darwin' | |
# First grab the serial number. For some reason I can't get it from Facter | |
sn = %x{ioreg -l | grep IOPlatformSerialNumber | sed -e s/\\"//g}.chomp.split{"="}[-1].chomp | |
url = "https://selfsolve.apple.com/Warranty.do?serialNumber=#{sn}&country=USA&fullCountryName=United%20States" | |
# Next fetch warranty information from Apple, convert the resulting json to a hash | |
warranty_info = eval %x{curl -k -s "#{url}"}.split(',').each { |element| | |
element.sub! ':', ' => ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'facter' | |
require 'facter/util/plist/parser' | |
completed = File.exists? '/private/var/db/.TimeMachine.Results.plist' | |
Facter.add("timemachine_volume") do | |
confine :kernel => "Darwin" | |
setcode do | |
%x{defaults read /Library/Preferences/com.apple.TimeMachine LocalizedDiskImageVolumeName}.chomp | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hostclass :externalresources do | |
scope_h = scope.to_hash.reject { |k,v| !( k.is_a?(String) && v.is_a?(String) ) } | |
scope_h.keys.each do |var| | |
if scope_h[var][0].chr == '{' | |
begin | |
#Convert the variable from a string to a hash | |
var_h = eval scope_h[var] | |
rescue => e | |
notice "Couldn't convert variable #{var} to hash: #{e}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case $site { | |
'1': { | |
@lifter { | |
"lifter1": | |
param1 => 'my param', | |
param2 => 'my other param'; | |
"lifter2": | |
param1 => 'my param', | |
param2 => 'my other param'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{toc} | |
h1. <%= type.name %> | |
<%= type.doc.gsub(/[{\[\]}]/) { |s| '\\' + s } %> | |
h2. Parameters | |
<% type.parameters.each do |param| %> | |
* <%= param %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'xmlrpc/client' | |
# A useful helper for running Confluence XML-RPC from Ruby. Takes care of | |
# adding the token to each method call (so you can call server.getSpaces() | |
# instead of server.getSpaces(token)). Also takes care of re-logging in | |
# if your login times out. | |
# | |
# Usage: | |
# | |
# server = Confluence::Server.new :server => 'http://confluence02.lightningsoure.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Puppet::Type.type(:sampletype).provide(:default) do | |
def self.instances | |
@instances ||= get_instances | |
@instances | |
end | |
def prefetch | |
instances.each do |instance| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'puppet/indirector/face' | |
require 'puppet/patch' | |
Puppet::Indirector::Face.define(:patch, '0.0.1') do | |
copyright "Puppet Labs", 2011 | |
license "Apache 2 license; see COPYING" | |
summary "View and manage patch levels on a node." | |
description <<-'EOT' | |
This subcommand interacts with package objects, using the default provider. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'puppet' | |
require 'puppet/face' | |
require 'puppet/cloudpack' | |
options = { | |
:image => 'ami-3d76b754', | |
:type => 'm1.large', |
OlderNewer