]> granicus.if.org Git - icinga2/commitdiff
Rename "optional" attribute to "required" and change the default value.
authorGunnar Beutner <gunnar.beutner@netways.de>
Tue, 29 Apr 2014 08:41:32 +0000 (10:41 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Tue, 29 Apr 2014 08:41:32 +0000 (10:41 +0200)
Fixes #6069

itl/command-common.conf
lib/icinga/icinga-type.conf
lib/icinga/pluginutility.cpp

index fa1a38974cf6e2d4c94ce471098b2d932d256ee6..16502c3c097c0f14c21fbc6636f4abe170d4e3ce 100644 (file)
@@ -28,14 +28,8 @@ template CheckCommand "ping-common" {
                "-H" = "$ping_address$"
                "-w" = "$ping_wrta$,$ping_wpl$%"
                "-c" = "$ping_crta$,$ping_cpl$%"
-               "-p" = {
-                       value = "$ping_packets$"
-                       optional = true
-               }
-               "-t" = {
-                       value = "$ping_timeout$"
-                       optional = true
-               }
+               "-p" = "$ping_packets$"
+               "-t" = "$ping_timeout$"
        }
 
        vars.ping_wrta = 100
@@ -120,30 +114,15 @@ object CheckCommand "http" {
        command = PluginDir + "/check_http"
        
        arguments = {
-               "-H" = {
-                       value = "$http_vhost$"
-                       optional = true
-               }
+               "-H" = "$http_vhost$"
                "-I" = "$http_address$"
-               "-u" = {
-                       value = "$http_uri$"
-                       optional = true
-               }
-               "-p" = {
-                       value = "$http_port$"
-                       optional = true
-               }
+               "-u" = "$http_uri$"
+               "-p" = "$http_port$"
                "-S" = {
                        set_if = "$http_ssl$"
                }
-               "-w" = {
-                       value = "$http_warn_time$"
-                       optional = true
-               }
-               "-c" = {
-                       value = "$http_critical_time$"
-                       optional = true
-               }
+               "-w" = "$http_warn_time$"
+               "-c" = "$http_critical_time$"
        }
 
        vars.http_address = "$address$"
@@ -169,10 +148,7 @@ object CheckCommand "ssmtp" {
 
        arguments = {
                "-H" = "$ssmtp_address$"
-               "-p" = {
-                       value = "$ssmtp_port$"
-                       optional = true
-               }
+               "-p" = "$ssmtp_port$"
        }
 
        vars.ssmtp_address = "$address$"
@@ -196,10 +172,7 @@ object CheckCommand "ssh" {
        command = PluginDir + "/check_ssh"
 
        arguments = {
-               "-p" = {
-                       value = "$ssh_port$"
-                       optional = true
-               }
+               "-p" = "$ssh_port$"
                "host" = {
                        value = "$ssh_address$"
                        skip_key = true
index cedebc4605868a1e9924c0ca9a44b714329c65fd..43e493ab4d7ff8941f08fc36173c63a30b03b4be 100644 (file)
                %attribute %dictionary "*" {
                        %attribute %string "value"
                        %attribute %string "description"
-                       %attribute %number "optional"
+                       %attribute %number "required"
                        %attribute %number "skip_key"
                        %attribute %string "set_if"
                        %attribute %number "order"
index 8e1c04e99feb658d3d1e45a4d3afc30583f51436..6aafab9030b21354109c3efddeefba046f11a6aa 100644 (file)
@@ -89,13 +89,14 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
                        CommandArgument arg;
                        arg.Key = kv.first;
 
-                       bool optional = false;
+                       bool required = false;
                        String argval;
 
                        if (arginfo.IsObjectType<Dictionary>()) {
                                Dictionary::Ptr argdict = arginfo;
                                argval = argdict->Get("value");
-                               optional = argdict->Get("optional");
+                               if (argdict->Contains("required"))
+                                       required = argdict->Get("required");
                                arg.SkipKey = argdict->Get("skip_key");
                                arg.Order = argdict->Get("order");
 
@@ -121,7 +122,7 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
                            checkable->GetLastCheckResult(), &missingMacro);
 
                        if (!missingMacro.IsEmpty()) {
-                               if (!optional) {
+                               if (required) {
                                        String message = "Non-optional macro '" + missingMacro + "' used in argument '" +
                                            arg.Key + "' is missing while executing command '" + commandObj->GetName() +
                                            "' for object '" + checkable->GetName() + "'";