summaryrefslogtreecommitdiff
path: root/lib/chef/provider/route.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-03-02 16:05:50 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2020-03-02 16:05:50 -0800
commit812fcb568e06afdcdaad5d624c97b666a43a65b1 (patch)
treead8b78eb755684239cfa8d5724b0fd3ad204d415 /lib/chef/provider/route.rb
parent36a727691ea93d1f5fe8cf267fae5dd92516a9f0 (diff)
downloadchef-812fcb568e06afdcdaad5d624c97b666a43a65b1.tar.gz
Use the action DSL consistently
May be a potentially breaking change if I noodle hard enough on it, it does mean that all the actions are now (correctly) encapsulated in a sub-resource collection, whereas before they never had one. Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/provider/route.rb')
-rw-r--r--lib/chef/provider/route.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 484d4490bb..cd0dd682ae 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -1,7 +1,7 @@
#
# Author:: Bryan McLellan (btm@loftninjas.org), Jesse Nelson (spheromak@gmail.com)
# Copyright:: Copyright 2009-2016, Bryan McLellan
-# Copyright:: Copyright 2020, Chef Software, Inc.
+# Copyright:: Copyright 2020-2020, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -128,7 +128,7 @@ class Chef
route_file.close
end
- def action_add
+ action :add do
# check to see if load_current_resource found the route
if is_running
logger.trace("#{new_resource} route already active - nothing to do")
@@ -144,7 +144,7 @@ class Chef
generate_config
end
- def action_delete
+ action :delete do
if is_running
command = generate_command(:delete)
converge_by("run #{command.join(" ")} to delete route ") do
@@ -162,8 +162,10 @@ class Chef
def generate_config
if platform_family?("rhel", "amazon", "fedora")
conf = {}
+ # FIXME FIXME FIXME FIXME: whatever this walking-the-run-context API is, it needs to be removed.
# walk the collection
- run_context.resource_collection.each do |resource|
+ rc = run_context.parent_run_context || run_context
+ rc.resource_collection.each do |resource|
next unless resource.is_a? Chef::Resource::Route
# default to eth0