This file contains 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
default { | |
execute 'SendDTMF', '1111', '100' | |
} |
This file contains 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
7/29/10 11:38:44 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Unknown option: `-l' | |
7/29/10 11:38:44 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. | |
7/29/10 11:41:54 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Unknown option: `-l' | |
7/29/10 11:41:54 PM [0x0-0x8c08c].com.topfunky.PeepOpen[2672] Usage: tcsh [ -bcdefilmnqstvVxX ] [ argument ... ]. |
This file contains 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
module BundlerSupport | |
def bundler_dependencies(options = {}) | |
root = options.delete(:root) | |
# WARNING: This is highly Bundler 0.9 -specific | |
YAML::load_file(File.join(root, 'Gemfile.lock'))['specs'].each do |spec| | |
gem_name = spec.keys.first | |
dependent_recipe = "#{gem_name.gsub(/-/, '_')}_gem_dependencies".to_sym | |
if method_defined?(dependent_recipe) |
This file contains 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
# Provide a :rails_env fact | |
Facter.add(:rails_env) do | |
setcode do | |
ENV["RAILS_ENV"] || 'production' | |
end | |
end | |
# Your application manifest | |
class ApplicationManifest < Moonshine::Manifest | |
# Let us use non-symbol keys in the moonshine.yml |
This file contains 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
exec { 'first': | |
command => '/usr/bin/true', | |
unless => '/bin/test -f ./mark.txt' | |
} | |
exec { 'second': | |
command => '/usr/bin/false', | |
subscribe => Exec['first'], | |
refreshonly => true | |
} |
This file contains 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
# A mechanism for shadow_puppet to install source packages | |
module Moonshine | |
module SourcePackage | |
def source_package(name, options = {}) | |
build_root = options[:build_root] || '/usr/src' | |
dist_root = options[:dist_root] || File.join(build_root, 'dist') | |
url = options[:url] | |
filename = options[:filename] || File.basename(url) | |
expanded_directory = options[:expanded_directory] || filename[/^(.+)\.(tar|tgz|tbz)/, 1] | |
expanded_root = options[:expanded_root] || File.join(build_root, expanded_directory) |
This file contains 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
# estimate the duration of an ALTER TABLE statement in mysql | |
# this code estimates the worst case, as most of the time, an ALTER will result in a table that is smaller than the original | |
percentage = 0 | |
interval = 10 | |
while(true) do | |
sleep(interval) | |
new_percentage = (File.size('#sql-5316_1a.ibd').to_f / File.size('moves.ibd').to_f) | |
change = new_percentage - percentage | |
intervals = 1.0/change |
This file contains 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
def Facter.case(name, whens) | |
if whens[:default].is_a?(Exception) | |
default = proc { raise whens[:default] } | |
elsif whens[:default].is_a?(Proc) | |
default = whens[:default] | |
elsif whens[:default] | |
default = proc { whens[:default] } | |
else | |
default = proc { |value| raise "Unsupported case for '#{name}': #{value}" } | |
end |
This file contains 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
class ApplicationManifest < Moonshine::Manifest | |
def ntp | |
package 'ntp', :ensure => :latest | |
case Facter.lsbdistid | |
when 'Ubuntu' | |
service 'ntp', :alias => 'ntp', :ensure => :running, | |
:require => package('ntp'), :pattern => 'ntpd' | |
when 'Fedora', 'RedHat' | |
service 'ntpd', :alias => 'ntp', :ensure => :running, |
This file contains 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
::Capistrano::Command.class_eval do | |
def replace_placeholders(command, channel) | |
command = command.dup | |
command.gsub!(/\$CAPISTRANO:HOST\$/, channel[:host]) | |
command.gsub!(/\$CAPISTRANO:ROLES\$/, channel[:server].roles.join(',')) | |
command | |
end | |
end | |
::Capistrano::ServerDefinition.class_eval do |