diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-30 12:19:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-30 12:19:53 -0700 |
commit | 14789e68332c8ad0de87db5e64277d0250e22a19 (patch) | |
tree | b33f2c7f2ff8bc8b7dbca1c56d3d3130d10652a8 | |
parent | d894f9e5cfad979b8b8f65285beeffc51c5684b9 (diff) | |
parent | b26dbf802daa488e14232a5a88bc49d23a4a64f7 (diff) | |
download | chef-14789e68332c8ad0de87db5e64277d0250e22a19.tar.gz |
Merge pull request #7240 from chef/route_resource
Remove unused route resource properties
-rw-r--r-- | lib/chef/provider/route.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/route.rb | 38 | ||||
-rw-r--r-- | spec/unit/resource/route_spec.rb | 9 |
3 files changed, 32 insertions, 17 deletions
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb index 58a65edb81..b8af9e55b8 100644 --- a/lib/chef/provider/route.rb +++ b/lib/chef/provider/route.rb @@ -158,9 +158,9 @@ class Chef end def generate_config - conf = {} case node[:platform_family] when "rhel", "amazon", "fedora" + conf = {} # walk the collection run_context.resource_collection.each do |resource| next unless resource.is_a? Chef::Resource::Route diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index 8c14394ace..45a1266fd7 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -27,20 +27,30 @@ class Chef description "Use the route resource to manage the system routing table in a Linux environment." - property :target, String, identity: true, name_property: true - property :comment, [String, nil], introduced: "14.0" - property :metric, [Integer, nil] - property :netmask, [String, nil] - property :gateway, [String, nil] - property :device, [String, nil], desired_state: false # Has a partial default in the provider of eth0. - property :route_type, [:host, :net], default: :host, coerce: proc { |x| x.to_sym }, desired_state: false - - # I can find no evidence of these properties actually being used by Chef. NK 2017-04-11 - property :networking, [String, nil], desired_state: false - property :networking_ipv6, [String, nil], desired_state: false - property :hostname, [String, nil], desired_state: false - property :domainname, [String, nil], desired_state: false - property :domain, [String, nil], desired_state: false + property :target, String, + description: "The IP address of the target route.", + identity: true, name_property: true + + property :comment, [String, nil], + description: "Add a comment for the route.", + introduced: "14.0" + + property :metric, [Integer, nil], + description: "The route metric value." + + property :netmask, [String, nil], + description: "The decimal representation of the network mask. For example: 255.255.255.0." + + property :gateway, [String, nil], + description: "The gateway for the route." + + property :device, [String, nil], + description: "The network interface to which the route applies.", + desired_state: false # Has a partial default in the provider of eth0. + + property :route_type, [Symbol, String], + description: "", + equal_to: [:host, :net], default: :host, desired_state: false end end end diff --git a/spec/unit/resource/route_spec.rb b/spec/unit/resource/route_spec.rb index d4248755b5..dd79d04024 100644 --- a/spec/unit/resource/route_spec.rb +++ b/spec/unit/resource/route_spec.rb @@ -56,8 +56,13 @@ describe Chef::Resource::Route do expect(resource.device).to eql("eth0") end - it "allows you to specify the route type" do - resource.route_type "host" + it "allows you to specify the route type as a symbol" do + resource.route_type :host + expect(resource.route_type).to eql(:host) + end + + it "allows you to specify the route type as a string" do + resource.route_type :host expect(resource.route_type).to eql(:host) end |