Skip to content

Commit

Permalink
add feature to use attributes from host and service objects in data t…
Browse files Browse the repository at this point in the history
…ype Interval
  • Loading branch information
lbetz committed Sep 1, 2023
1 parent 6d30ae9 commit f2ef1c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions spec/type_aliases/interval_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'Icinga2::Interval' do
describe 'valid handling' do
[60, '3d', '3.5d', '4h', '4.1h', '5m', '5.2m', '60s', '60.4', '300', '300.25', '$macro$'].each do |value|
[60, '3d', '3.5d', '4h', '4.1h', '5m', '5.2m', '60s', '60.4', '300', '300.25', '$macro$', 'host.foo', 'service.foo'].each do |value|
describe value.inspect do
it { is_expected.to allow_value(value) }
end
Expand All @@ -13,7 +13,7 @@

describe 'invalid path handling' do
context 'garbage inputs' do
[nil, '', 'm', 'foo', '2h4' ].each do |value|
[nil, '', 'm', 'foo', '2h4', 'host.', 'service.'].each do |value|
describe value.inspect do
it { is_expected.not_to allow_value(value) }
end
Expand Down
2 changes: 1 addition & 1 deletion types/interval.pp
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# A strict type for intervals
type Icinga2::Interval = Variant[Integer, Pattern[/\A\d+\.?\d*[d|h|m|s]?\Z/, /\A\$.+\$\Z/]]
type Icinga2::Interval = Variant[Integer, Pattern[/\A\d+\.?\d*[d|h|m|s]?\Z/, /\A\$.+\$\Z/, /\A(host|service)\..+/]]

0 comments on commit f2ef1c6

Please sign in to comment.