Commit 79336e11 authored by Blerim Sheqa's avatar Blerim Sheqa

Merge branch 'bug/Remove-hash-validation-of-vars-attribut-13917'

parents 7c603029 efe87053
......@@ -60,11 +60,7 @@
#
# It's not currently possible to use arrays or dictionaries in a string, like
#
# attr => 'array1 + [ item1, item2, ... ]'
#
# Assignments other than simple attribution are not currently possible either, e.g. building something like
#
# vars += config
# attr => 'array1 + [ item1, item2, ... ]' or attr => 'hash1 + { item1, ... }'
#
# === Authors
#
......
......@@ -22,7 +22,8 @@
# A dictionary of macros which should be exported as environment variables prior to executing the command.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this command.
# A dictionary containing custom attributes that are specific to this command
# or a string to do operations on this dictionary.
#
# [*timeout*]
# The command timeout in seconds. Defaults to 60 seconds.
......@@ -70,7 +71,6 @@ define icinga2::object::checkcommand(
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
if $env { validate_hash($env) }
if $vars { validate_hash($vars) }
if $timeout { validate_integer($timeout) }
if $arguments { validate_hash($arguments) }
......
......@@ -23,7 +23,8 @@
# A dictionary of macros which should be exported as environment variables prior to executing the command.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this command.
# A dictionary containing custom attributes that are specific to this command
# or a string to do operations on this dictionary.
#
# [*timeout*]
# The command timeout in seconds. Defaults to 60 seconds.
......@@ -72,7 +73,6 @@ define icinga2::object::eventcommand (
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
if $env { validate_hash($env) }
if $vars { validate_hash($vars) }
if $timeout { validate_integer($timeout) }
if $arguments { validate_hash($arguments) }
......
......@@ -23,7 +23,8 @@
# The host's address v6.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this host.
# A dictionary containing custom attributes that are specific to this host
# or a string to do operations on this dictionary.
#
# [*groups*]
# A list of host groups this host belongs to.
......@@ -160,7 +161,6 @@ define icinga2::object::host(
if $host_name { validate_string($host_name) }
if $address { validate_string($address) }
if $address6 { validate_string($address6) }
if $vars { validate_hash($vars) }
if $groups { validate_array($groups) }
if $display_name { validate_string($display_name) }
validate_string($check_command)
......
......@@ -19,7 +19,7 @@
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this
# notification object.
# notification object or a string to do operations on this dictionary.
#
# [*users*]
# A list of user names who should be notified.
......@@ -121,7 +121,6 @@ define icinga2::object::notification (
validate_string ($host_name)
if $service_name { validate_string ($service_name)}
if $vars { validate_hash ($vars )}
if $users { validate_array ($users )}
if $user_groups { validate_array ($user_groups )}
if $times { validate_hash ($times )}
......
......@@ -25,7 +25,8 @@
# prior to executing the command.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this command.
# A dictionary containing custom attributes that are specific to this command
# or a string to do operations on this dictionary.
#
# [*timeout*]
# The command timeout in seconds. Defaults to 60 seconds.
......@@ -80,7 +81,6 @@ define icinga2::object::notificationcommand (
if !is_array($command) { validate_string($command) }
if !is_string($command) { validate_array($command) }
if $env { validate_hash ($env) }
if $vars { validate_hash ($vars) }
if $timeout { validate_integer ($timeout) }
if $arguments { validate_hash ($arguments) }
......
......@@ -25,7 +25,8 @@
# The service groups this service belongs to.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this service.
# A dictionary containing custom attributes that are specific to this service
# or a string to do operations on this dictionary.
#
# [*check_command*]
# The name of the check command.
......@@ -124,6 +125,33 @@
# [*order*]
# String to set the position in the target file, sorted alpha numeric. Defaults to 10.
#
# === Examples
#
# A service `ping` is applied to all hosts with a valid ipv4 address.
#
# ::icinga2::object::service { 'ping4':
# import => ['generic-service'],
# apply => true,
# check_command => 'ping',
# assign => ['host.address'],
# target => '/etc/icinga2/zones.d/global-templates/services.conf',
# }
#
# A `apply Service for (disk_name =>config in host.vars.disks)` rule is applied
# to all Linux hosts with an Icinga Agent. Note in this example it's required that
# the endpoint (see `command_endpoint`) and the host object has the same name!
#
# ::icinga2::object::service { 'linux_disks':
# import => ['generic-service'],
# apply => 'disk_name =>config in host.vars.disks',
# check_command => 'disk',
# command_endpoint => 'host.name',
# vars => 'vars + config',
# assign => ['host.vars.os == Linux'],
# ignore => ['host.vars.noagent'],
# target => '/etc/icinga2/zones.d/global-templates/services.conf',
# }
#
# === Authors
#
# Alessandro Lorenzi <alessandro@lm-net.it>
......@@ -137,7 +165,7 @@ define icinga2::object::service (
$display_name = undef,
$host_name = undef,
$groups = undef,
$vars = {},
$vars = undef,
$check_command = undef,
$max_check_attempts = undef,
$check_period = undef,
......@@ -185,7 +213,6 @@ define icinga2::object::service (
if $display_name { validate_string ($display_name) }
validate_string($host_name)
if $groups { validate_array ($groups) }
if $vars { validate_hash ($vars) }
validate_string($check_command)
if $max_check_attempts { validate_integer ($max_check_attempts) }
if $check_period { validate_string ($check_period) }
......
......@@ -20,7 +20,8 @@
# A pager string for this user. Useful for notification commands.
#
# [*vars*]
# A dictionary containing custom attributes that are specific to this user.
# A dictionary containing custom attributes that are specific to this user
# or a string to do operations on this dictionary.
#
# [*groups*]
# An array of group names.
......@@ -91,7 +92,6 @@ define icinga2::object::user (
if $display_name { validate_string ($display_name) }
if $email { validate_string ($email) }
if $pager { validate_string ($pager) }
if $vars { validate_hash ($vars) }
if $groups { validate_array ($groups) }
if $enable_notifications { validate_bool ($enable_notifications) }
if $period { validate_string ($period) }
......
......@@ -48,13 +48,6 @@ describe('icinga2::object::checkcommand', :type => :define) do
end
context "#{os} with vars => foo (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with timeout => 30" do
let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} }
......@@ -148,13 +141,6 @@ describe('icinga2::object::checkcommand', :type => :define) do
end
context "Windows 2012 R2 with vars => foo (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with timeout => 30" do
let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} }
......
......@@ -79,13 +79,6 @@ describe('icinga2::object::eventcommand', :type => :define) do
end
context "#{os} with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with timeout => 30" do
let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} }
......@@ -216,13 +209,6 @@ describe('icinga2::object::eventcommand', :type => :define) do
end
context "Windows 2012 R2 with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with timeout => 30" do
let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} }
......
......@@ -63,12 +63,6 @@ describe('icinga2::object::notification', :type => :define) do
end
context "#{os} with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz', :host_name => 'foohost'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with users => [foo, bar]" do
let(:params) { {:users => ['foo','bar'], :target => '/bar/baz', :host_name => 'foohost'} }
......@@ -275,12 +269,6 @@ describe('icinga2::object::notification', :type => :define) do
end
context "Windows 2012 R2 with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz', :host_name => 'foohost'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with users => [foo, bar]" do
let(:params) { {:users => ['foo','bar'], :target => 'C:/bar/baz', :host_name => 'foohost'} }
......
......@@ -79,13 +79,6 @@ describe('icinga2::object::notificationcommand', :type => :define) do
end
context "#{os} with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with timeout => 30" do
let(:params) { {:timeout => '30', :target => '/bar/baz', :command => ['foocommand']} }
......@@ -215,13 +208,6 @@ describe('icinga2::object::notificationcommand', :type => :define) do
end
context "Windows 2012 R2 with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz', :command => ['foocommand']} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with timeout => 30" do
let(:params) { {:timeout => '30', :target => 'C:/bar/baz', :command => ['foocommand']} }
......
......@@ -92,15 +92,6 @@ describe('icinga2::object::service', :type => :define) do
end
context "#{os} with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz',
:host_name => 'hostfoo',
:check_command => 'commandfoo'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with check_command => foo" do
let(:params) { {:check_command => 'foo', :target => '/bar/baz',
:host_name => 'hostfoo'} }
......@@ -540,15 +531,6 @@ describe('icinga2::object::service', :type => :define) do
end
context "Windows 2012 R2 with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz',
:host_name => 'hostfoo',
:check_command => 'commandfoo'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with check_command => foo" do
let(:params) { {:check_command => 'foo', :target => 'C:/bar/baz',
:host_name => 'hostfoo'} }
......
......@@ -73,12 +73,6 @@ describe('icinga2::object::user', :type => :define) do
end
context "#{os} with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => '/bar/baz'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "#{os} with groups => [foo, bar]" do
let(:params) { {:groups => ['foo','bar'], :target => '/bar/baz'} }
......@@ -238,12 +232,6 @@ describe('icinga2::object::user', :type => :define) do
end
context "Windows 2012 R2 with vars => 'foo' (not a valid hash)" do
let(:params) { {:vars => 'foo', :target => 'C:/bar/baz'} }
it { is_expected.to raise_error(Puppet::Error, /"foo" is not a Hash/) }
end
context "Windows 2012 R2 with groups => [foo, bar]" do
let(:params) { {:groups => ['foo','bar'], :target => 'C:/bar/baz'} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment