From ccc373354e02db91ef00a6d8d7bab520c7ebc3ab Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Sun, 26 Feb 2017 16:13:38 -0800 Subject: Chef-13: Remove Chef::PolicyBuilder::ExpandNodeObject#load_node Signed-off-by: Lamont Granquist --- RELEASE_NOTES.md | 4 +++ lib/chef/policy_builder/expand_node_object.rb | 29 +--------------------- .../unit/policy_builder/expand_node_object_spec.rb | 8 ++---- 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 374396ae9a..12c3fd8a8d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -37,3 +37,7 @@ The remediation is to set the manage_home and non_unique properties directly. Without a declared cwd the relative path was (most likely?) relative to wherever chef-client happened to be invoked which is not deterministic or easy to intuit behavior. +### Chef::PolicyBuilder::ExpandNodeObject#load_node has been removed + +This change is most likely to only affect internals of tooling like chefspec if it affects anything at all. + diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb index d8f4f752de..dbed44a002 100644 --- a/lib/chef/policy_builder/expand_node_object.rb +++ b/lib/chef/policy_builder/expand_node_object.rb @@ -3,7 +3,7 @@ # Author:: Tim Hinderliter () # Author:: Christopher Walters () # Author:: Daniel DeLeo () -# 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"); @@ -103,33 +103,6 @@ class Chef run_context end - # DEPRECATED: As of Chef 12.5, chef selects either policyfile mode or - # "expand node" mode dynamically, based on the content of the node - # object, first boot JSON, and config. This happens in - # PolicyBuilder::Dynamic, which selects the implementation during - # #load_node and then delegates to either ExpandNodeObject or Policyfile - # implementations as appropriate. Tools authors should update their code - # to create a PolicyBuilder::Dynamc policy builder and allow it to select - # the proper implementation. - def load_node - Chef.deprecated(:internal_api, "ExpandNodeObject#load_node is deprecated. Please use Chef::PolicyBuilder::Dynamic instead of using ExpandNodeObject directly") - - events.node_load_start(node_name, config) - Chef::Log.debug("Building node object for #{node_name}") - - @node = - if Chef::Config[:solo_legacy_mode] - Chef::Node.build(node_name) - else - Chef::Node.find_or_create(node_name) - end - finish_load_node(node) - node - rescue Exception => e - events.node_load_failed(node_name, e, config) - raise - end - def finish_load_node(node) @node = node end diff --git a/spec/unit/policy_builder/expand_node_object_spec.rb b/spec/unit/policy_builder/expand_node_object_spec.rb index 420db2e855..68b3c285a1 100644 --- a/spec/unit/policy_builder/expand_node_object_spec.rb +++ b/spec/unit/policy_builder/expand_node_object_spec.rb @@ -1,6 +1,6 @@ # # Author:: Daniel DeLeo () -# Copyright:: Copyright 2014-2016, Chef Software, Inc. +# Copyright:: Copyright 2014-2017, Chef Software Inc. # License:: Apache License, Version 2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,11 +34,7 @@ describe Chef::PolicyBuilder::ExpandNodeObject do expect(policy_builder).to respond_to(:node) end - it "implements a load_node method for backwards compatibility until Chef 13" do - expect(policy_builder).to respond_to(:load_node) - end - - it "has removed the deprecated #load_node method", chef: ">= 13" do + it "has removed the deprecated #load_node method" do expect(policy_builder).to_not respond_to(:load_node) end -- cgit v1.2.1