diff options
author | Tim Smith <tsmith@chef.io> | 2018-07-16 19:25:06 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-07-16 19:25:06 -0700 |
commit | 37ea80e067410845699458d4e7bf1762fe216e3f (patch) | |
tree | c45768a3db9b1e5c88fb803513d576867d47d9ec | |
parent | 2881441d1967c278673d58bc8f5415e215fc63f7 (diff) | |
download | chef-37ea80e067410845699458d4e7bf1762fe216e3f.tar.gz |
Expand platform support for the route resourceroute_platform_family
Support all RHEL derivatives as well as Amazon. This gets us Amazon, Oracle, Scientific, Xen, and a few others.
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | lib/chef/provider/route.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/route_spec.rb | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb index aaa056e542..58a65edb81 100644 --- a/lib/chef/provider/route.rb +++ b/lib/chef/provider/route.rb @@ -159,8 +159,8 @@ class Chef def generate_config conf = {} - case node[:platform] - when "centos", "redhat", "fedora" + case node[:platform_family] + when "rhel", "amazon", "fedora" # walk the collection run_context.resource_collection.each do |resource| next unless resource.is_a? Chef::Resource::Route diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb index 977e5681bf..5b15bbf253 100644 --- a/spec/unit/provider/route_spec.rb +++ b/spec/unit/provider/route_spec.rb @@ -114,7 +114,7 @@ describe Chef::Provider::Route do end it "should not delete config file for :add action (CHEF-3332)" do - @node.automatic_attrs[:platform] = "centos" + @node.automatic_attrs[:platform_family] = "rhel" route_file = StringIO.new expect(File).to receive(:new).and_return(route_file) @@ -220,9 +220,9 @@ describe Chef::Provider::Route do end describe Chef::Provider::Route, "generate_config method" do - %w{ centos redhat fedora }.each do |platform| - it "should write a route file on #{platform} platform" do - @node.automatic_attrs[:platform] = platform + %w{ rhel fedora amazon }.each do |platform_family| + it "should write a route file on #{platform_family} platform family" do + @node.automatic_attrs[:platform_family] = platform_family route_file = StringIO.new expect(File).to receive(:new).with("/etc/sysconfig/network-scripts/route-eth0", "w").and_return(route_file) @@ -231,9 +231,9 @@ describe Chef::Provider::Route do end end - %w{ centos redhat fedora }.each do |platform| - it "should write a default route file on #{platform} platform" do - @node.automatic_attrs[:platform] = platform + %w{ rhel fedora amazon }.each do |platform_family| + it "should write a default route file on #{platform_family} platform family" do + @node.automatic_attrs[:platform_family] = platform_family route_file = StringIO.new allow(File).to receive(:exist?).with("/etc/sysconfig/network").and_return(false) @@ -245,7 +245,7 @@ describe Chef::Provider::Route do end it "should put all routes for a device in a route config file" do - @node.automatic_attrs[:platform] = "centos" + @node.automatic_attrs[:platform_family] = "rhel" route_file = StringIO.new expect(File).to receive(:new).and_return(route_file) |