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
<command> | |
<ident value="only_if"> | |
<pos line="38" column="2"/> | |
</ident> | |
<args_add_block value="false"> | |
<args_add> | |
<args_new/> | |
<string_literal> | |
<string_add> | |
<string_add> |
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
execute "generate_csr" do | |
user "root" | |
cwd "/tmp/" | |
command "<snip>" | |
only_if {!File.exists?(foo) || (File.exists?(bar) && File.mtime(baz) < last_changedate)} | |
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
rule "ETSY004", "Execute resource defined without conditional or action :nothing" do | |
tags %w{correctness recipe etsy} | |
recipe do |ast| | |
pres = find_resources(ast, :type => 'execute').find_all do |cmd| | |
not_if = (resource_attribute(cmd, 'not_if') || "").to_s | |
only_if = (resource_attribute(cmd, 'only_if') || "").to_s | |
creates = (resource_attribute(cmd, 'creates') || "").to_s | |
action = creates = (resource_attribute(cmd, 'action') || "") | |
(not_if.empty? && only_if.empty? && creates.empty?) | |
end.map{|cmd| match(cmd)} |
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
require 'chef/knife' | |
module KnifeSpork | |
class Testy < Chef::Knife | |
banner "knife test" | |
def run | |
@response = ui.ask_question("What is your name?") |
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
r = gem_package "sys-proctable" do | |
action :nothing | |
end | |
r2 = gem_package "sys-filesystem" do | |
action :nothing | |
end | |
r.run_action(:install) | |
r2.run_action(:install) |
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
require 'sinatra/base' | |
class CacheHelper | |
module Sinatra | |
module Helpers | |
def cache(name, options = {}, &block) | |
if cache = read_fragment(name, options) | |
@_out_buf << cache | |
else | |
pos = @_out_buf.length |
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
{ | |
"name": "Base", | |
"description": "Base Role!", | |
"json_class": "Chef::Role", | |
"default_attributes": { | |
}, | |
"override_attributes": { | |
"ganglia": { | |
"mcast_addr": "1.2.3.4", | |
"cluster_name": "foo" |
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
bash -c ' | |
cd ~/Desktop | |
curl -O http://joncowie.local/xcode.tar.gz | |
tar -zxf xcode.tar.gz | |
installer -pkg ~/Desktop/Install\ Xcode.app/Contents/Resources/Xcode.mpkg -target "/" |
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
require 'rubygems' if RUBY_VERSION < "1.9" | |
require 'sinatra/base' | |
require 'Haml' | |
require 'chef' | |
require './chefhelper.rb' | |
class OpsTool < Sinatra::Base | |
def nodes | |
@helper ||= ChefHelper.new |
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
require 'rubygems' if RUBY_VERSION < "1.9" | |
require 'sinatra/base' | |
require 'Haml' | |
require 'chef' | |
require './chefhelper.rb' | |
class OpsTool < Sinatra::Base | |
@helper = ChefHelper.new | |
@nodes = @helper.get_nodes |