Title: [opsview] [11827] Fixed validation so will fail if service check name starts with a space
- Revision
- 11827
- Author
- tvoon
- Date
- 2013-03-15 17:27:33 +0000 (Fri, 15 Mar 2013)
Log Message
Fixed validation so will fail if service check name starts with a space
Modified Paths
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2013-03-15 17:17:03 UTC (rev 11826)
+++ trunk/CHANGES 2013-03-15 17:27:33 UTC (rev 11827)
@@ -14,6 +14,7 @@
Removed OS - Linux Advanced opspack from fresh installs
FIXES:
Fixed IOS host notifications not showing correct detail
+ Fixed validation so that spaces are not allowed at beginning of service check names
3.20130304
ENHANCEMENTS:
Modified: trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm
===================================================================
--- trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm 2013-03-15 17:17:03 UTC (rev 11826)
+++ trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm 2013-03-15 17:27:33 UTC (rev 11827)
@@ -533,7 +533,7 @@
required => [qw/name checktype/],
optional => [qw/notification_options/],
constraint_methods => {
- name => qr/^[\w \.\/-]{1,63}$/,
+ name => qr/^[\w\.\/-][\w \.\/-]{1,62}$/,
checktype => qr/^\d+$/,
notification_options => qr/^([wcurfsn])(,[wcurfs])*$/,
},
Modified: trunk/opsview-core/t/949servicechecks.t
===================================================================
--- trunk/opsview-core/t/949servicechecks.t 2013-03-15 17:17:03 UTC (rev 11826)
+++ trunk/opsview-core/t/949servicechecks.t 2013-03-15 17:27:33 UTC (rev 11827)
@@ -380,7 +380,7 @@
my $validation = $rs->validation_regexp;
my $v_expected = {
- name => q{/^[\w \./-]{1,63}$/},
+ name => q{/^[\w\./-][\w \./-]{1,62}$/},
checktype => q{/^\d+$/},
notification_options => "/^([wcurfsn])(,[wcurfs])*\$/",
};
@@ -516,6 +516,18 @@
eval {
$rs->synchronise(
{
+ name => " space at front",
+ checktype => 1,
+ servicegroup => 1,
+ plugin => "check_tcp",
+ }
+ );
+};
+is( $@, "name: Invalid\n", "No space allowed at front" );
+
+eval {
+ $rs->synchronise(
+ {
name =>
"1234567890123456789012345678901234567890123456789012345678901234",
checktype => 1,
_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins