diff options
author | Thom May <thom@may.lt> | 2018-03-02 17:49:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 17:49:19 +0000 |
commit | 2784f55d49cdd4c78f473a86ad39cd5b3bcdbc57 (patch) | |
tree | c5849ff2a706916d6a526f52e16c06034b725c6e | |
parent | 70d4c9601d37bf9a219e8d6ca8470e059a070795 (diff) | |
parent | 12a02d2206061b0a2baebad96a0e105fd242932d (diff) | |
download | chef-2784f55d49cdd4c78f473a86ad39cd5b3bcdbc57.tar.gz |
Merge pull request #6929 from tomdoherty/allow_route_comment
Allow specifying a comment for routes
-rw-r--r-- | lib/chef/provider/route.rb | 3 | ||||
-rw-r--r-- | lib/chef/resource/route.rb | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb index 2784ae43bc..16e06f470b 100644 --- a/lib/chef/provider/route.rb +++ b/lib/chef/provider/route.rb @@ -174,7 +174,7 @@ class Chef conf[dev] = "" if conf[dev].nil? case @action when :add - conf[dev] << config_file_contents(:add, target: resource.target, netmask: resource.netmask, gateway: resource.gateway) if resource.action == [:add] + conf[dev] << config_file_contents(:add, comment: resource.comment, target: resource.target, netmask: resource.netmask, gateway: resource.gateway) if resource.action == [:add] when :delete # need to do this for the case when the last route on an int # is removed @@ -231,6 +231,7 @@ class Chef content = "" case action when :add + content << "# #{options[:comment]}\n" if options[:comment] content << (options[:target]).to_s content << "/#{MASK[options[:netmask].to_s]}" if options[:netmask] content << " via #{options[:gateway]}" if options[:gateway] diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index 63079f997a..ecec56f69a 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -28,6 +28,7 @@ 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] property :netmask, [String, nil] property :gateway, [String, nil] property :device, [String, nil], desired_state: false # Has a partial default in the provider of eth0. |