Permalink
Browse files

Add fix for DoppelGangerClient

  • Loading branch information...
1 parent 2ef9298 commit c2d778445700492fa85063fe349fb24ce870d217 @stevendanna committed Jan 29, 2012
Showing with 27 additions and 0 deletions.
  1. +6 −0 shef/README.md
  2. +21 −0 shef/doppelganger_fix.rb
View
@@ -86,3 +86,9 @@ resource in the resource_collection.
This is most useful when you have used `setup_run` to load the
resources from a node's run_list.
+
+# DoppelGanger Fix
+
+`doppelganger_fix` contains a monkey-patch that fixes CHEF-2869 and
+allows you to use `become_node`. This is a temporary fix until the
+problem is resolved in Chef.
View
@@ -0,0 +1,21 @@
+# Tempoary fix for Shef's DoppelGangerClient class
+# see CHEF-2896
+#
+#
+
+module Shef
+ class DoppelGangerClient
+ def build_node
+ Chef::Log.info("Building node object for #{@node_name}")
+ @node = Chef::Node.load(node_name)
+ ohai_data = @ohai.data.merge(@node.automatic_attrs)
+ @node.consume_external_attrs(ohai_data,nil)
+ @run_list_expansion = @node.expand!('server')
+ @expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings
+ Chef::Log.info("Run List is [#{@node.run_list}]")
+ Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]")
+ @run_status = Chef::RunStatus.new(@node)
+ @node
+ end
+ end
+end

0 comments on commit c2d7784

Please sign in to comment.