chef 0.9.0.rc02 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/chef/handler.rb +6 -0
- data/lib/chef/knife.rb +3 -1
- data/lib/chef/knife/client_create.rb +10 -2
- data/lib/chef/knife/client_delete.rb +9 -1
- data/lib/chef/knife/client_edit.rb +10 -2
- data/lib/chef/knife/client_reregister.rb +10 -2
- data/lib/chef/knife/client_show.rb +10 -2
- data/lib/chef/knife/configure_client.rb +50 -0
- data/lib/chef/knife/cookbook_show.rb +4 -0
- data/lib/chef/knife/cookbook_site_vendor.rb +10 -3
- data/lib/chef/knife/cookbook_test.rb +13 -34
- data/lib/chef/knife/cookbook_upload.rb +18 -1
- data/lib/chef/knife/data_bag_create.rb +22 -7
- data/lib/chef/knife/data_bag_delete.rb +5 -1
- data/lib/chef/knife/node_create.rb +10 -2
- data/lib/chef/knife/node_delete.rb +9 -1
- data/lib/chef/knife/node_edit.rb +9 -1
- data/lib/chef/knife/node_show.rb +9 -1
- data/lib/chef/knife/role_create.rb +10 -2
- data/lib/chef/knife/role_delete.rb +9 -1
- data/lib/chef/knife/role_edit.rb +9 -1
- data/lib/chef/knife/role_show.rb +9 -1
- data/lib/chef/mixin/recipe_definition_dsl_core.rb +1 -0
- data/lib/chef/resource.rb +18 -6
- data/lib/chef/version.rb +1 -1
- metadata +24 -9
data/lib/chef/handler.rb
CHANGED
@@ -36,6 +36,12 @@ class Chef
|
|
36
36
|
# The time the chef run ended
|
37
37
|
def_delegator :@run_status, :end_time
|
38
38
|
|
39
|
+
##
|
40
|
+
# :method: elapsed_time
|
41
|
+
#
|
42
|
+
# The time elapsed between the start and finish of the chef run
|
43
|
+
def_delegator :@run_status, :elapsed_time
|
44
|
+
|
39
45
|
##
|
40
46
|
# :method: run_context
|
41
47
|
#
|
data/lib/chef/knife.rb
CHANGED
@@ -195,7 +195,9 @@ class Chef
|
|
195
195
|
config[:attribute].split(".").each do |attr|
|
196
196
|
if data.respond_to?(:[])
|
197
197
|
data = data[attr]
|
198
|
-
|
198
|
+
elsif data.nil?
|
199
|
+
nil # don't get no method error on nil
|
200
|
+
else data.respond_to?(attr.to_sym)
|
199
201
|
data = data.send(attr.to_sym)
|
200
202
|
end
|
201
203
|
end
|
@@ -37,9 +37,17 @@ class Chef
|
|
37
37
|
|
38
38
|
banner "Sub-Command: client create CLIENT (options)"
|
39
39
|
|
40
|
-
def run
|
40
|
+
def run
|
41
|
+
@client_name = @name_args[0]
|
42
|
+
|
43
|
+
if @client_name.nil?
|
44
|
+
show_usage
|
45
|
+
Chef::Log.fatal("You must specify a client name")
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
41
49
|
client = Chef::ApiClient.new
|
42
|
-
client.name(@
|
50
|
+
client.name(@client_name)
|
43
51
|
client.admin(config[:admin])
|
44
52
|
|
45
53
|
output = edit_data(client)
|
@@ -27,7 +27,15 @@ class Chef
|
|
27
27
|
banner "Sub-Command: client delete CLIENT (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
30
|
+
@client_name = @name_args[0]
|
31
|
+
|
32
|
+
if @client_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a client name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
delete_object(Chef::ApiClient, @client_name)
|
31
39
|
end
|
32
40
|
|
33
41
|
end
|
@@ -26,8 +26,16 @@ class Chef
|
|
26
26
|
|
27
27
|
banner "Sub-Command: client edit CLIENT (options)"
|
28
28
|
|
29
|
-
def run
|
30
|
-
|
29
|
+
def run
|
30
|
+
@client_name = @name_args[0]
|
31
|
+
|
32
|
+
if @client_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a client name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
edit_object(Chef::ApiClient, @client_name)
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
@@ -31,8 +31,16 @@ class Chef
|
|
31
31
|
:long => "--file FILE",
|
32
32
|
:description => "Write the key to a file"
|
33
33
|
|
34
|
-
def run
|
35
|
-
|
34
|
+
def run
|
35
|
+
@client_name = @name_args[0]
|
36
|
+
|
37
|
+
if @client_name.nil?
|
38
|
+
show_usage
|
39
|
+
Chef::Log.fatal("You must specify a client name")
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
client = Chef::ApiClient.load(@client_name)
|
36
44
|
key = client.save(true)
|
37
45
|
if config[:file]
|
38
46
|
File.open(config[:file], "w") do |f|
|
@@ -31,8 +31,16 @@ class Chef
|
|
31
31
|
:long => "--attribute ATTR",
|
32
32
|
:description => "Show only one attribute"
|
33
33
|
|
34
|
-
def run
|
35
|
-
|
34
|
+
def run
|
35
|
+
@client_name = @name_args[0]
|
36
|
+
|
37
|
+
if @client_name.nil?
|
38
|
+
show_usage
|
39
|
+
Chef::Log.fatal("You must specify a client name")
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
client = Chef::ApiClient.load(@client_name)
|
36
44
|
output(format_for_display(client))
|
37
45
|
end
|
38
46
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
+
# Copyright:: Copyright (c) 2009 Opscode, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'chef/knife'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class ConfigureClient < Knife
|
24
|
+
banner "Sub-Command: configure client DIRECTORY"
|
25
|
+
|
26
|
+
def run
|
27
|
+
unless @config_dir = @name_args[0]
|
28
|
+
Chef::Log.fatal "You must provide the directory to put the files in"
|
29
|
+
show_usage
|
30
|
+
exit(1)
|
31
|
+
end
|
32
|
+
|
33
|
+
Chef::Log.info("Creating client configuration")
|
34
|
+
system("mkdir -p #{@config_dir}")
|
35
|
+
Chef::Log.info("Writing client.rb")
|
36
|
+
File.open(File.join(@config_dir, "client.rb"), "w") do |file|
|
37
|
+
file.puts('log_level :info')
|
38
|
+
file.puts('log_location STDOUT')
|
39
|
+
file.puts("chef_server_url '#{Chef::Config[:chef_server_url]}'")
|
40
|
+
file.puts("validation_client_name '#{Chef::Config[:validation_client_name]}'")
|
41
|
+
end
|
42
|
+
Chef::Log.info("Writing validation.pem")
|
43
|
+
system("cp #{Chef::Config[:validation_key]} #{File.join(@config_dir, 'validation.pem')}")
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -74,6 +74,10 @@ class Chef
|
|
74
74
|
output(rest.get_rest("cookbooks/#{@name_args[0]}/#{cookbook_version}"))
|
75
75
|
when 1 # We are showing the cookbook versions
|
76
76
|
output(rest.get_rest("cookbooks/#{@name_args[0]}"))
|
77
|
+
when 0
|
78
|
+
show_usage
|
79
|
+
Chef::Log.fatal("You must specify a cookbook name")
|
80
|
+
exit 1
|
77
81
|
end
|
78
82
|
end
|
79
83
|
|
@@ -31,13 +31,20 @@ class Chef
|
|
31
31
|
:boolean => true,
|
32
32
|
:description => "Grab dependencies automatically"
|
33
33
|
|
34
|
+
option :cookbook_path,
|
35
|
+
:short => "-o PATH:PATH",
|
36
|
+
:long => "--cookbook-path PATH:PATH",
|
37
|
+
:description => "A colon-separated path to look for cookbooks in",
|
38
|
+
:proc => lambda { |o| o.split(":") }
|
39
|
+
|
34
40
|
def run
|
35
41
|
if config[:cookbook_path]
|
36
|
-
|
42
|
+
Chef::Config[:cookbook_path] = config[:cookbook_path]
|
37
43
|
else
|
38
|
-
Chef::
|
39
|
-
vendor_path = Dir.pwd
|
44
|
+
config[:cookbook_path] = Chef::Config[:cookbook_path]
|
40
45
|
end
|
46
|
+
|
47
|
+
vendor_path = File.expand_path(File.join(config[:cookbook_path].first))
|
41
48
|
cookbook_path = File.join(vendor_path, name_args[0])
|
42
49
|
upstream_file = File.join(vendor_path, "#{name_args[0]}.tar.gz")
|
43
50
|
branch_name = "chef-vendor-#{name_args[0]}"
|
@@ -45,10 +45,10 @@ class Chef
|
|
45
45
|
config[:cookbook_path] = Chef::Config[:cookbook_path]
|
46
46
|
end
|
47
47
|
|
48
|
-
if config[:all]
|
48
|
+
if config[:all]
|
49
49
|
cl = Chef::CookbookLoader.new
|
50
|
-
cl.each do |cookbook|
|
51
|
-
test_cookbook(
|
50
|
+
cl.each do |key, cookbook|
|
51
|
+
test_cookbook(key)
|
52
52
|
end
|
53
53
|
else
|
54
54
|
@name_args.each do |cb|
|
@@ -60,42 +60,21 @@ class Chef
|
|
60
60
|
def test_cookbook(cookbook)
|
61
61
|
Chef::Log.info("Running syntax check on #{cookbook}")
|
62
62
|
Array(config[:cookbook_path]).reverse.each do |path|
|
63
|
-
|
64
|
-
test_ruby(
|
65
|
-
test_templates(
|
63
|
+
syntax_checker = Chef::Cookbook::SyntaxCheck.for_cookbook(cookbook, path)
|
64
|
+
test_ruby(syntax_checker)
|
65
|
+
test_templates(syntax_checker)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def test_ruby(cookbook_dir)
|
70
|
-
cache = Chef::Cache::Checksum.instance
|
71
|
-
Dir[File.join(cookbook_dir, '**', '*.rb')].each do |ruby_file|
|
72
|
-
key = cache.generate_key(ruby_file, "chef-test")
|
73
|
-
fstat = File.stat(ruby_file)
|
74
69
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
Chef::Log.info("Testing #{ruby_file} for syntax errors...")
|
79
|
-
Chef::Mixin::Command.run_command(:command => "ruby -c #{ruby_file}", :output_on_failure => true)
|
80
|
-
cache.generate_checksum(key, ruby_file, fstat)
|
81
|
-
end
|
82
|
-
end
|
70
|
+
def test_ruby(syntax_checker)
|
71
|
+
Chef::Log.info("Validating ruby files")
|
72
|
+
exit(1) unless syntax_checker.validate_ruby_files
|
83
73
|
end
|
84
|
-
|
85
|
-
def test_templates(
|
86
|
-
|
87
|
-
|
88
|
-
key = cache.generate_key(erb_file, "chef-test")
|
89
|
-
fstat = File.stat(erb_file)
|
90
|
-
|
91
|
-
if cache.lookup_checksum(key, fstat)
|
92
|
-
Chef::Log.info("No change in checksum of #{erb_file}")
|
93
|
-
else
|
94
|
-
Chef::Log.info("Testing template #{erb_file} for syntax errors...")
|
95
|
-
Chef::Mixin::Command.run_command(:command => "sh -c 'erubis -x #{erb_file} | ruby -c'", :output_on_failure => true)
|
96
|
-
cache.generate_checksum(key, erb_file, fstat)
|
97
|
-
end
|
98
|
-
end
|
74
|
+
|
75
|
+
def test_templates(syntax_checker)
|
76
|
+
Chef::Log.info("Validating templates")
|
77
|
+
exit(1) unless syntax_checker.validate_templates
|
99
78
|
end
|
100
79
|
|
101
80
|
end
|
@@ -63,6 +63,11 @@ class Chef
|
|
63
63
|
upload_cookbook(cookbook)
|
64
64
|
end
|
65
65
|
else
|
66
|
+
if @name_args.length < 1
|
67
|
+
show_usage
|
68
|
+
Chef::Log.fatal("You must specify the --all flag or at least one cookbook name")
|
69
|
+
exit 1
|
70
|
+
end
|
66
71
|
@name_args.each do |cookbook_name|
|
67
72
|
if cl.cookbook_exists?(cookbook_name)
|
68
73
|
upload_cookbook(cl[cookbook_name])
|
@@ -133,7 +138,19 @@ class Chef
|
|
133
138
|
end
|
134
139
|
sandbox_url = new_sandbox['uri']
|
135
140
|
Chef::Log.debug("Committing sandbox")
|
136
|
-
|
141
|
+
# Retry if S3 is claims a checksum doesn't exist (the eventual
|
142
|
+
# in eventual consistency)
|
143
|
+
retries = 0
|
144
|
+
begin
|
145
|
+
catch_auth_exceptions{ rest.put_rest(sandbox_url, {:is_completed => true}) }
|
146
|
+
rescue Net::HTTPServerException => e
|
147
|
+
if e.to_s =~ /400 "Bad Request"/ && retries += 1 <= 1
|
148
|
+
sleep 2
|
149
|
+
retry
|
150
|
+
else
|
151
|
+
raise
|
152
|
+
end
|
153
|
+
end
|
137
154
|
|
138
155
|
# files are uploaded, so save the manifest
|
139
156
|
catch_auth_exceptions{ build_dir_cookbook.save }
|
@@ -25,14 +25,29 @@ class Chef
|
|
25
25
|
|
26
26
|
banner "Sub-Command: data bag create BAG [ITEM] (options)"
|
27
27
|
|
28
|
-
def run
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def run
|
29
|
+
@data_bag_name, @data_bag_item_name = @name_args
|
30
|
+
|
31
|
+
if @data_bag_name.nil?
|
32
|
+
show_usage
|
33
|
+
Chef::Log.fatal("You must specify a data bag name")
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
|
37
|
+
# create the data bag
|
38
|
+
begin
|
39
|
+
rest.post_rest("data", { "name" => @data_bag_name })
|
40
|
+
Chef::Log.info("Created data_bag[#{@data_bag_name}]")
|
41
|
+
rescue Net::HTTPServerException => e
|
42
|
+
raise unless e.to_s =~ /^409/
|
43
|
+
Chef::Log.info("Data bag #{@data_bag_name} already exists")
|
44
|
+
end
|
45
|
+
|
46
|
+
# if an item is specified, create it, as well
|
47
|
+
if @data_bag_item_name
|
48
|
+
create_object({ "id" => @data_bag_item_name }, "data_bag_item[#{@data_bag_item_name}]") do |output|
|
49
|
+
rest.post_rest("data/#{@data_bag_name}", output)
|
32
50
|
end
|
33
|
-
else
|
34
|
-
rest.post_rest("data", { "name" => @name_args[0] })
|
35
|
-
Chef::Log.info("Created data_bag[#{@name_args[0]}]")
|
36
51
|
end
|
37
52
|
end
|
38
53
|
end
|
@@ -30,10 +30,14 @@ class Chef
|
|
30
30
|
delete_object(Chef::DataBagItem, @name_args[1], "data_bag_item") do
|
31
31
|
rest.delete_rest("data/#{@name_args[0]}/#{@name_args[1]}")
|
32
32
|
end
|
33
|
-
|
33
|
+
elsif @name_args.length == 1
|
34
34
|
delete_object(Chef::DataBag, @name_args[0], "data_bag") do
|
35
35
|
rest.delete_rest("data/#{@name_args[0]}")
|
36
36
|
end
|
37
|
+
else
|
38
|
+
show_usage
|
39
|
+
Chef::Log.fatal("You must specify at least a data bag name")
|
40
|
+
exit 1
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
@@ -26,9 +26,17 @@ class Chef
|
|
26
26
|
|
27
27
|
banner "Sub-Command: node create NODE (options)"
|
28
28
|
|
29
|
-
def run
|
29
|
+
def run
|
30
|
+
@node_name = @name_args[0]
|
31
|
+
|
32
|
+
if @node_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a node name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
30
38
|
node = Chef::Node.new
|
31
|
-
node.name(@
|
39
|
+
node.name(@node_name)
|
32
40
|
create_object(node)
|
33
41
|
end
|
34
42
|
end
|
@@ -27,7 +27,15 @@ class Chef
|
|
27
27
|
banner "Sub-Command: node delete NODE (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
30
|
+
@node_name = @name_args[0]
|
31
|
+
|
32
|
+
if @node_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a node name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
delete_object(Chef::Node, @node_name)
|
31
39
|
end
|
32
40
|
|
33
41
|
end
|
data/lib/chef/knife/node_edit.rb
CHANGED
@@ -27,7 +27,15 @@ class Chef
|
|
27
27
|
banner "Sub-Command: node edit NODE (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
30
|
+
@node_name = @name_args[0]
|
31
|
+
|
32
|
+
if @node_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a node name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
edit_object(Chef::Node, @node_name)
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
data/lib/chef/knife/node_show.rb
CHANGED
@@ -37,7 +37,15 @@ class Chef
|
|
37
37
|
:description => "Show only the run list"
|
38
38
|
|
39
39
|
def run
|
40
|
-
|
40
|
+
@node_name = @name_args[0]
|
41
|
+
|
42
|
+
if @node_name.nil?
|
43
|
+
show_usage
|
44
|
+
Chef::Log.fatal("You must specify a node name")
|
45
|
+
exit 1
|
46
|
+
end
|
47
|
+
|
48
|
+
node = Chef::Node.load(@node_name)
|
41
49
|
output(format_for_display(node))
|
42
50
|
end
|
43
51
|
end
|
@@ -31,9 +31,17 @@ class Chef
|
|
31
31
|
:long => "--description",
|
32
32
|
:description => "The role description"
|
33
33
|
|
34
|
-
def run
|
34
|
+
def run
|
35
|
+
@role_name = @name_args[0]
|
36
|
+
|
37
|
+
if @role_name.nil?
|
38
|
+
show_usage
|
39
|
+
Chef::Log.fatal("You must specify a role name")
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
35
43
|
role = Chef::Role.new
|
36
|
-
role.name(@
|
44
|
+
role.name(@role_name)
|
37
45
|
role.description(config[:description]) if config[:description]
|
38
46
|
create_object(role)
|
39
47
|
end
|
@@ -27,7 +27,15 @@ class Chef
|
|
27
27
|
banner "Sub-Command: role delete ROLE (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
30
|
+
@role_name = @name_args[0]
|
31
|
+
|
32
|
+
if @role_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a role name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
delete_object(Chef::Role, @role_name)
|
31
39
|
end
|
32
40
|
|
33
41
|
end
|
data/lib/chef/knife/role_edit.rb
CHANGED
@@ -27,7 +27,15 @@ class Chef
|
|
27
27
|
banner "Sub-Command: role edit ROLE (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
30
|
+
@role_name = @name_args[0]
|
31
|
+
|
32
|
+
if @role_name.nil?
|
33
|
+
show_usage
|
34
|
+
Chef::Log.fatal("You must specify a role name")
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
edit_object(Chef::Role, @role_name)
|
31
39
|
end
|
32
40
|
end
|
33
41
|
end
|
data/lib/chef/knife/role_show.rb
CHANGED
@@ -32,7 +32,15 @@ class Chef
|
|
32
32
|
:description => "Show only one attribute"
|
33
33
|
|
34
34
|
def run
|
35
|
-
|
35
|
+
@role_name = @name_args[0]
|
36
|
+
|
37
|
+
if @role_name.nil?
|
38
|
+
show_usage
|
39
|
+
Chef::Log.fatal("You must specify a role name")
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
role = Chef::Role.load(@role_name)
|
36
44
|
output(format_for_display(role))
|
37
45
|
end
|
38
46
|
|
@@ -65,6 +65,7 @@ class Chef
|
|
65
65
|
# Chef::Provider.
|
66
66
|
# resource.recipe_name = @recipe_name
|
67
67
|
resource.params = @params
|
68
|
+
resource.source_line = caller[0]
|
68
69
|
# Determine whether this resource is being created in the context of an enclosing Provider
|
69
70
|
resource.enclosing_provider = self.is_a?(Chef::Provider) ? self : nil
|
70
71
|
resource.instance_eval(&block) if block
|
data/lib/chef/resource.rb
CHANGED
@@ -26,6 +26,7 @@ require 'chef/node'
|
|
26
26
|
|
27
27
|
class Chef
|
28
28
|
class Resource
|
29
|
+
HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name]
|
29
30
|
|
30
31
|
include Chef::Mixin::CheckHelper
|
31
32
|
include Chef::Mixin::ParamsValidate
|
@@ -33,7 +34,8 @@ class Chef
|
|
33
34
|
include Chef::Mixin::ConvertToClassName
|
34
35
|
|
35
36
|
attr_accessor :params, :provider, :updated, :allowed_actions, :run_context, :cookbook_name, :recipe_name, :enclosing_provider
|
36
|
-
|
37
|
+
attr_accessor :source_line
|
38
|
+
attr_reader :resource_name, :not_if_args, :only_if_args
|
37
39
|
|
38
40
|
# Each notify entry is a resource/action pair, modeled as an
|
39
41
|
# OpenStruct with a .resource and .action member
|
@@ -57,11 +59,7 @@ class Chef
|
|
57
59
|
@only_if_args = {}
|
58
60
|
@notifies_immediate = Array.new
|
59
61
|
@notifies_delayed = Array.new
|
60
|
-
|
61
|
-
if sline
|
62
|
-
@source_line = sline.gsub!(/^(.+):(.+):.+$/, '\1 line \2')
|
63
|
-
@source_line = ::File.expand_path(@source_line) if @source_line
|
64
|
-
end
|
62
|
+
@source_line = nil
|
65
63
|
end
|
66
64
|
|
67
65
|
def node
|
@@ -206,6 +204,20 @@ class Chef
|
|
206
204
|
def to_s
|
207
205
|
"#{@resource_name}[#{@name}]"
|
208
206
|
end
|
207
|
+
|
208
|
+
def to_text
|
209
|
+
skip =
|
210
|
+
ivars = instance_variables.map { |ivar| ivar.to_sym } - HIDDEN_IVARS
|
211
|
+
text = "# Declared in #{@source_line}\n"
|
212
|
+
text << convert_to_snake_case(self.class.name, 'Chef::Resource') + "(#{name}) do\n"
|
213
|
+
ivars.each do |ivar|
|
214
|
+
#next if skip.include?(ivar)
|
215
|
+
if (value = instance_variable_get(ivar)) && !(value.respond_to?(:empty?) && value.empty?)
|
216
|
+
text << " #{ivar.to_s.sub(/^@/,'')}(#{value.inspect})\n"
|
217
|
+
end
|
218
|
+
end
|
219
|
+
text << "end\n"
|
220
|
+
end
|
209
221
|
|
210
222
|
# Serialize this object as a hash
|
211
223
|
def to_json(*a)
|
data/lib/chef/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 59
|
5
|
+
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 9
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.9.0.rc02
|
10
|
+
version: 0.9.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Jacob
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-20 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,6 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 19
|
29
30
|
segments:
|
30
31
|
- 1
|
31
32
|
- 1
|
@@ -41,6 +42,7 @@ dependencies:
|
|
41
42
|
requirements:
|
42
43
|
- - ">="
|
43
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 19
|
44
46
|
segments:
|
45
47
|
- 1
|
46
48
|
- 1
|
@@ -56,6 +58,7 @@ dependencies:
|
|
56
58
|
requirements:
|
57
59
|
- - ">="
|
58
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 19
|
59
62
|
segments:
|
60
63
|
- 1
|
61
64
|
- 1
|
@@ -71,6 +74,7 @@ dependencies:
|
|
71
74
|
requirements:
|
72
75
|
- - ">="
|
73
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 19
|
74
78
|
segments:
|
75
79
|
- 1
|
76
80
|
- 1
|
@@ -86,6 +90,7 @@ dependencies:
|
|
86
90
|
requirements:
|
87
91
|
- - ">="
|
88
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 11
|
89
94
|
segments:
|
90
95
|
- 0
|
91
96
|
- 5
|
@@ -101,6 +106,7 @@ dependencies:
|
|
101
106
|
requirements:
|
102
107
|
- - ">="
|
103
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 31
|
104
110
|
segments:
|
105
111
|
- 1
|
106
112
|
- 0
|
@@ -108,6 +114,7 @@ dependencies:
|
|
108
114
|
version: 1.0.4
|
109
115
|
- - <=
|
110
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 1
|
111
118
|
segments:
|
112
119
|
- 1
|
113
120
|
- 5
|
@@ -123,6 +130,7 @@ dependencies:
|
|
123
130
|
requirements:
|
124
131
|
- - ">="
|
125
132
|
- !ruby/object:Gem::Version
|
133
|
+
hash: 7
|
126
134
|
segments:
|
127
135
|
- 0
|
128
136
|
- 6
|
@@ -138,6 +146,7 @@ dependencies:
|
|
138
146
|
requirements:
|
139
147
|
- - <=
|
140
148
|
- !ruby/object:Gem::Version
|
149
|
+
hash: 3
|
141
150
|
segments:
|
142
151
|
- 1
|
143
152
|
- 4
|
@@ -153,6 +162,7 @@ dependencies:
|
|
153
162
|
requirements:
|
154
163
|
- - ">="
|
155
164
|
- !ruby/object:Gem::Version
|
165
|
+
hash: 3
|
156
166
|
segments:
|
157
167
|
- 0
|
158
168
|
version: "0"
|
@@ -166,6 +176,7 @@ dependencies:
|
|
166
176
|
requirements:
|
167
177
|
- - ">="
|
168
178
|
- !ruby/object:Gem::Version
|
179
|
+
hash: 3
|
169
180
|
segments:
|
170
181
|
- 0
|
171
182
|
version: "0"
|
@@ -179,6 +190,7 @@ dependencies:
|
|
179
190
|
requirements:
|
180
191
|
- - ">="
|
181
192
|
- !ruby/object:Gem::Version
|
193
|
+
hash: 3
|
182
194
|
segments:
|
183
195
|
- 0
|
184
196
|
version: "0"
|
@@ -192,6 +204,7 @@ dependencies:
|
|
192
204
|
requirements:
|
193
205
|
- - ">="
|
194
206
|
- !ruby/object:Gem::Version
|
207
|
+
hash: 3
|
195
208
|
segments:
|
196
209
|
- 0
|
197
210
|
version: "0"
|
@@ -205,6 +218,7 @@ dependencies:
|
|
205
218
|
requirements:
|
206
219
|
- - ">="
|
207
220
|
- !ruby/object:Gem::Version
|
221
|
+
hash: 3
|
208
222
|
segments:
|
209
223
|
- 0
|
210
224
|
version: "0"
|
@@ -308,6 +322,7 @@ files:
|
|
308
322
|
- lib/chef/knife/client_reregister.rb
|
309
323
|
- lib/chef/knife/client_show.rb
|
310
324
|
- lib/chef/knife/configure.rb
|
325
|
+
- lib/chef/knife/configure_client.rb
|
311
326
|
- lib/chef/knife/cookbook_bulk_delete.rb
|
312
327
|
- lib/chef/knife/cookbook_delete.rb
|
313
328
|
- lib/chef/knife/cookbook_download.rb
|
@@ -546,19 +561,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
546
561
|
requirements:
|
547
562
|
- - ">="
|
548
563
|
- !ruby/object:Gem::Version
|
564
|
+
hash: 3
|
549
565
|
segments:
|
550
566
|
- 0
|
551
567
|
version: "0"
|
552
568
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
553
569
|
none: false
|
554
570
|
requirements:
|
555
|
-
- - "
|
571
|
+
- - ">="
|
556
572
|
- !ruby/object:Gem::Version
|
573
|
+
hash: 3
|
557
574
|
segments:
|
558
|
-
-
|
559
|
-
|
560
|
-
- 1
|
561
|
-
version: 1.3.1
|
575
|
+
- 0
|
576
|
+
version: "0"
|
562
577
|
requirements: []
|
563
578
|
|
564
579
|
rubyforge_project:
|