From c39c60f31cc00ae88c5fb762b2f003a5e1e46cc0 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 2 Aug 2015 10:07:54 +0100 Subject: [PATCH 1/2] Add support for custom include paths For example using Dokku and it's monit plugin, I need to specifically include "/home/dokku/*/monitrc" which wasn't possible previously. --- attributes/default.rb | 2 ++ templates/default/monitrc.erb | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index 46c821a..34349eb 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -71,6 +71,8 @@ default["monit"]["includes_dir"] = "/etc/monit/conf.d" end +default["monit"]["includes"] = [] + # The monit::default recipe will load these monit_monitrc resources automatically # NOTE setting this attribute at the default level will append values to the array default["monit"]["default_monitrc_configs"] = %w[load ssh] diff --git a/templates/default/monitrc.erb b/templates/default/monitrc.erb index d028270..d63db12 100644 --- a/templates/default/monitrc.erb +++ b/templates/default/monitrc.erb @@ -72,4 +72,9 @@ set httpd port <%= node["monit"]["web_interface"]["port"] %> <% end %> # Include config files -include <%= node["monit"]["includes_dir"] %>/* +include "<%= node["monit"]["includes_dir"] %>/*" +<% if node["monit"]["includes"] && node["monit"]["includes"].size > 0 %> + <% node["monit"]["includes"].each do |path| %> +include "<%= path %>" + <% end %> +<% end %> From 8370b07dc2004a60b38fe1afe092a32c382d3d2d Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 2 Aug 2015 10:14:44 +0100 Subject: [PATCH 2/2] Update readme --- README.md | 3 +++ attributes/default.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 91fb8fe..7fb21cf 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,9 @@ else default["monit"]["includes_dir"] = "/etc/monit/conf.d" end +# Custom include paths. +default["monit"]["includes"] = [] + # The monit::default recipe will load these monit_monitrc resources automatically # NOTE setting this attribute at the default level will append values to the array default["monit"]["default_monitrc_configs"] = %w[load ssh] diff --git a/attributes/default.rb b/attributes/default.rb index 34349eb..ca49390 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -71,6 +71,7 @@ default["monit"]["includes_dir"] = "/etc/monit/conf.d" end +# Custom include paths. default["monit"]["includes"] = [] # The monit::default recipe will load these monit_monitrc resources automatically