diff options
author | Tim Smith <tsmith@chef.io> | 2018-07-18 12:28:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-18 12:28:36 -0700 |
commit | 7a84cc44cb2ece56fa48b8e46f6e29dac9bdacb9 (patch) | |
tree | 5b3bc67c551147f2eeec24fa1e40125a528c683d | |
parent | 5f354032ed5dcb834a01bc23210e84f266544ecb (diff) | |
parent | 37ea80e067410845699458d4e7bf1762fe216e3f (diff) | |
download | chef-7a84cc44cb2ece56fa48b8e46f6e29dac9bdacb9.tar.gz |
Merge pull request #7480 from chef/route_platform_family
Expand platform support for the route resource
-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 90e33b25a8..67311aa6f7 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) |