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
class PingdomClient | |
class << self | |
def load_httparty | |
require 'httparty' | |
self.send(:include, HTTParty) | |
self.class_eval do | |
self.base_uri = 'https://api.pingdom.com/api/2.0' | |
end | |
end | |
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
unless(Chef::Provider::Deploy.instance_methods.map(&:to_sym).include?(:copy_command)) | |
Chef::Log.info '** Patching deploy resource copy method to use rsync **' | |
class Chef::Provider::Deploy | |
def copy_cached_repo | |
target_dir_path = @new_resource.deploy_to + "/releases" | |
converge_by("deploy from repo to #{@target_dir_path} ") do | |
FileUtils.mkdir_p(target_dir_path) | |
run_command(:command => "rsync -a --exclude '.git*' #{::File.join(@new_resource.destination, ".")}/ #{release_path}" | |
Chef::Log.info "#{@new_resource} copied the cached checkout to #{release_path}" | |
release_created(release_path) |
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
pitti = resources(:apt_repository => 'pitti-postgresql-ppa') | |
pitti.run_action(:add) | |
if(pitti.updated_by_last_action?) | |
execute('pitti apt-get update'){ command 'apt-get update' }.run_action(:run) | |
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
module KnifeConfigHack | |
def hacked_parse_options(*args) | |
configure_chef | |
configure_from_file_settings! | |
original_parse_options(*args) | |
end | |
def configure_from_file_settings! | |
if(Chef::Config[:knife]) | |
self.class.options.keys.each do |key| | |
config[key] = Chef::Config[:knife][key] if Chef::Config[:knife].has_key?(key) |
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
#!/bin/bash | |
# | |
# template script for generating CentOS container for LXC | |
# | |
# | |
# lxc: linux Container library | |
# Authors: |
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
(setq ruby-deep-indent-paren nil) | |
(defadvice ruby-indent-line (after unindent-closing-paren activate) | |
(let ((column (current-column)) | |
indent offset) | |
(save-excursion | |
(back-to-indentation) | |
(let ((state (syntax-ppss))) | |
(setq offset (- column (current-column))) | |
(when (and (eq (char-after) ?\)) | |
(not (zerop (car state)))) |
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
def to_hash_recursive(hash_thing) | |
new = {} | |
hash_thing.each do |k,v| | |
new[k] = v.kind_of?(Hash) ? to_hash(v) : v | |
end | |
new | |
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
1.9.3-p327 :004 > resource = Chef::Util::AttributeStruct.new | |
=> #<Chef::Util::AttributeStruct> | |
1.9.3-p327 :005 > resource.interfaces('eth0') do | |
1.9.3-p327 :006 > ipaddress '192.168.0.1' | |
1.9.3-p327 :007?> gateway '192.168.0.1' | |
1.9.3-p327 :008?> netmask '255.255.255.0' | |
1.9.3-p327 :009?> enabled true | |
1.9.3-p327 :010?> end | |
=> #<Chef::Util::AttributeStruct eth0=#<Chef::Util::AttributeStruct ipaddress="192.168.0.1", gateway="192.168.0.1", netmask="255.255.255.0", enabled=true>> | |
1.9.3-p327 :011 > resource.name 'pow' |
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 'chef' | |
require 'chef/knife' | |
require 'getoptlong' | |
def print_help | |
puts "#{File.basename(__FILE__)} OPTS" | |
puts ' --> Help is on a help yourself basis.' | |
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
Package: * | |
Pin: release c=9.2 | |
Pin-Priority: 1000 | |
Package: * | |
Pin: release n=precise-pgdg, v=9.2 | |
Pin-Priority: 600 |
OlderNewer