Remove zone keyword

fixes #7400
This commit is contained in:
Gunnar Beutner 2014-10-17 12:45:57 +02:00
parent 716f4a5d62
commit f13ea9e1b8
3 changed files with 5 additions and 44 deletions

View File

@ -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 ""

View 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; }

View 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;