]> granicus.if.org Git - icinga2/commitdiff
Remove zone keyword
authorGunnar Beutner <gunnar@beutner.name>
Fri, 17 Oct 2014 10:45:57 +0000 (12:45 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Fri, 17 Oct 2014 10:45:57 +0000 (12:45 +0200)
fixes #7400

contrib/make-agent-config.py
lib/config/config_lexer.ll
lib/config/config_parser.yy

index 6e2acbd27051e7cc410934a71d8177f5ac49cac9..80be48a0b172af5b5783fa01de2d445f67097924 100755 (executable)
@@ -40,22 +40,21 @@ for agent, agent_info in inventory.items():
 
     print "apply Dependency \"host-zone-%s\" to Host {" % (agent_info["zone"])
     print "  parent_host_name = \"%s\"" % (agent_info["zone"])
-    print "  assign where host.@zone == \"%s\"" % (agent_info["zone"])
+    print "  assign where host.zone == \"%s\"" % (agent_info["zone"])
     print "}"
     print ""
 
     print "apply Dependency \"service-zone-%s\" to Service {" % (agent_info["zone"])
     print "  parent_host_name = \"%s\"" % (agent_info["zone"])
-    print "  assign where service.@zone == \"%s\"" % (agent_info["zone"])
+    print "  assign where service.zone == \"%s\"" % (agent_info["zone"])
     print "}"
     print ""
 
-    print "zone \"%s\" {" % (agent_info["zone"])
-
     for host, services in agent_info["repository"].items():
         if host != agent_info["zone"]:
             print "object Host \"%s\" {" % (host)
             print "  check_command = \"dummy\""
+            print "  zone = \"%s\"" % (agent_info["zone"])
             print "}"
             print ""
 
@@ -63,6 +62,7 @@ for agent, agent_info in inventory.items():
             print "object Service \"%s\" {" % (service)
             print "  check_command = \"dummy\""
             print "  host_name = \"%s\"" % (host)
+            print "  zone = \"%s\"" % (agent_info["zone"])
             print "}"
             print ""
 
index 133eab02897458faf763897bd183cb44cca337cc..8b799e55a14895f3c4ecb6e402ed3c92947d8e64 100644 (file)
@@ -231,7 +231,6 @@ assign                              return T_ASSIGN;
 ignore                         return T_IGNORE;
 __function                     return T_FUNCTION;
 __return                       return T_RETURN;
-zone                           return T_ZONE;
 __for                          return T_FOR;
 \<\<                           { yylval->op = &Expression::OpShiftLeft; return T_SHIFT_LEFT; }
 \>\>                           { yylval->op = &Expression::OpShiftRight; return T_SHIFT_RIGHT; }
index b8d2fa549182dcb6c854f0494b4cd2ea07b79d32..a0898d81df43f5de45098e1bd4959a7568c5f433 100644 (file)
@@ -160,7 +160,6 @@ static void MakeRBinaryOp(Value** result, Expression::OpCallback& op, Value *lef
 %token T_IGNORE "ignore (T_IGNORE)"
 %token T_FUNCTION "function (T_FUNCTION)"
 %token T_RETURN "return (T_RETURN)"
-%token T_ZONE "zone (T_ZONE)"
 %token T_FOR "for (T_FOR)"
 
 %type <text> identifier
@@ -251,7 +250,7 @@ statements: /* empty */
        | statements statement
        ;
 
-statement: type | zone | include | include_recursive | library | constant
+statement: type | include | include_recursive | library | constant
        {
                m_StatementNum++;
        }
@@ -267,43 +266,6 @@ statement: type | zone | include | include_recursive | library | constant
        }
        ;
 
-zone: T_ZONE rterm sep
-       {
-               Expression::Ptr aexpr = *$2;
-               delete $2;
-
-               if (!context->GetZone().IsEmpty())
-                       BOOST_THROW_EXCEPTION(std::invalid_argument("Zone name cannot be changed once it's been set."));
-
-               if (m_StatementNum != 0)
-                       BOOST_THROW_EXCEPTION(std::invalid_argument("'zone' directive must be the first statement in a file."));
-
-               context->SetZone(aexpr->Evaluate(m_ModuleScope));
-       }
-       | T_ZONE rterm
-       {
-               Expression::Ptr aexpr = *$2;
-               delete $2;
-
-               if (!context->GetZone().IsEmpty())
-                       BOOST_THROW_EXCEPTION(std::invalid_argument("Zone name cannot be changed once it's been set."));
-
-               context->SetZone(aexpr->Evaluate(m_ModuleScope));
-       }
-       rterm_scope sep
-       {
-               Expression::Ptr ascope = *$4;
-               delete $4;
-
-               try {
-                       ascope->Evaluate(m_ModuleScope);
-                       context->SetZone(String());
-               } catch (...) {
-                       context->SetZone(String());
-               }
-       }
-       ;
-
 include: T_INCLUDE rterm sep
        {
                Expression::Ptr aexpr = *$2;