Title: [opsview] [11838] Fix servicecheck constraint so that services with a single character still pass validation
Revision
11838
Author
tvoon
Date
2013-03-18 13:47:54 +0000 (Mon, 18 Mar 2013)

Log Message

Fix servicecheck constraint so that services with a single character still pass validation

Modified Paths

Modified: trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm
===================================================================
--- trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm	2013-03-18 13:47:38 UTC (rev 11837)
+++ trunk/opsview-core/lib/Opsview/Schema/Servicechecks.pm	2013-03-18 13:47:54 UTC (rev 11838)
@@ -533,7 +533,7 @@
         required           => [qw/name checktype/],
         optional           => [qw/notification_options/],
         constraint_methods => {
-            name                 => qr/^[\w\.\/-][\w \.\/-]{1,62}$/,
+            name                 => qr/^[\w\.\/-][\w \.\/-]{0,62}$/,
             checktype            => qr/^\d+$/,
             notification_options => qr/^([wcurfsn])(,[wcurfs])*$/,
         },

Modified: trunk/opsview-core/t/949servicechecks.t
===================================================================
--- trunk/opsview-core/t/949servicechecks.t	2013-03-18 13:47:38 UTC (rev 11837)
+++ trunk/opsview-core/t/949servicechecks.t	2013-03-18 13:47:54 UTC (rev 11838)
@@ -380,7 +380,7 @@
 
 my $validation = $rs->validation_regexp;
 my $v_expected = {
-    name                 => q{/^[\w\./-][\w \./-]{1,62}$/},
+    name                 => q{/^[\w\./-][\w \./-]{0,62}$/},
     checktype            => q{/^\d+$/},
     notification_options => "/^([wcurfsn])(,[wcurfs])*\$/",
 };
@@ -641,4 +641,14 @@
     "Can create servicecheck object here with no plugin"
 );
 
+$obj = $rs->synchronise(
+    {
+        name         => "/",
+        checktype    => 1,
+        servicegroup => 1,
+        plugin       => "check_tcp",
+    }
+);
+is( $obj->name, "/", "slash in front of name is okay" );
+
 1;

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to