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
% trafficserver> show:cache-stats | |
Bytes Used --- 0 GB | |
Cache Size --- 9 GB | |
--RAM Cache-- | |
Total Bytes -- 10737418240 | |
Bytes Used --- 0 | |
Hits --------- 0 | |
Misses ------- 0 | |
--Lookups-- |
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
<args_add_block value="false"> | |
<args_add> | |
<args_add> | |
<args_new/> | |
<symbol_literal> | |
<symbol> | |
<ident value="restart"> | |
<pos line="12" column="12"/> | |
</ident> | |
</symbol> |
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 "ETSY005", "Action :restart sent to a core service" do | |
tags %w{correctness recipe etsy} | |
recipe do |ast, filename| | |
res = ast.xpath('//command[ident/@value = "notifies"]/args_add_block[descendant::symbol/ident/@value="restart"]/descendant::method_add_arg[fcall/ident/@value="resources"]/descendant::assoc_new[symbol/ident/@value="service"]/descendant::tstring_content') | |
res.each do |notifies| | |
if notifies.attribute('value').to_s.include?('nscd') | |
[match(res)] | |
end | |
end | |
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
<opt> | |
<stmts_add> | |
<stmts_add> | |
<stmts_new/> | |
<method_add_block> | |
<command> | |
<ident value="service"> | |
<pos line="1" column="0"/> | |
</ident> | |
<args_add_block value="false"> |
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] pry(#<FoodCritic::RuleDsl>)> resource_attributes(cmd) | |
=> {:name=>"/etc/nscd.conf", | |
"backup"=>"", | |
"source"=>"nscd.conf", | |
"owner"=>"root", | |
"group"=>"root", | |
"mode"=>"", | |
"notifies"=>:restart} |
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) |
NewerOlder