diff --git a/contrib/make-agent-config.py b/contrib/make-agent-config.py index 6e2acbd27..80be48a0b 100755 --- a/contrib/make-agent-config.py +++ b/contrib/make-agent-config.py @@ -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 "" diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 133eab028..8b799e55a 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -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; } diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index b8d2fa549..a0898d81d 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -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 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;