@@ -61,10 +61,10 @@ def run
6161 build_node
6262 register
6363 authenticate
64+ sync_library_files
65+ sync_attribute_files
6466 sync_definitions
6567 sync_recipes
66- do_library_files
67- do_attribute_files
6868 save_node
6969 converge
7070 save_node
@@ -75,9 +75,15 @@ def run
7575 end
7676
7777 def run_solo
78+ start_time = Time . now
79+ Chef ::Log . info ( "Starting Chef Solo Run" )
80+
7881 build_node
7982 do_attribute_files
8083 converge
84+
85+ end_time = Time . now
86+ Chef ::Log . info ( "Chef Run complete in #{ end_time - start_time } seconds" )
8187 true
8288 end
8389
@@ -246,15 +252,9 @@ def update_file_cache(segment, remote_list)
246252 #
247253 # === Returns
248254 # true:: Always returns true
249- def do_attribute_files
255+ def sync_attribute_files
250256 Chef ::Log . debug ( "Synchronizing attributes" )
251257 update_file_cache ( "attributes" , @rest . get_rest ( 'cookbooks/_attribute_files' ) )
252- Chef ::FileCache . list . sort . each do |cache_file |
253- if cache_file . match ( "cookbooks/.+?/attributes" )
254- Chef ::Log . debug ( "Executing #{ cache_file } " )
255- @node . from_file ( Chef ::FileCache . load ( cache_file , false ) )
256- end
257- end
258258 true
259259 end
260260
@@ -263,15 +263,9 @@ def do_attribute_files
263263 #
264264 # === Returns
265265 # true:: Always returns true
266- def do_library_files
266+ def sync_library_files
267267 Chef ::Log . debug ( "Synchronizing libraries" )
268268 update_file_cache ( "libraries" , @rest . get_rest ( 'cookbooks/_library_files' ) )
269- Chef ::FileCache . list . each do |cache_file |
270- if cache_file . match ( "cookbooks/.+?/libraries" )
271- Chef ::Log . debug ( "Requiring #{ cache_file } " )
272- require Chef ::FileCache . load ( cache_file , false )
273- end
274- end
275269 true
276270 end
277271
@@ -305,10 +299,12 @@ def converge
305299 Chef ::Config [ :cookbook_path ] = File . join ( Chef ::Config [ :file_cache_path ] , "cookbooks" )
306300 compile = Chef ::Compile . new ( )
307301 compile . node = @node
302+ compile . load_libraries
303+ compile . load_attributes
308304 compile . load_definitions
309305 compile . load_recipes
310306
311- Chef ::Log . debug ( "Executing recipes for node #{ @safe_name } " )
307+ Chef ::Log . debug ( "Converging node #{ @safe_name } " )
312308 cr = Chef ::Runner . new ( @node , compile . collection )
313309 cr . converge
314310 true
0 commit comments