-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make hosts / plugins / types always optional
The previous configuration did not allowed to create a host with only plugins or types which is quite common, just like the plugin allows to not pass hosts, plugins or types. For consistency, never require any "child" Struct. While here, extend and reorder the tests.
- Loading branch information
Showing
6 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<Plugin "threshold"> | ||
<%- $collectd::plugin::threshold::hosts.each |$host| { -%> | ||
<%- $collectd::plugin::threshold::hosts.lest || { [] }.each |$host| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/host.epp', { host => $host })) -%> | ||
<%- } -%> | ||
<%- $collectd::plugin::threshold::plugins.each |$plugin| { -%> | ||
<%- $collectd::plugin::threshold::plugins.lest || { [] }.each |$plugin| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', { plugin => $plugin })) -%> | ||
<%- } -%> | ||
<%- $collectd::plugin::threshold::types.each |$type| { -%> | ||
<%- $collectd::plugin::threshold::types.lest || { [] }.each |$type| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', { type => $type })) -%> | ||
<%- } -%> | ||
</Plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
<Host "<%= $host['name'] %>"> | ||
<%- $host['plugins'].each |$plugin| { -%> | ||
<%- $host['plugins'].lest || { [] }.each |$plugin| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/plugin.epp', { plugin => $plugin })) -%> | ||
<%- } -%> | ||
<%- $host['types'].each |$type| { -%> | ||
<%- $host['types'].lest || { [] }.each |$type| { -%> | ||
<%= collectd::indent(epp('collectd/plugin/threshold/type.epp', { type => $type })) -%> | ||
<%- } -%> | ||
</Host> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
type Collectd::Threshold::Host = Struct[{ | ||
name => String[1], | ||
plugins => Array[Collectd::Threshold::Plugin], | ||
types => Array[Collectd::Threshold::Type], | ||
plugins => Optional[Array[Collectd::Threshold::Plugin]], | ||
types => Optional[Array[Collectd::Threshold::Type]], | ||
}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
type Collectd::Threshold::Plugin = Struct[{ | ||
name => String[1], | ||
instance => Optional[String[1]], | ||
types => Array[Collectd::Threshold::Type], | ||
types => Optional[Array[Collectd::Threshold::Type]], | ||
}] |