mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-28 16:14:09 +02:00
parent
716f4a5d62
commit
f13ea9e1b8
@ -40,22 +40,21 @@ for agent, agent_info in inventory.items():
|
|||||||
|
|
||||||
print "apply Dependency \"host-zone-%s\" to Host {" % (agent_info["zone"])
|
print "apply Dependency \"host-zone-%s\" to Host {" % (agent_info["zone"])
|
||||||
print " parent_host_name = \"%s\"" % (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 ""
|
print ""
|
||||||
|
|
||||||
print "apply Dependency \"service-zone-%s\" to Service {" % (agent_info["zone"])
|
print "apply Dependency \"service-zone-%s\" to Service {" % (agent_info["zone"])
|
||||||
print " parent_host_name = \"%s\"" % (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 ""
|
print ""
|
||||||
|
|
||||||
print "zone \"%s\" {" % (agent_info["zone"])
|
|
||||||
|
|
||||||
for host, services in agent_info["repository"].items():
|
for host, services in agent_info["repository"].items():
|
||||||
if host != agent_info["zone"]:
|
if host != agent_info["zone"]:
|
||||||
print "object Host \"%s\" {" % (host)
|
print "object Host \"%s\" {" % (host)
|
||||||
print " check_command = \"dummy\""
|
print " check_command = \"dummy\""
|
||||||
|
print " zone = \"%s\"" % (agent_info["zone"])
|
||||||
print "}"
|
print "}"
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
@ -63,6 +62,7 @@ for agent, agent_info in inventory.items():
|
|||||||
print "object Service \"%s\" {" % (service)
|
print "object Service \"%s\" {" % (service)
|
||||||
print " check_command = \"dummy\""
|
print " check_command = \"dummy\""
|
||||||
print " host_name = \"%s\"" % (host)
|
print " host_name = \"%s\"" % (host)
|
||||||
|
print " zone = \"%s\"" % (agent_info["zone"])
|
||||||
print "}"
|
print "}"
|
||||||
print ""
|
print ""
|
||||||
|
|
||||||
|
@ -231,7 +231,6 @@ assign return T_ASSIGN;
|
|||||||
ignore return T_IGNORE;
|
ignore return T_IGNORE;
|
||||||
__function return T_FUNCTION;
|
__function return T_FUNCTION;
|
||||||
__return return T_RETURN;
|
__return return T_RETURN;
|
||||||
zone return T_ZONE;
|
|
||||||
__for return T_FOR;
|
__for return T_FOR;
|
||||||
\<\< { yylval->op = &Expression::OpShiftLeft; return T_SHIFT_LEFT; }
|
\<\< { yylval->op = &Expression::OpShiftLeft; return T_SHIFT_LEFT; }
|
||||||
\>\> { yylval->op = &Expression::OpShiftRight; return T_SHIFT_RIGHT; }
|
\>\> { yylval->op = &Expression::OpShiftRight; return T_SHIFT_RIGHT; }
|
||||||
|
@ -160,7 +160,6 @@ static void MakeRBinaryOp(Value** result, Expression::OpCallback& op, Value *lef
|
|||||||
%token T_IGNORE "ignore (T_IGNORE)"
|
%token T_IGNORE "ignore (T_IGNORE)"
|
||||||
%token T_FUNCTION "function (T_FUNCTION)"
|
%token T_FUNCTION "function (T_FUNCTION)"
|
||||||
%token T_RETURN "return (T_RETURN)"
|
%token T_RETURN "return (T_RETURN)"
|
||||||
%token T_ZONE "zone (T_ZONE)"
|
|
||||||
%token T_FOR "for (T_FOR)"
|
%token T_FOR "for (T_FOR)"
|
||||||
|
|
||||||
%type <text> identifier
|
%type <text> identifier
|
||||||
@ -251,7 +250,7 @@ statements: /* empty */
|
|||||||
| statements statement
|
| statements statement
|
||||||
;
|
;
|
||||||
|
|
||||||
statement: type | zone | include | include_recursive | library | constant
|
statement: type | include | include_recursive | library | constant
|
||||||
{
|
{
|
||||||
m_StatementNum++;
|
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
|
include: T_INCLUDE rterm sep
|
||||||
{
|
{
|
||||||
Expression::Ptr aexpr = *$2;
|
Expression::Ptr aexpr = *$2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user