Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View caryp's full-sized avatar

caryp

View GitHub Profile
config.vm.provision :chef_zero do |chef|
chef.verbose_logging = true
chef.environment = "vagrant"
chef.cookbooks_path = "cookbooks"
chef.environments_path = "environments"
chef.data_bags_path = "data_bags"
chef.roles_path = "roles"
chef.nodes_path = "nodes"
@caryp
caryp / gist:3836421
Created October 4, 2012 21:00
Use jiffies and clock independent from hypervisor
# Use jiffies and clock independent from hypervisor is recommended by Citrix: http://support.citrix.com/article/CTX128034
echo "jiffies" > /sys/devices/system/clocksource/clocksource0/current_clocksource
[ -d /proc/sys/xen ] && echo 1 > /proc/sys/xen/independent_wallclock
@caryp
caryp / tftpserver
Created September 19, 2012 04:59
This script is for controlling OSX v5.7.4 tftpserver
#!/bin/bash -e
# This script is for controlling OSX v5.7.4 tftpserver
case "$1" in
'start')
launchctl load -F /System/Library/LaunchDaemons/tftp.plist
launchctl start com.apple.tftpd
echo "tftpserver started..."
;;
@caryp
caryp / gist:943447
Created April 27, 2011 00:05
right_rackspace .blank? workaround
# monkey patch: right_rackspace currently depends on rails .blank? method.
class Object
def blank?
respond_to?(:empty?) ? empty? : !self
end
end
@caryp
caryp / My Servers Widget
Created March 10, 2011 06:38
RightScale Dashboard Widget in Liquid markup
{% if servers == empty %}
<div style="text-align:center;padding:20px">-no matching servers-</div>
{% else %}
{% counter total_count = 0 %}
{% assign my_table_contents = "" %}
{% for s in servers %}
{% increment total_count %}
{% capture my_server_table_contents %}
{{ my_server_table_contents }}
<tr>
attribute "pet/favorite",
:display_name => "Favorite Pet",
:description => "Choose either dog, cat, or monkey",
:options => ["dog", "cat", "monkey"],
:type => "select_one"
:default => "monkey"
def determine_node_name
run_ohai
unless @safe_name && @node_name
@node_name ||= @ohai[:fqdn] ? @ohai[:fqdn] : @ohai[:hostname]
@safe_name = @node_name.gsub(/\./, '_')
end
@node_name
end
diff --git a/agents/lib/instance/executable_sequence.rb b/agents/lib/instance/executable_sequence.rb
index bc511b0..ebb88bd 100644
--- a/agents/lib/instance/executable_sequence.rb
+++ b/agents/lib/instance/executable_sequence.rb
@@ -152,7 +152,7 @@ module RightScale
when :git
ssh_cmd = ssh_command(repo)
"#{ssh_cmd} git clone --quiet --depth 1 #{repo.url} #{cookbook_dir} 2>&1" +
- (repo.tag ? " && cd #{cookbook_dir} && #{ssh_cmd} git pull 2>&1 && git checkout #{repo.tag} 2>&1 && cd -" : '')
+ (repo.tag ? " && cd #{cookbook_dir} && #{ssh_cmd} git pull 2>&1 && git checkout -b #{repo.tag} origin/#{repo.tag} 2>&1 && cd -" : '')
my_action "example dynamic interface call" do
definition node[:foo][:impl]
out_dir "#{node[:foo][:out_dir]}"
end
my_action "example interface call" do
definition :my_bar2_action
out_dir "#{node[:foo][:out_dir]}"
end