chef 0.9.10.rc.0 → 0.9.10.rc.1
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/application/client.rb +8 -1
- data/lib/chef/client.rb +1 -0
- data/lib/chef/knife.rb +14 -1
- data/lib/chef/provider/cookbook_file.rb +6 -2
- data/lib/chef/version.rb +1 -1
- metadata +2 -2
@@ -89,6 +89,11 @@ class Chef::Application::Client < Chef::Application
|
|
89
89
|
:description => "Run chef-client periodically, in seconds",
|
90
90
|
:proc => lambda { |s| s.to_i }
|
91
91
|
|
92
|
+
option :once,
|
93
|
+
:long => "--short",
|
94
|
+
:description => "Cancel any interval or splay options, run chef once and exit",
|
95
|
+
:boolean => true
|
96
|
+
|
92
97
|
option :json_attribs,
|
93
98
|
:short => "-j JSON_ATTRIBS",
|
94
99
|
:long => "--json-attributes JSON_ATTRIBS",
|
@@ -149,7 +154,9 @@ class Chef::Application::Client < Chef::Application
|
|
149
154
|
|
150
155
|
if Chef::Config[:daemonize]
|
151
156
|
Chef::Config[:interval] ||= 1800
|
152
|
-
|
157
|
+
end
|
158
|
+
|
159
|
+
if Chef::Config[:once]
|
153
160
|
Chef::Config[:interval] = nil
|
154
161
|
Chef::Config[:splay] = nil
|
155
162
|
end
|
data/lib/chef/client.rb
CHANGED
data/lib/chef/knife.rb
CHANGED
@@ -418,7 +418,20 @@ class Chef
|
|
418
418
|
object = klass.load(name)
|
419
419
|
|
420
420
|
output = edit_data(object)
|
421
|
-
|
421
|
+
|
422
|
+
# Only make the save if the user changed the object.
|
423
|
+
#
|
424
|
+
# Output JSON for the original (object) and edited (output), then parse
|
425
|
+
# them without reconstituting the objects into real classes
|
426
|
+
# (create_additions=false). Then, compare the resulting simple objects,
|
427
|
+
# which will be Array/Hash/String/etc.
|
428
|
+
#
|
429
|
+
# We wouldn't have to do these shenanigans if all the editable objects
|
430
|
+
# implemented to_hash, or if to_json against a hash returned a string
|
431
|
+
# with stable key order.
|
432
|
+
object_parsed_again = JSON.parse(object.to_json, :create_additions => false)
|
433
|
+
output_parsed_again = JSON.parse(output.to_json, :create_additions => false)
|
434
|
+
if object_parsed_again != output_parsed_again
|
422
435
|
output.save
|
423
436
|
self.msg("Saved #{output}")
|
424
437
|
else
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
|
34
34
|
|
35
35
|
def action_create
|
36
|
-
if file_cache_location
|
36
|
+
if file_cache_location && content_stale?
|
37
37
|
Chef::Log.debug("content of file #{@new_resource.path} requires update")
|
38
38
|
backup_new_resource
|
39
39
|
Tempfile.open(::File.basename(@new_resource.name)) do |staging_file|
|
@@ -46,7 +46,7 @@ class Chef
|
|
46
46
|
else
|
47
47
|
set_all_access_controls(@new_resource.path)
|
48
48
|
end
|
49
|
-
@new_resource.updated_by_last_action
|
49
|
+
@new_resource.updated_by_last_action?
|
50
50
|
end
|
51
51
|
|
52
52
|
def action_create_if_missing
|
@@ -91,6 +91,10 @@ class Chef
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
+
def content_stale?
|
95
|
+
( ! ::File.exist?(@new_resource.path)) || ( ! compare_content)
|
96
|
+
end
|
97
|
+
|
94
98
|
end
|
95
99
|
end
|
96
100
|
end
|
data/lib/chef/version.rb
CHANGED