diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-04-20 09:40:31 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-04-20 09:40:31 -0700 |
commit | d23b24b021364784ca79317c42d8f4028a9d7253 (patch) | |
tree | 8c1135a8b6c506cd7a1c1d321455577d7fe1b682 | |
parent | e265487be7f503119057621d6ef125667f06e39c (diff) | |
download | chef-d23b24b021364784ca79317c42d8f4028a9d7253.tar.gz |
add a pointer from the run_context back to the runnerlcg/runner-pointer
because surfing through Objectspace makes kittens cry
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/run_context.rb | 7 | ||||
-rw-r--r-- | lib/chef/runner.rb | 3 | ||||
-rw-r--r-- | spec/unit/runner_spec.rb | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/run_context.rb b/lib/chef/run_context.rb index a606585e80..fc32ab3eeb 100644 --- a/lib/chef/run_context.rb +++ b/lib/chef/run_context.rb @@ -111,6 +111,11 @@ class Chef attr_reader :audits # + # Pointer back to the Chef::Runner that created this + # + attr_accessor :runner + + # # Notification handling # @@ -646,6 +651,8 @@ ERROR_MESSAGE root_run_context resource_collection resource_collection= + runner + runner= }.map { |x| x.to_sym } # Verify that we didn't miss any methods diff --git a/lib/chef/runner.rb b/lib/chef/runner.rb index cd5615bcec..1c82439b57 100644 --- a/lib/chef/runner.rb +++ b/lib/chef/runner.rb @@ -2,7 +2,7 @@ # Author:: Adam Jacob (<adam@chef.io>) # Author:: Christopher Walters (<cw@chef.io>) # Author:: Tim Hinderliter (<tim@chef.io>) -# Copyright:: Copyright 2008-2016, Chef Software Inc. +# Copyright:: Copyright 2008-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,6 +34,7 @@ class Chef def initialize(run_context) @run_context = run_context + run_context.runner = self end def delayed_actions diff --git a/spec/unit/runner_spec.rb b/spec/unit/runner_spec.rb index eeb471608e..db52862a9c 100644 --- a/spec/unit/runner_spec.rb +++ b/spec/unit/runner_spec.rb @@ -98,6 +98,10 @@ describe Chef::Runner do run_context.resource_collection << first_resource end + it "runner sets up a pointer back to itself in the run_context" do + expect(runner).to eql(run_context.runner) + end + context "when we are doing dynamic provider resolution" do it "should pass each resource in the collection to a provider" do |