mirror of https://github.com/Icinga/icinga2.git
Implement config support for arrays.
This commit is contained in:
parent
58f0c863a6
commit
07421751ad
|
@ -21,9 +21,12 @@ object HostGroup "all-hosts" {
|
||||||
display_name = "All Hosts"
|
display_name = "All Hosts"
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract object Host "itl-host" {
|
template Host "itl-host" {
|
||||||
hostgroups = { "all-hosts" },
|
hostgroups = [ "all-hosts" ],
|
||||||
|
|
||||||
services = { "ping4" },
|
services["ping4"] = {
|
||||||
|
templates = [ "ping4" ]
|
||||||
|
},
|
||||||
|
|
||||||
hostcheck = "ping4"
|
hostcheck = "ping4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
template Service "ping4" inherits "plugin-service" {
|
template Service "ping4" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_ping",
|
"$plugindir$/check_ping",
|
||||||
"-4",
|
"-4",
|
||||||
"-H", "$address$",
|
"-H", "$address$",
|
||||||
|
@ -26,7 +26,7 @@ template Service "ping4" inherits "plugin-service" {
|
||||||
"-c", "$crta$,$cpl$%",
|
"-c", "$crta$,$cpl$%",
|
||||||
"-p", "$packets$",
|
"-p", "$packets$",
|
||||||
"-t", "$timeout$"
|
"-t", "$timeout$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros = {
|
macros = {
|
||||||
wrta = 100,
|
wrta = 100,
|
||||||
|
@ -41,7 +41,7 @@ template Service "ping4" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "ping6" inherits "plugin-service" {
|
template Service "ping6" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_ping",
|
"$plugindir$/check_ping",
|
||||||
"-6",
|
"-6",
|
||||||
"-H", "$address6$",
|
"-H", "$address6$",
|
||||||
|
@ -49,7 +49,7 @@ template Service "ping6" inherits "plugin-service" {
|
||||||
"-c", "$crta$,$cpl$%",
|
"-c", "$crta$,$cpl$%",
|
||||||
"-p", "$packets$",
|
"-p", "$packets$",
|
||||||
"-t", "$timeout$"
|
"-t", "$timeout$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros = {
|
macros = {
|
||||||
wrta = 100,
|
wrta = 100,
|
||||||
|
@ -64,12 +64,12 @@ template Service "ping6" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "dummy" inherits "plugin-service" {
|
template Service "dummy" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_dummy",
|
"$plugindir$/check_dummy",
|
||||||
"$state$",
|
"$state$",
|
||||||
"$text$"
|
"$text$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros = {
|
macros = {
|
||||||
state = 0,
|
state = 0,
|
||||||
text = "Check was successful."
|
text = "Check was successful."
|
||||||
|
@ -77,62 +77,62 @@ template Service "dummy" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "tcp" inherits "plugin-service" {
|
template Service "tcp" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_tcp",
|
"$plugindir$/check_tcp",
|
||||||
"-H", "$address$",
|
"-H", "$address$",
|
||||||
"-p", "$port$"
|
"-p", "$port$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "udp" inherits "plugin-service" {
|
template Service "udp" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_udp",
|
"$plugindir$/check_udp",
|
||||||
"-H", "$address$",
|
"-H", "$address$",
|
||||||
"-p", "$port$"
|
"-p", "$port$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "http_vhost" inherits "plugin-service" {
|
template Service "http_vhost" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_http",
|
"$plugindir$/check_http",
|
||||||
"-H", "$vhost$"
|
"-H", "$vhost$"
|
||||||
},
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "http_ip" inherits "plugin-service" {
|
template Service "http_ip" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_http",
|
"$plugindir$/check_http",
|
||||||
"-I", "$address$"
|
"-I", "$address$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "https_vhost" inherits "plugin-service" {
|
template Service "https_vhost" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_http",
|
"$plugindir$/check_http",
|
||||||
"-H", "$vhost", "-S"
|
"-H", "$vhost", "-S"
|
||||||
},
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "https_ip" inherits "plugin-service" {
|
template Service "https_ip" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_http",
|
"$plugindir$/check_http",
|
||||||
"-I", "$address$", "-S"
|
"-I", "$address$", "-S"
|
||||||
},
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "smtp" inherits "plugin-service" {
|
template Service "smtp" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_smtp",
|
"$plugindir$/check_smtp",
|
||||||
"-H", "$address$"
|
"-H", "$address$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "ssmtp" inherits "plugin-service" {
|
template Service "ssmtp" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_ssmtp",
|
"$plugindir$/check_ssmtp",
|
||||||
"-H", "$address$",
|
"-H", "$address$",
|
||||||
"-p", "$port$"
|
"-p", "$port$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros += {
|
macros += {
|
||||||
port = 465
|
port = 465
|
||||||
|
@ -140,25 +140,25 @@ template Service "ssmtp" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "ntp_time" inherits "plugin-service" {
|
template Service "ntp_time" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_ntp_time",
|
"$plugindir$/check_ntp_time",
|
||||||
"-H", "$address$"
|
"-H", "$address$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "ssh" inherits "plugin-service" {
|
template Service "ssh" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_ssh",
|
"$plugindir$/check_ssh",
|
||||||
"$address$"
|
"$address$"
|
||||||
}
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "disk" inherits "plugin-service" {
|
template Service "disk" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_disk",
|
"$plugindir$/check_disk",
|
||||||
"-w", "$wfree$",
|
"-w", "$wfree$",
|
||||||
"-c", "$cfree$"
|
"-c", "$cfree$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros += {
|
macros += {
|
||||||
wfree = "20%",
|
wfree = "20%",
|
||||||
|
@ -167,24 +167,24 @@ template Service "disk" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "users" inherits "plugin-service" {
|
template Service "users" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_users",
|
"$plugindir$/check_users",
|
||||||
"-w", "$wgreater$",
|
"-w", "$wgreater$",
|
||||||
"-c", "$cgreater$"
|
"-c", "$cgreater$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros += {
|
macros += {
|
||||||
wgreater = 20,
|
wgreater = 20,
|
||||||
cgreater = 50,
|
cgreater = 50,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "processes" inherits "plugin-service" {
|
template Service "processes" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_procs",
|
"$plugindir$/check_procs",
|
||||||
"-w", "$wgreater$",
|
"-w", "$wgreater$",
|
||||||
"-c", "$cgreater$"
|
"-c", "$cgreater$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros += {
|
macros += {
|
||||||
wgreater = 250,
|
wgreater = 250,
|
||||||
|
@ -194,11 +194,11 @@ template Service "processes" inherits "plugin-service" {
|
||||||
|
|
||||||
|
|
||||||
template Service "load" inherits "plugin-service" {
|
template Service "load" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_load",
|
"$plugindir$/check_load",
|
||||||
"-w", "$wload1$,$wload5$,$wload15$",
|
"-w", "$wload1$,$wload5$,$wload15$",
|
||||||
"-c", "$cload1$,$cload5$,$cload15$"
|
"-c", "$cload1$,$cload5$,$cload15$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros = {
|
macros = {
|
||||||
wload1 = 5.0,
|
wload1 = 5.0,
|
||||||
|
@ -212,12 +212,12 @@ template Service "load" inherits "plugin-service" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "snmp" inherits "plugin-service" {
|
template Service "snmp" inherits "plugin-service" {
|
||||||
check_command = {
|
check_command = [
|
||||||
"$plugindir$/check_snmp",
|
"$plugindir$/check_snmp",
|
||||||
"-H", "$address$",
|
"-H", "$address$",
|
||||||
"-o", "$oid$",
|
"-o", "$oid$",
|
||||||
"-C", "$community$"
|
"-C", "$community$"
|
||||||
},
|
],
|
||||||
|
|
||||||
macros = {
|
macros = {
|
||||||
community = "public"
|
community = "public"
|
||||||
|
|
|
@ -22,7 +22,7 @@ object ServiceGroup "all-services" {
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "itl-service" {
|
template Service "itl-service" {
|
||||||
servicegroups = { "all-services" }
|
servicegroups = [ "all-services" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
template Service "null-service" inherits "itl-service" {
|
template Service "null-service" inherits "itl-service" {
|
||||||
|
|
|
@ -370,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
||||||
*yy_cp = '\0'; \
|
*yy_cp = '\0'; \
|
||||||
yyg->yy_c_buf_p = yy_cp;
|
yyg->yy_c_buf_p = yy_cp;
|
||||||
|
|
||||||
#define YY_NUM_RULES 55
|
#define YY_NUM_RULES 56
|
||||||
#define YY_END_OF_BUFFER 56
|
#define YY_END_OF_BUFFER 57
|
||||||
/* This struct is not used in this scanner,
|
/* This struct is not used in this scanner,
|
||||||
but its presence is necessary. */
|
but its presence is necessary. */
|
||||||
struct yy_trans_info
|
struct yy_trans_info
|
||||||
|
@ -379,29 +379,29 @@ struct yy_trans_info
|
||||||
flex_int32_t yy_verify;
|
flex_int32_t yy_verify;
|
||||||
flex_int32_t yy_nxt;
|
flex_int32_t yy_nxt;
|
||||||
};
|
};
|
||||||
static yyconst flex_int16_t yy_accept[193] =
|
static yyconst flex_int16_t yy_accept[197] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 56, 54,
|
0, 0, 0, 0, 0, 0, 0, 0, 57, 55,
|
||||||
21, 21, 1, 54, 54, 42, 54, 54, 54, 48,
|
21, 21, 1, 55, 55, 43, 55, 55, 55, 49,
|
||||||
54, 49, 42, 42, 42, 42, 42, 42, 42, 42,
|
55, 50, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
42, 42, 42, 54, 18, 19, 12, 3, 2, 55,
|
43, 43, 43, 55, 18, 19, 12, 3, 2, 56,
|
||||||
15, 15, 21, 0, 0, 0, 0, 0, 42, 52,
|
15, 15, 21, 0, 0, 0, 0, 0, 43, 53,
|
||||||
50, 48, 51, 16, 20, 53, 0, 45, 46, 47,
|
51, 49, 52, 16, 20, 54, 0, 46, 47, 48,
|
||||||
0, 43, 42, 42, 42, 42, 42, 42, 42, 42,
|
0, 44, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
42, 42, 42, 42, 42, 42, 0, 18, 17, 12,
|
43, 43, 43, 43, 43, 43, 43, 0, 18, 17,
|
||||||
11, 4, 5, 9, 10, 6, 8, 7, 0, 0,
|
12, 11, 4, 5, 9, 10, 6, 8, 7, 0,
|
||||||
0, 0, 0, 0, 20, 48, 44, 42, 27, 42,
|
0, 0, 0, 0, 0, 20, 49, 45, 43, 28,
|
||||||
|
|
||||||
42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
|
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||||
42, 42, 13, 4, 5, 14, 0, 0, 0, 0,
|
43, 43, 43, 43, 13, 4, 5, 14, 0, 0,
|
||||||
0, 42, 42, 42, 42, 42, 38, 42, 42, 42,
|
0, 0, 0, 43, 43, 43, 43, 43, 43, 39,
|
||||||
42, 42, 42, 40, 22, 4, 0, 0, 0, 0,
|
43, 43, 43, 43, 43, 43, 41, 22, 4, 0,
|
||||||
0, 42, 42, 41, 42, 32, 42, 42, 42, 42,
|
0, 0, 0, 0, 43, 24, 43, 42, 43, 33,
|
||||||
42, 42, 0, 0, 0, 0, 0, 42, 42, 42,
|
43, 43, 43, 43, 43, 43, 0, 0, 0, 0,
|
||||||
24, 33, 42, 26, 25, 42, 0, 0, 0, 0,
|
0, 43, 43, 43, 25, 34, 43, 27, 26, 43,
|
||||||
0, 42, 42, 42, 39, 42, 35, 36, 0, 29,
|
0, 0, 0, 0, 0, 43, 43, 43, 40, 43,
|
||||||
0, 31, 42, 37, 34, 0, 0, 42, 30, 28,
|
36, 37, 0, 30, 0, 32, 43, 38, 35, 0,
|
||||||
23, 0
|
0, 43, 31, 29, 23, 0
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
@ -446,109 +446,110 @@ static yyconst flex_int32_t yy_meta[44] =
|
||||||
5, 1, 1
|
5, 1, 1
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_base[202] =
|
static yyconst flex_int16_t yy_base[206] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 342, 341, 41, 43, 304, 303, 345, 350,
|
0, 0, 350, 349, 41, 43, 312, 311, 353, 358,
|
||||||
46, 48, 350, 24, 33, 328, 327, 43, 50, 55,
|
46, 48, 358, 24, 33, 336, 335, 43, 50, 55,
|
||||||
325, 350, 325, 42, 48, 55, 56, 54, 61, 62,
|
333, 358, 333, 42, 48, 55, 56, 54, 61, 63,
|
||||||
64, 63, 73, 298, 0, 328, 0, 350, 350, 103,
|
65, 67, 74, 306, 0, 336, 0, 358, 358, 104,
|
||||||
350, 295, 88, 305, 308, 297, 310, 313, 316, 350,
|
358, 303, 91, 313, 316, 305, 318, 321, 324, 358,
|
||||||
350, 86, 350, 350, 0, 350, 81, 350, 294, 350,
|
358, 91, 358, 358, 0, 358, 83, 358, 302, 358,
|
||||||
313, 350, 65, 79, 88, 89, 91, 90, 95, 92,
|
321, 358, 75, 83, 90, 86, 81, 93, 91, 103,
|
||||||
106, 111, 113, 114, 116, 117, 287, 0, 350, 0,
|
98, 105, 115, 107, 114, 116, 122, 295, 0, 358,
|
||||||
350, 124, 131, 350, 350, 350, 350, 350, 285, 305,
|
0, 358, 134, 136, 358, 358, 358, 358, 358, 293,
|
||||||
305, 287, 289, 293, 0, 134, 350, 118, 306, 122,
|
313, 313, 295, 297, 301, 0, 138, 358, 121, 314,
|
||||||
|
|
||||||
132, 134, 137, 124, 143, 146, 136, 147, 150, 151,
|
137, 123, 136, 138, 144, 128, 147, 150, 151, 154,
|
||||||
152, 156, 350, 169, 171, 350, 291, 284, 283, 279,
|
155, 156, 161, 162, 358, 167, 169, 358, 299, 292,
|
||||||
289, 157, 159, 170, 163, 172, 300, 173, 174, 175,
|
291, 287, 297, 160, 171, 172, 175, 177, 176, 308,
|
||||||
184, 176, 179, 299, 298, 193, 274, 292, 283, 282,
|
178, 179, 181, 187, 182, 188, 307, 306, 198, 282,
|
||||||
286, 191, 182, 292, 185, 291, 194, 196, 198, 200,
|
300, 291, 290, 294, 199, 300, 189, 299, 192, 298,
|
||||||
201, 203, 280, 258, 272, 254, 243, 204, 205, 206,
|
200, 201, 205, 207, 208, 210, 287, 265, 279, 261,
|
||||||
246, 245, 208, 244, 243, 209, 234, 216, 217, 230,
|
250, 211, 212, 213, 253, 252, 215, 251, 250, 216,
|
||||||
215, 212, 213, 215, 235, 216, 350, 350, 211, 350,
|
241, 223, 224, 237, 222, 219, 221, 222, 242, 224,
|
||||||
215, 230, 219, 229, 227, 218, 205, 223, 350, 350,
|
358, 358, 218, 358, 222, 237, 226, 236, 234, 225,
|
||||||
87, 350, 264, 269, 274, 276, 281, 286, 291, 296,
|
211, 230, 358, 358, 64, 358, 271, 276, 281, 283,
|
||||||
|
|
||||||
301
|
288, 293, 298, 303, 308
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_def[202] =
|
static yyconst flex_int16_t yy_def[206] =
|
||||||
{ 0,
|
{ 0,
|
||||||
192, 1, 193, 193, 194, 194, 195, 195, 192, 192,
|
196, 1, 197, 197, 198, 198, 199, 199, 196, 196,
|
||||||
192, 192, 192, 192, 192, 196, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 200, 196, 196, 196, 196,
|
||||||
197, 192, 196, 196, 196, 196, 196, 196, 196, 196,
|
201, 196, 200, 200, 200, 200, 200, 200, 200, 200,
|
||||||
196, 196, 196, 192, 198, 192, 199, 192, 192, 200,
|
200, 200, 200, 196, 202, 196, 203, 196, 196, 204,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 196, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 200, 196,
|
||||||
192, 192, 192, 192, 201, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 205, 196, 196, 196, 196, 196,
|
||||||
197, 192, 196, 196, 196, 196, 196, 196, 196, 196,
|
201, 196, 200, 200, 200, 200, 200, 200, 200, 200,
|
||||||
196, 196, 196, 196, 196, 196, 192, 198, 192, 199,
|
200, 200, 200, 200, 200, 200, 200, 196, 202, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
203, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192, 192, 201, 192, 192, 196, 196, 196,
|
196, 196, 196, 196, 196, 205, 196, 196, 200, 200,
|
||||||
|
|
||||||
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
200, 200, 200, 200, 200, 200, 200, 200, 200, 200,
|
||||||
196, 196, 192, 192, 192, 192, 192, 192, 192, 192,
|
200, 200, 200, 200, 196, 196, 196, 196, 196, 196,
|
||||||
192, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
196, 196, 196, 200, 200, 200, 200, 200, 200, 200,
|
||||||
196, 196, 196, 196, 196, 192, 192, 192, 192, 192,
|
200, 200, 200, 200, 200, 200, 200, 200, 196, 196,
|
||||||
192, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
196, 196, 196, 196, 200, 200, 200, 200, 200, 200,
|
||||||
196, 196, 192, 192, 192, 192, 192, 196, 196, 196,
|
200, 200, 200, 200, 200, 200, 196, 196, 196, 196,
|
||||||
196, 196, 196, 196, 196, 196, 192, 192, 192, 192,
|
196, 200, 200, 200, 200, 200, 200, 200, 200, 200,
|
||||||
192, 196, 196, 196, 196, 196, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 200, 200, 200, 200, 200,
|
||||||
192, 196, 196, 196, 196, 192, 192, 196, 192, 192,
|
196, 196, 196, 196, 196, 200, 200, 200, 200, 196,
|
||||||
196, 0, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 200, 196, 196, 200, 0, 196, 196, 196, 196,
|
||||||
|
|
||||||
192
|
196, 196, 196, 196, 196
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_nxt[394] =
|
static yyconst flex_int16_t yy_nxt[402] =
|
||||||
{ 0,
|
{ 0,
|
||||||
10, 11, 12, 13, 14, 15, 16, 17, 18, 10,
|
10, 11, 12, 13, 14, 15, 16, 17, 18, 10,
|
||||||
19, 20, 20, 10, 21, 22, 10, 23, 10, 24,
|
19, 20, 20, 10, 21, 22, 10, 23, 10, 24,
|
||||||
23, 23, 25, 23, 26, 23, 23, 27, 23, 28,
|
23, 23, 25, 23, 26, 23, 23, 27, 23, 28,
|
||||||
23, 29, 30, 31, 23, 23, 32, 33, 23, 23,
|
23, 29, 30, 31, 23, 23, 32, 33, 23, 23,
|
||||||
23, 34, 10, 38, 39, 38, 39, 43, 43, 43,
|
23, 34, 10, 38, 39, 38, 39, 43, 43, 43,
|
||||||
43, 44, 46, 45, 52, 52, 54, 192, 53, 40,
|
43, 44, 46, 45, 52, 52, 54, 196, 53, 40,
|
||||||
55, 40, 63, 192, 57, 56, 52, 52, 47, 192,
|
55, 40, 63, 196, 57, 56, 52, 52, 47, 196,
|
||||||
192, 192, 48, 64, 66, 65, 192, 192, 192, 192,
|
196, 196, 48, 64, 67, 66, 196, 65, 196, 196,
|
||||||
192, 58, 70, 71, 72, 59, 68, 67, 192, 43,
|
196, 58, 196, 71, 72, 59, 69, 68, 73, 196,
|
||||||
43, 60, 96, 96, 192, 57, 74, 52, 52, 69,
|
196, 60, 43, 43, 97, 97, 196, 75, 196, 70,
|
||||||
|
|
||||||
73, 98, 192, 192, 192, 192, 192, 192, 75, 100,
|
57, 196, 52, 52, 74, 196, 196, 102, 196, 76,
|
||||||
192, 103, 58, 76, 82, 83, 59, 102, 101, 99,
|
103, 99, 105, 196, 77, 83, 84, 58, 196, 104,
|
||||||
106, 192, 60, 84, 104, 105, 192, 85, 192, 192,
|
196, 59, 196, 100, 85, 101, 108, 60, 86, 196,
|
||||||
108, 192, 192, 192, 86, 114, 115, 192, 87, 192,
|
196, 196, 106, 107, 110, 87, 196, 196, 196, 88,
|
||||||
88, 107, 115, 115, 110, 96, 96, 192, 109, 192,
|
109, 89, 111, 196, 112, 116, 117, 117, 117, 97,
|
||||||
112, 192, 192, 127, 111, 122, 126, 125, 192, 123,
|
97, 196, 196, 196, 113, 114, 125, 130, 124, 196,
|
||||||
58, 192, 192, 128, 59, 192, 192, 192, 124, 129,
|
126, 128, 196, 129, 58, 196, 196, 131, 59, 196,
|
||||||
60, 192, 192, 130, 192, 134, 131, 132, 192, 135,
|
196, 196, 127, 132, 60, 196, 196, 196, 139, 117,
|
||||||
136, 115, 115, 115, 133, 192, 143, 192, 192, 192,
|
117, 117, 135, 134, 137, 138, 196, 196, 133, 136,
|
||||||
192, 192, 142, 144, 192, 148, 147, 192, 145, 192,
|
196, 196, 196, 196, 196, 145, 196, 196, 148, 147,
|
||||||
|
|
||||||
192, 146, 149, 150, 115, 115, 192, 151, 152, 192,
|
152, 151, 196, 196, 196, 150, 154, 196, 153, 117,
|
||||||
158, 192, 160, 192, 159, 192, 192, 163, 192, 192,
|
117, 146, 149, 155, 196, 196, 196, 156, 162, 164,
|
||||||
192, 192, 166, 192, 192, 172, 165, 192, 192, 161,
|
196, 163, 196, 196, 167, 196, 196, 196, 196, 170,
|
||||||
192, 192, 183, 162, 192, 164, 173, 175, 192, 185,
|
196, 196, 176, 169, 196, 165, 196, 196, 166, 196,
|
||||||
190, 189, 192, 174, 192, 192, 176, 187, 186, 182,
|
187, 196, 168, 177, 179, 196, 194, 189, 193, 196,
|
||||||
192, 184, 181, 180, 188, 179, 178, 177, 192, 192,
|
178, 196, 196, 180, 191, 190, 186, 196, 188, 185,
|
||||||
192, 192, 171, 191, 35, 35, 35, 35, 35, 37,
|
184, 192, 183, 182, 181, 196, 196, 196, 196, 175,
|
||||||
37, 37, 37, 37, 41, 41, 41, 41, 41, 49,
|
195, 35, 35, 35, 35, 35, 37, 37, 37, 37,
|
||||||
49, 61, 61, 61, 61, 61, 78, 78, 78, 170,
|
37, 41, 41, 41, 41, 41, 49, 49, 61, 61,
|
||||||
78, 80, 169, 168, 80, 80, 81, 81, 81, 81,
|
61, 61, 61, 79, 79, 79, 174, 79, 81, 173,
|
||||||
|
|
||||||
81, 95, 167, 95, 95, 95, 192, 192, 157, 156,
|
172, 81, 81, 82, 82, 82, 82, 82, 96, 171,
|
||||||
155, 154, 153, 192, 192, 192, 141, 140, 139, 138,
|
96, 96, 96, 196, 196, 196, 161, 160, 159, 158,
|
||||||
137, 192, 121, 120, 119, 118, 117, 116, 113, 62,
|
157, 196, 196, 196, 144, 143, 142, 141, 140, 196,
|
||||||
97, 192, 94, 93, 92, 91, 90, 89, 79, 77,
|
123, 122, 121, 120, 119, 118, 115, 62, 98, 196,
|
||||||
192, 62, 51, 50, 192, 42, 42, 36, 36, 9,
|
95, 94, 93, 92, 91, 90, 80, 78, 196, 62,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
51, 50, 196, 42, 42, 36, 36, 9, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
|
|
||||||
|
196
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static yyconst flex_int16_t yy_chk[394] =
|
static yyconst flex_int16_t yy_chk[402] =
|
||||||
{ 0,
|
{ 0,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
@ -557,51 +558,52 @@ static yyconst flex_int16_t yy_chk[394] =
|
||||||
1, 1, 1, 5, 5, 6, 6, 11, 11, 12,
|
1, 1, 1, 5, 5, 6, 6, 11, 11, 12,
|
||||||
12, 14, 15, 14, 18, 18, 19, 24, 18, 5,
|
12, 14, 15, 14, 18, 18, 19, 24, 18, 5,
|
||||||
19, 6, 24, 25, 20, 19, 20, 20, 15, 28,
|
19, 6, 24, 25, 20, 19, 20, 20, 15, 28,
|
||||||
26, 27, 15, 24, 26, 25, 29, 30, 32, 31,
|
26, 27, 15, 24, 26, 25, 29, 24, 30, 195,
|
||||||
63, 20, 30, 31, 32, 20, 28, 27, 33, 43,
|
31, 20, 32, 30, 31, 20, 28, 27, 32, 33,
|
||||||
43, 20, 57, 57, 64, 52, 33, 52, 52, 29,
|
63, 20, 43, 43, 57, 57, 67, 33, 64, 29,
|
||||||
|
|
||||||
32, 63, 191, 65, 66, 68, 67, 70, 33, 65,
|
52, 66, 52, 52, 32, 65, 69, 66, 68, 33,
|
||||||
69, 68, 52, 33, 40, 40, 52, 67, 66, 64,
|
67, 63, 69, 71, 33, 40, 40, 52, 70, 68,
|
||||||
70, 71, 52, 40, 69, 69, 72, 40, 73, 74,
|
72, 52, 74, 64, 40, 65, 71, 52, 40, 75,
|
||||||
72, 75, 76, 98, 40, 82, 82, 100, 40, 104,
|
73, 76, 70, 70, 73, 40, 99, 77, 102, 40,
|
||||||
40, 71, 83, 83, 74, 96, 96, 101, 73, 102,
|
72, 40, 74, 106, 75, 83, 83, 84, 84, 97,
|
||||||
76, 107, 103, 104, 75, 98, 103, 102, 105, 100,
|
97, 103, 101, 104, 76, 77, 101, 106, 99, 105,
|
||||||
96, 106, 108, 105, 96, 109, 110, 111, 101, 106,
|
102, 104, 107, 105, 97, 108, 109, 107, 97, 110,
|
||||||
96, 112, 122, 107, 123, 111, 108, 109, 125, 112,
|
111, 112, 103, 108, 97, 124, 113, 114, 116, 116,
|
||||||
114, 114, 115, 115, 110, 124, 123, 126, 128, 129,
|
117, 117, 111, 110, 113, 114, 125, 126, 109, 112,
|
||||||
130, 132, 122, 124, 133, 129, 128, 143, 125, 131,
|
127, 129, 128, 131, 132, 124, 133, 135, 127, 126,
|
||||||
|
|
||||||
145, 126, 130, 131, 136, 136, 142, 132, 133, 147,
|
132, 131, 134, 136, 147, 129, 134, 149, 133, 139,
|
||||||
142, 148, 145, 149, 143, 150, 151, 149, 152, 158,
|
139, 125, 128, 135, 145, 151, 152, 136, 145, 149,
|
||||||
159, 160, 152, 163, 166, 158, 151, 172, 173, 147,
|
153, 147, 154, 155, 153, 156, 162, 163, 164, 156,
|
||||||
174, 176, 173, 148, 183, 150, 159, 163, 188, 176,
|
167, 170, 162, 155, 176, 151, 177, 178, 152, 180,
|
||||||
187, 186, 185, 160, 184, 182, 166, 181, 179, 172,
|
177, 187, 154, 163, 167, 192, 191, 180, 190, 189,
|
||||||
175, 174, 171, 170, 183, 169, 168, 167, 165, 164,
|
164, 188, 186, 170, 185, 183, 176, 179, 178, 175,
|
||||||
162, 161, 157, 188, 193, 193, 193, 193, 193, 194,
|
174, 187, 173, 172, 171, 169, 168, 166, 165, 161,
|
||||||
194, 194, 194, 194, 195, 195, 195, 195, 195, 196,
|
192, 197, 197, 197, 197, 197, 198, 198, 198, 198,
|
||||||
196, 197, 197, 197, 197, 197, 198, 198, 198, 156,
|
198, 199, 199, 199, 199, 199, 200, 200, 201, 201,
|
||||||
198, 199, 155, 154, 199, 199, 200, 200, 200, 200,
|
201, 201, 201, 202, 202, 202, 160, 202, 203, 159,
|
||||||
|
|
||||||
200, 201, 153, 201, 201, 201, 146, 144, 141, 140,
|
158, 203, 203, 204, 204, 204, 204, 204, 205, 157,
|
||||||
139, 138, 137, 135, 134, 127, 121, 120, 119, 118,
|
205, 205, 205, 150, 148, 146, 144, 143, 142, 141,
|
||||||
117, 99, 94, 93, 92, 91, 90, 89, 77, 61,
|
140, 138, 137, 130, 123, 122, 121, 120, 119, 100,
|
||||||
59, 49, 48, 47, 46, 45, 44, 42, 36, 34,
|
95, 94, 93, 92, 91, 90, 78, 61, 59, 49,
|
||||||
23, 21, 17, 16, 9, 8, 7, 4, 3, 192,
|
48, 47, 46, 45, 44, 42, 36, 34, 23, 21,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
17, 16, 9, 8, 7, 4, 3, 196, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192, 192, 192, 192, 192, 192, 192, 192,
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
192, 192, 192
|
196, 196, 196, 196, 196, 196, 196, 196, 196, 196,
|
||||||
|
|
||||||
|
196
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
/* Table of booleans, true if rule could match eol. */
|
/* Table of booleans, true if rule could match eol. */
|
||||||
static yyconst flex_int32_t yy_rule_can_match_eol[56] =
|
static yyconst flex_int32_t yy_rule_can_match_eol[57] =
|
||||||
{ 0,
|
{ 0,
|
||||||
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,
|
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0,
|
||||||
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
|
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };
|
||||||
|
|
||||||
/* The intent behind this definition is that it'll catch
|
/* The intent behind this definition is that it'll catch
|
||||||
* any uses of REJECT which flex missed.
|
* any uses of REJECT which flex missed.
|
||||||
|
@ -695,7 +697,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#line 699 "config_lexer.cc"
|
#line 701 "config_lexer.cc"
|
||||||
|
|
||||||
#define INITIAL 0
|
#define INITIAL 0
|
||||||
#define C_COMMENT 1
|
#define C_COMMENT 1
|
||||||
|
@ -952,7 +954,7 @@ YY_DECL
|
||||||
|
|
||||||
lex_buf string_buf;
|
lex_buf string_buf;
|
||||||
|
|
||||||
#line 956 "config_lexer.cc"
|
#line 958 "config_lexer.cc"
|
||||||
|
|
||||||
yylval = yylval_param;
|
yylval = yylval_param;
|
||||||
|
|
||||||
|
@ -1009,13 +1011,13 @@ yy_match:
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 193 )
|
if ( yy_current_state >= 197 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
++yy_cp;
|
++yy_cp;
|
||||||
}
|
}
|
||||||
while ( yy_current_state != 192 );
|
while ( yy_current_state != 196 );
|
||||||
yy_cp = yyg->yy_last_accepting_cpos;
|
yy_cp = yyg->yy_last_accepting_cpos;
|
||||||
yy_current_state = yyg->yy_last_accepting_state;
|
yy_current_state = yyg->yy_last_accepting_state;
|
||||||
|
|
||||||
|
@ -1222,123 +1224,123 @@ YY_RULE_SETUP
|
||||||
case 24:
|
case 24:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 182 "config_lexer.ll"
|
#line 182 "config_lexer.ll"
|
||||||
{ yylval->type = TypeNumber; return T_TYPE_NUMBER; }
|
{ yylval->type = TypeArray; return T_TYPE_ARRAY; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 25:
|
case 25:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 183 "config_lexer.ll"
|
#line 183 "config_lexer.ll"
|
||||||
{ yylval->type = TypeString; return T_TYPE_STRING; }
|
{ yylval->type = TypeNumber; return T_TYPE_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 26:
|
case 26:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 184 "config_lexer.ll"
|
#line 184 "config_lexer.ll"
|
||||||
{ yylval->type = TypeScalar; return T_TYPE_SCALAR; }
|
{ yylval->type = TypeString; return T_TYPE_STRING; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 27:
|
case 27:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 185 "config_lexer.ll"
|
#line 185 "config_lexer.ll"
|
||||||
{ yylval->type = TypeAny; return T_TYPE_ANY; }
|
{ yylval->type = TypeScalar; return T_TYPE_SCALAR; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 28:
|
case 28:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 186 "config_lexer.ll"
|
#line 186 "config_lexer.ll"
|
||||||
{ return T_VALIDATOR; }
|
{ yylval->type = TypeAny; return T_TYPE_ANY; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 29:
|
case 29:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 187 "config_lexer.ll"
|
#line 187 "config_lexer.ll"
|
||||||
{ return T_REQUIRE; }
|
{ return T_VALIDATOR; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 30:
|
case 30:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 188 "config_lexer.ll"
|
#line 188 "config_lexer.ll"
|
||||||
{ return T_ATTRIBUTE; }
|
{ return T_REQUIRE; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 31:
|
case 31:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 189 "config_lexer.ll"
|
#line 189 "config_lexer.ll"
|
||||||
return T_ABSTRACT;
|
{ return T_ATTRIBUTE; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 32:
|
case 32:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 190 "config_lexer.ll"
|
#line 190 "config_lexer.ll"
|
||||||
return T_LOCAL;
|
return T_ABSTRACT;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 33:
|
case 33:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 191 "config_lexer.ll"
|
#line 191 "config_lexer.ll"
|
||||||
return T_OBJECT;
|
return T_LOCAL;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 34:
|
case 34:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 192 "config_lexer.ll"
|
#line 192 "config_lexer.ll"
|
||||||
return T_TEMPLATE;
|
return T_OBJECT;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 35:
|
case 35:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 193 "config_lexer.ll"
|
#line 193 "config_lexer.ll"
|
||||||
return T_INCLUDE;
|
return T_TEMPLATE;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 36:
|
case 36:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 194 "config_lexer.ll"
|
#line 194 "config_lexer.ll"
|
||||||
return T_LIBRARY;
|
return T_INCLUDE;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 37:
|
case 37:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 195 "config_lexer.ll"
|
#line 195 "config_lexer.ll"
|
||||||
return T_INHERITS;
|
return T_LIBRARY;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 38:
|
case 38:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 196 "config_lexer.ll"
|
#line 196 "config_lexer.ll"
|
||||||
return T_NULL;
|
return T_INHERITS;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 39:
|
case 39:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 197 "config_lexer.ll"
|
#line 197 "config_lexer.ll"
|
||||||
return T_PARTIAL;
|
return T_NULL;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 40:
|
case 40:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 198 "config_lexer.ll"
|
#line 198 "config_lexer.ll"
|
||||||
{ yylval->num = 1; return T_NUMBER; }
|
return T_PARTIAL;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 41:
|
case 41:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 199 "config_lexer.ll"
|
#line 199 "config_lexer.ll"
|
||||||
{ yylval->num = 0; return T_NUMBER; }
|
{ yylval->num = 1; return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 42:
|
case 42:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 200 "config_lexer.ll"
|
#line 200 "config_lexer.ll"
|
||||||
{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
|
{ yylval->num = 0; return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 43:
|
case 43:
|
||||||
/* rule 43 can match eol */
|
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 201 "config_lexer.ll"
|
#line 201 "config_lexer.ll"
|
||||||
{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; }
|
{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 44:
|
case 44:
|
||||||
|
/* rule 44 can match eol */
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 202 "config_lexer.ll"
|
#line 202 "config_lexer.ll"
|
||||||
{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; }
|
{ yytext[yyleng-1] = '\0'; yylval->text = strdup(yytext + 1); return T_STRING_ANGLE; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 45:
|
case 45:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 203 "config_lexer.ll"
|
#line 203 "config_lexer.ll"
|
||||||
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 46:
|
case 46:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 204 "config_lexer.ll"
|
#line 204 "config_lexer.ll"
|
||||||
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 47:
|
case 47:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 205 "config_lexer.ll"
|
#line 205 "config_lexer.ll"
|
||||||
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 48:
|
case 48:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
|
@ -1348,40 +1350,45 @@ YY_RULE_SETUP
|
||||||
case 49:
|
case 49:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 207 "config_lexer.ll"
|
#line 207 "config_lexer.ll"
|
||||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 50:
|
case 50:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 208 "config_lexer.ll"
|
#line 208 "config_lexer.ll"
|
||||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 51:
|
case 51:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 209 "config_lexer.ll"
|
#line 209 "config_lexer.ll"
|
||||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 52:
|
case 52:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 210 "config_lexer.ll"
|
#line 210 "config_lexer.ll"
|
||||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
case 53:
|
case 53:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 211 "config_lexer.ll"
|
#line 211 "config_lexer.ll"
|
||||||
|
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||||
|
YY_BREAK
|
||||||
|
case 54:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 212 "config_lexer.ll"
|
||||||
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
|
|
||||||
case 54:
|
|
||||||
YY_RULE_SETUP
|
|
||||||
#line 214 "config_lexer.ll"
|
|
||||||
return yytext[0];
|
|
||||||
YY_BREAK
|
|
||||||
case 55:
|
case 55:
|
||||||
YY_RULE_SETUP
|
YY_RULE_SETUP
|
||||||
#line 216 "config_lexer.ll"
|
#line 215 "config_lexer.ll"
|
||||||
|
return yytext[0];
|
||||||
|
YY_BREAK
|
||||||
|
case 56:
|
||||||
|
YY_RULE_SETUP
|
||||||
|
#line 217 "config_lexer.ll"
|
||||||
ECHO;
|
ECHO;
|
||||||
YY_BREAK
|
YY_BREAK
|
||||||
#line 1385 "config_lexer.cc"
|
#line 1392 "config_lexer.cc"
|
||||||
case YY_STATE_EOF(INITIAL):
|
case YY_STATE_EOF(INITIAL):
|
||||||
case YY_STATE_EOF(C_COMMENT):
|
case YY_STATE_EOF(C_COMMENT):
|
||||||
case YY_STATE_EOF(STRING):
|
case YY_STATE_EOF(STRING):
|
||||||
|
@ -1679,7 +1686,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 193 )
|
if ( yy_current_state >= 197 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
|
@ -1708,11 +1715,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
||||||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||||
{
|
{
|
||||||
yy_current_state = (int) yy_def[yy_current_state];
|
yy_current_state = (int) yy_def[yy_current_state];
|
||||||
if ( yy_current_state >= 193 )
|
if ( yy_current_state >= 197 )
|
||||||
yy_c = yy_meta[(unsigned int) yy_c];
|
yy_c = yy_meta[(unsigned int) yy_c];
|
||||||
}
|
}
|
||||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||||
yy_is_jam = (yy_current_state == 192);
|
yy_is_jam = (yy_current_state == 196);
|
||||||
|
|
||||||
return yy_is_jam ? 0 : yy_current_state;
|
return yy_is_jam ? 0 : yy_current_state;
|
||||||
}
|
}
|
||||||
|
@ -2571,7 +2578,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
|
||||||
|
|
||||||
#define YYTABLES_NAME "yytables"
|
#define YYTABLES_NAME "yytables"
|
||||||
|
|
||||||
#line 216 "config_lexer.ll"
|
#line 217 "config_lexer.ll"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -179,6 +179,7 @@ static void lb_append_char(lex_buf *lb, char new_char)
|
||||||
<INITIAL>{
|
<INITIAL>{
|
||||||
type return T_TYPE;
|
type return T_TYPE;
|
||||||
dictionary { yylval->type = TypeDictionary; return T_TYPE_DICTIONARY; }
|
dictionary { yylval->type = TypeDictionary; return T_TYPE_DICTIONARY; }
|
||||||
|
array { yylval->type = TypeArray; return T_TYPE_ARRAY; }
|
||||||
number { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
|
number { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
|
||||||
string { yylval->type = TypeString; return T_TYPE_STRING; }
|
string { yylval->type = TypeString; return T_TYPE_STRING; }
|
||||||
scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
|
scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,8 @@
|
||||||
|
/* A Bison parser, made by GNU Bison 2.5. */
|
||||||
|
|
||||||
/* A Bison parser, made by GNU Bison 2.4.1. */
|
/* Bison interface for Yacc-like parsers in C
|
||||||
|
|
||||||
/* Skeleton interface for Bison's Yacc-like parsers in C
|
|
||||||
|
|
||||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
|
||||||
Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -34,7 +32,7 @@
|
||||||
|
|
||||||
/* "%code requires" blocks. */
|
/* "%code requires" blocks. */
|
||||||
|
|
||||||
/* Line 1676 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 1 "config_parser.yy"
|
#line 1 "config_parser.yy"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
@ -65,8 +63,8 @@ using namespace icinga;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Line 1676 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 70 "config_parser.h"
|
#line 68 "config_parser.h"
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
|
@ -85,22 +83,23 @@ using namespace icinga;
|
||||||
T_MULTIPLY_EQUAL = 266,
|
T_MULTIPLY_EQUAL = 266,
|
||||||
T_DIVIDE_EQUAL = 267,
|
T_DIVIDE_EQUAL = 267,
|
||||||
T_TYPE_DICTIONARY = 268,
|
T_TYPE_DICTIONARY = 268,
|
||||||
T_TYPE_NUMBER = 269,
|
T_TYPE_ARRAY = 269,
|
||||||
T_TYPE_STRING = 270,
|
T_TYPE_NUMBER = 270,
|
||||||
T_TYPE_SCALAR = 271,
|
T_TYPE_STRING = 271,
|
||||||
T_TYPE_ANY = 272,
|
T_TYPE_SCALAR = 272,
|
||||||
T_VALIDATOR = 273,
|
T_TYPE_ANY = 273,
|
||||||
T_REQUIRE = 274,
|
T_VALIDATOR = 274,
|
||||||
T_ATTRIBUTE = 275,
|
T_REQUIRE = 275,
|
||||||
T_TYPE = 276,
|
T_ATTRIBUTE = 276,
|
||||||
T_ABSTRACT = 277,
|
T_TYPE = 277,
|
||||||
T_LOCAL = 278,
|
T_ABSTRACT = 278,
|
||||||
T_OBJECT = 279,
|
T_LOCAL = 279,
|
||||||
T_TEMPLATE = 280,
|
T_OBJECT = 280,
|
||||||
T_INCLUDE = 281,
|
T_TEMPLATE = 281,
|
||||||
T_LIBRARY = 282,
|
T_INCLUDE = 282,
|
||||||
T_INHERITS = 283,
|
T_LIBRARY = 283,
|
||||||
T_PARTIAL = 284
|
T_INHERITS = 284,
|
||||||
|
T_PARTIAL = 285
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
|
@ -115,22 +114,23 @@ using namespace icinga;
|
||||||
#define T_MULTIPLY_EQUAL 266
|
#define T_MULTIPLY_EQUAL 266
|
||||||
#define T_DIVIDE_EQUAL 267
|
#define T_DIVIDE_EQUAL 267
|
||||||
#define T_TYPE_DICTIONARY 268
|
#define T_TYPE_DICTIONARY 268
|
||||||
#define T_TYPE_NUMBER 269
|
#define T_TYPE_ARRAY 269
|
||||||
#define T_TYPE_STRING 270
|
#define T_TYPE_NUMBER 270
|
||||||
#define T_TYPE_SCALAR 271
|
#define T_TYPE_STRING 271
|
||||||
#define T_TYPE_ANY 272
|
#define T_TYPE_SCALAR 272
|
||||||
#define T_VALIDATOR 273
|
#define T_TYPE_ANY 273
|
||||||
#define T_REQUIRE 274
|
#define T_VALIDATOR 274
|
||||||
#define T_ATTRIBUTE 275
|
#define T_REQUIRE 275
|
||||||
#define T_TYPE 276
|
#define T_ATTRIBUTE 276
|
||||||
#define T_ABSTRACT 277
|
#define T_TYPE 277
|
||||||
#define T_LOCAL 278
|
#define T_ABSTRACT 278
|
||||||
#define T_OBJECT 279
|
#define T_LOCAL 279
|
||||||
#define T_TEMPLATE 280
|
#define T_OBJECT 280
|
||||||
#define T_INCLUDE 281
|
#define T_TEMPLATE 281
|
||||||
#define T_LIBRARY 282
|
#define T_INCLUDE 282
|
||||||
#define T_INHERITS 283
|
#define T_LIBRARY 283
|
||||||
#define T_PARTIAL 284
|
#define T_INHERITS 284
|
||||||
|
#define T_PARTIAL 285
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ using namespace icinga;
|
||||||
typedef union YYSTYPE
|
typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Line 1676 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 38 "config_parser.yy"
|
#line 38 "config_parser.yy"
|
||||||
|
|
||||||
char *text;
|
char *text;
|
||||||
|
@ -150,7 +150,7 @@ typedef union YYSTYPE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Line 1676 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 155 "config_parser.h"
|
#line 155 "config_parser.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
|
|
|
@ -54,6 +54,7 @@ using namespace icinga;
|
||||||
%token <op> T_MULTIPLY_EQUAL
|
%token <op> T_MULTIPLY_EQUAL
|
||||||
%token <op> T_DIVIDE_EQUAL
|
%token <op> T_DIVIDE_EQUAL
|
||||||
%token <type> T_TYPE_DICTIONARY
|
%token <type> T_TYPE_DICTIONARY
|
||||||
|
%token <type> T_TYPE_ARRAY
|
||||||
%token <type> T_TYPE_NUMBER
|
%token <type> T_TYPE_NUMBER
|
||||||
%token <type> T_TYPE_STRING
|
%token <type> T_TYPE_STRING
|
||||||
%token <type> T_TYPE_SCALAR
|
%token <type> T_TYPE_SCALAR
|
||||||
|
@ -71,6 +72,7 @@ using namespace icinga;
|
||||||
%token T_INHERITS
|
%token T_INHERITS
|
||||||
%token T_PARTIAL
|
%token T_PARTIAL
|
||||||
%type <text> identifier
|
%type <text> identifier
|
||||||
|
%type <variant> array
|
||||||
%type <variant> simplevalue
|
%type <variant> simplevalue
|
||||||
%type <variant> value
|
%type <variant> value
|
||||||
%type <variant> expressionlist
|
%type <variant> expressionlist
|
||||||
|
@ -94,7 +96,7 @@ void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
|
||||||
int yyparse(ConfigCompiler *context);
|
int yyparse(ConfigCompiler *context);
|
||||||
|
|
||||||
static stack<ExpressionList::Ptr> m_ExpressionLists;
|
static stack<ExpressionList::Ptr> m_ExpressionLists;
|
||||||
static Dictionary::Ptr m_Array;
|
static stack<Array::Ptr> m_Arrays;
|
||||||
static ConfigItemBuilder::Ptr m_Item;
|
static ConfigItemBuilder::Ptr m_Item;
|
||||||
static bool m_Abstract;
|
static bool m_Abstract;
|
||||||
static bool m_Local;
|
static bool m_Local;
|
||||||
|
@ -244,6 +246,7 @@ type_inherits_specifier: /* empty */
|
||||||
;
|
;
|
||||||
|
|
||||||
type: T_TYPE_DICTIONARY
|
type: T_TYPE_DICTIONARY
|
||||||
|
| T_TYPE_ARRAY
|
||||||
| T_TYPE_NUMBER
|
| T_TYPE_NUMBER
|
||||||
| T_TYPE_STRING
|
| T_TYPE_STRING
|
||||||
| T_TYPE_SCALAR
|
| T_TYPE_SCALAR
|
||||||
|
@ -361,13 +364,6 @@ expression: identifier operator value
|
||||||
|
|
||||||
m_ExpressionLists.top()->AddExpression(expr);
|
m_ExpressionLists.top()->AddExpression(expr);
|
||||||
}
|
}
|
||||||
| value
|
|
||||||
{
|
|
||||||
Expression expr(String(), OperatorSet, *$1, yylloc);
|
|
||||||
delete $1;
|
|
||||||
|
|
||||||
m_ExpressionLists.top()->AddExpression(expr);
|
|
||||||
}
|
|
||||||
;
|
;
|
||||||
|
|
||||||
operator: T_EQUAL
|
operator: T_EQUAL
|
||||||
|
@ -380,6 +376,32 @@ operator: T_EQUAL
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
array: '['
|
||||||
|
{
|
||||||
|
m_Arrays.push(boost::make_shared<Array>());
|
||||||
|
}
|
||||||
|
array_items
|
||||||
|
']'
|
||||||
|
{
|
||||||
|
$$ = new Value(m_Arrays.top());
|
||||||
|
m_Arrays.pop();
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
array_items: array_items_inner
|
||||||
|
| array_items_inner ','
|
||||||
|
|
||||||
|
array_items_inner: /* empty */
|
||||||
|
| value
|
||||||
|
{
|
||||||
|
m_Arrays.top()->Add(*$1);
|
||||||
|
}
|
||||||
|
| array_items_inner ',' value
|
||||||
|
{
|
||||||
|
m_Arrays.top()->Add(*$3);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
simplevalue: T_STRING
|
simplevalue: T_STRING
|
||||||
{
|
{
|
||||||
$$ = new Value($1);
|
$$ = new Value($1);
|
||||||
|
@ -393,6 +415,10 @@ simplevalue: T_STRING
|
||||||
{
|
{
|
||||||
$$ = new Value();
|
$$ = new Value();
|
||||||
}
|
}
|
||||||
|
| array
|
||||||
|
{
|
||||||
|
$$ = $1;
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
value: simplevalue
|
value: simplevalue
|
||||||
|
|
|
@ -56,14 +56,16 @@ bool TypeRule::MatchValue(const Value& value) const
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case TypeDictionary:
|
case TypeDictionary:
|
||||||
return value.IsObjectType<Dictionary>();
|
return value.IsObjectType<Dictionary>();
|
||||||
|
|
||||||
|
case TypeArray:
|
||||||
|
return value.IsObjectType<Array>();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,8 @@ enum TypeSpecifier
|
||||||
TypeScalar,
|
TypeScalar,
|
||||||
TypeNumber,
|
TypeNumber,
|
||||||
TypeString,
|
TypeString,
|
||||||
TypeDictionary
|
TypeDictionary,
|
||||||
|
TypeArray
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +50,7 @@ public:
|
||||||
const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo);
|
const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo);
|
||||||
|
|
||||||
TypeRuleList::Ptr GetSubRules(void) const;
|
TypeRuleList::Ptr GetSubRules(void) const;
|
||||||
|
|
||||||
bool MatchName(const String& name) const;
|
bool MatchName(const String& name) const;
|
||||||
bool MatchValue(const Value& value) const;
|
bool MatchValue(const Value& value) const;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ Host::Ptr Host::GetByName(const String& name)
|
||||||
return dynamic_pointer_cast<Host>(configObject);
|
return dynamic_pointer_cast<Host>(configObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr Host::GetGroups(void) const
|
Array::Ptr Host::GetGroups(void) const
|
||||||
{
|
{
|
||||||
return m_HostGroups;;
|
return m_HostGroups;;
|
||||||
}
|
}
|
||||||
|
@ -92,12 +92,12 @@ Dictionary::Ptr Host::GetMacros(void) const
|
||||||
return m_Macros;
|
return m_Macros;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr Host::GetHostDependencies(void) const
|
Array::Ptr Host::GetHostDependencies(void) const
|
||||||
{
|
{
|
||||||
return m_HostDependencies;;
|
return m_HostDependencies;;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary::Ptr Host::GetServiceDependencies(void) const
|
Array::Ptr Host::GetServiceDependencies(void) const
|
||||||
{
|
{
|
||||||
return m_ServiceDependencies;
|
return m_ServiceDependencies;
|
||||||
}
|
}
|
||||||
|
@ -242,29 +242,23 @@ void Host::UpdateSlaveServices(void)
|
||||||
|
|
||||||
CopyServiceAttributes<false>(this, builder);
|
CopyServiceAttributes<false>(this, builder);
|
||||||
|
|
||||||
if (svcdesc.IsScalar()) {
|
if (!svcdesc.IsObjectType<Dictionary>())
|
||||||
builder->AddParent(svcdesc);
|
|
||||||
} else if (svcdesc.IsObjectType<Dictionary>()) {
|
|
||||||
Dictionary::Ptr service = svcdesc;
|
|
||||||
|
|
||||||
Dictionary::Ptr templates = service->Get("templates");
|
|
||||||
|
|
||||||
if (templates) {
|
|
||||||
ObjectLock olock(templates);
|
|
||||||
|
|
||||||
String tmpl;
|
|
||||||
BOOST_FOREACH(tie(tuples::ignore, tmpl), templates) {
|
|
||||||
builder->AddParent(tmpl);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
builder->AddParent(svcname);
|
|
||||||
}
|
|
||||||
|
|
||||||
CopyServiceAttributes<true>(service, builder);
|
|
||||||
} else {
|
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("Service description must be either a string or a dictionary."));
|
BOOST_THROW_EXCEPTION(invalid_argument("Service description must be either a string or a dictionary."));
|
||||||
|
|
||||||
|
Dictionary::Ptr service = svcdesc;
|
||||||
|
|
||||||
|
Array::Ptr templates = service->Get("templates");
|
||||||
|
|
||||||
|
if (templates) {
|
||||||
|
ObjectLock olock(templates);
|
||||||
|
|
||||||
|
BOOST_FOREACH(const Value& tmpl, templates) {
|
||||||
|
builder->AddParent(tmpl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CopyServiceAttributes<true>(service, builder);
|
||||||
|
|
||||||
ConfigItem::Ptr serviceItem = builder->Compile();
|
ConfigItem::Ptr serviceItem = builder->Compile();
|
||||||
DynamicObject::Ptr dobj = serviceItem->Commit();
|
DynamicObject::Ptr dobj = serviceItem->Commit();
|
||||||
|
|
||||||
|
@ -392,20 +386,19 @@ void Host::ValidateServiceDictionary(const ScriptTask::Ptr& task, const vector<V
|
||||||
BOOST_FOREACH(tie(key, value), attrs) {
|
BOOST_FOREACH(tie(key, value), attrs) {
|
||||||
vector<String> templates;
|
vector<String> templates;
|
||||||
|
|
||||||
if (value.IsScalar()) {
|
if (!value.IsObjectType<Dictionary>())
|
||||||
templates.push_back(value);
|
BOOST_THROW_EXCEPTION(invalid_argument("Service description must be a dictionary."));
|
||||||
} else if (value.IsObjectType<Dictionary>()) {
|
|
||||||
Dictionary::Ptr serviceDesc = value;
|
|
||||||
|
|
||||||
Dictionary::Ptr templatesDict = serviceDesc->Get("templates");
|
Dictionary::Ptr serviceDesc = value;
|
||||||
ObjectLock tlock(templatesDict);
|
|
||||||
|
|
||||||
Value tmpl;
|
Array::Ptr templatesArray = serviceDesc->Get("templates");
|
||||||
BOOST_FOREACH(tie(tuples::ignore, tmpl), templatesDict) {
|
|
||||||
|
if (templatesArray) {
|
||||||
|
ObjectLock tlock(templatesArray);
|
||||||
|
|
||||||
|
BOOST_FOREACH(const Value& tmpl, templatesArray) {
|
||||||
templates.push_back(tmpl);
|
templates.push_back(tmpl);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, templates) {
|
BOOST_FOREACH(const String& name, templates) {
|
||||||
|
@ -464,13 +457,12 @@ set<Host::Ptr> Host::GetParentHosts(void) const
|
||||||
{
|
{
|
||||||
set<Host::Ptr> parents;
|
set<Host::Ptr> parents;
|
||||||
|
|
||||||
Dictionary::Ptr dependencies = GetHostDependencies();
|
Array::Ptr dependencies = GetHostDependencies();
|
||||||
|
|
||||||
if (dependencies) {
|
if (dependencies) {
|
||||||
ObjectLock olock(dependencies);
|
ObjectLock olock(dependencies);
|
||||||
|
|
||||||
Value value;
|
BOOST_FOREACH(const Value& value, dependencies) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, value), dependencies) {
|
|
||||||
if (value == GetName())
|
if (value == GetName())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -500,13 +492,12 @@ set<Service::Ptr> Host::GetParentServices(void) const
|
||||||
{
|
{
|
||||||
set<Service::Ptr> parents;
|
set<Service::Ptr> parents;
|
||||||
|
|
||||||
Dictionary::Ptr dependencies = GetServiceDependencies();
|
Array::Ptr dependencies = GetServiceDependencies();
|
||||||
|
|
||||||
if (dependencies) {
|
if (dependencies) {
|
||||||
ObjectLock olock(dependencies);
|
ObjectLock olock(dependencies);
|
||||||
|
|
||||||
Value value;
|
BOOST_FOREACH(const Value& value, dependencies) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, value), dependencies) {
|
|
||||||
parents.insert(GetServiceByShortName(value));
|
parents.insert(GetServiceByShortName(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,11 +65,11 @@ public:
|
||||||
static Host::Ptr GetByName(const String& name);
|
static Host::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
String GetDisplayName(void) const;
|
String GetDisplayName(void) const;
|
||||||
Dictionary::Ptr GetGroups(void) const;
|
Array::Ptr GetGroups(void) const;
|
||||||
|
|
||||||
Dictionary::Ptr GetMacros(void) const;
|
Dictionary::Ptr GetMacros(void) const;
|
||||||
Dictionary::Ptr GetHostDependencies(void) const;
|
Array::Ptr GetHostDependencies(void) const;
|
||||||
Dictionary::Ptr GetServiceDependencies(void) const;
|
Array::Ptr GetServiceDependencies(void) const;
|
||||||
String GetHostCheck(void) const;
|
String GetHostCheck(void) const;
|
||||||
|
|
||||||
Dictionary::Ptr CalculateDynamicMacros(void) const;
|
Dictionary::Ptr CalculateDynamicMacros(void) const;
|
||||||
|
@ -102,10 +102,10 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Attribute<String> m_DisplayName;
|
Attribute<String> m_DisplayName;
|
||||||
Attribute<Dictionary::Ptr> m_HostGroups;
|
Attribute<Array::Ptr> m_HostGroups;
|
||||||
Attribute<Dictionary::Ptr> m_Macros;
|
Attribute<Dictionary::Ptr> m_Macros;
|
||||||
Attribute<Dictionary::Ptr> m_HostDependencies;
|
Attribute<Array::Ptr> m_HostDependencies;
|
||||||
Attribute<Dictionary::Ptr> m_ServiceDependencies;
|
Attribute<Array::Ptr> m_ServiceDependencies;
|
||||||
Attribute<String> m_HostCheck;
|
Attribute<String> m_HostCheck;
|
||||||
Dictionary::Ptr m_SlaveServices;
|
Dictionary::Ptr m_SlaveServices;
|
||||||
|
|
||||||
|
|
|
@ -155,14 +155,13 @@ void HostGroup::RefreshMembersCache(void)
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Host")) {
|
||||||
const Host::Ptr& host = static_pointer_cast<Host>(object);
|
const Host::Ptr& host = static_pointer_cast<Host>(object);
|
||||||
|
|
||||||
Dictionary::Ptr dict;
|
Array::Ptr groups;
|
||||||
dict = host->GetGroups();
|
groups = host->GetGroups();
|
||||||
|
|
||||||
if (dict) {
|
if (groups) {
|
||||||
ObjectLock mlock(dict);
|
ObjectLock mlock(groups);
|
||||||
Value hostgroup;
|
BOOST_FOREACH(const Value& group, groups) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, hostgroup), dict) {
|
newMembersCache[group].push_back(host);
|
||||||
newMembersCache[hostgroup].push_back(host);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,30 +20,14 @@
|
||||||
type Host {
|
type Host {
|
||||||
%attribute string "display_name",
|
%attribute string "display_name",
|
||||||
%attribute string "hostcheck",
|
%attribute string "hostcheck",
|
||||||
%attribute dictionary "hostgroups" {
|
%attribute array "hostgroups",
|
||||||
%attribute string "*"
|
%attribute array "hostdependencies",
|
||||||
},
|
%attribute array "servicedependencies",
|
||||||
%attribute dictionary "hostdependencies" {
|
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
%attribute dictionary "servicedependencies" {
|
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
|
||||||
%require "host",
|
|
||||||
%attribute string "host",
|
|
||||||
|
|
||||||
%require "service",
|
|
||||||
%attribute string "service"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
%attribute dictionary "services" {
|
%attribute dictionary "services" {
|
||||||
%validator "ValidateServiceDictionary",
|
%validator "ValidateServiceDictionary",
|
||||||
|
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
%attribute dictionary "*" {
|
||||||
%attribute dictionary "templates" {
|
%attribute array "templates",
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
%attribute string "short_name",
|
%attribute string "short_name",
|
||||||
|
|
||||||
|
@ -55,46 +39,23 @@ type Host {
|
||||||
%attribute number "check_interval",
|
%attribute number "check_interval",
|
||||||
%attribute number "retry_interval",
|
%attribute number "retry_interval",
|
||||||
|
|
||||||
%attribute dictionary "servicegroups" {
|
%attribute array "servicegroups",
|
||||||
%attribute string "*"
|
%attribute array "checkers",
|
||||||
},
|
%attribute array "hostdependencies",
|
||||||
%attribute dictionary "checkers" {
|
%attribute array "servicedependencies"
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
%attribute dictionary "hostdependencies" {
|
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
%attribute dictionary "servicedependencies" {
|
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
|
||||||
%require "host",
|
|
||||||
%attribute string "host",
|
|
||||||
|
|
||||||
%require "service",
|
|
||||||
%attribute string "service"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "notifications" {
|
%attribute dictionary "notifications" {
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
%attribute dictionary "*" {
|
||||||
%attribute dictionary "templates" {
|
%attribute array "templates",
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "macros" {
|
%attribute dictionary "macros" {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "users" {
|
%attribute array "users",
|
||||||
%attribute string "*"
|
%attribute array "groups"
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "groups" {
|
|
||||||
%attribute string "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -107,12 +68,8 @@ type Host {
|
||||||
%attribute dictionary "macros" {
|
%attribute dictionary "macros" {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
%attribute dictionary "servicegroups" {
|
%attribute array "servicegroups",
|
||||||
%attribute string "*"
|
%attribute array "checkers"
|
||||||
},
|
|
||||||
%attribute dictionary "checkers" {
|
|
||||||
%attribute string "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type HostGroup {
|
type HostGroup {
|
||||||
|
@ -141,33 +98,16 @@ type Service {
|
||||||
%attribute dictionary "macros" {
|
%attribute dictionary "macros" {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
%attribute dictionary "check_command" {
|
%attribute array "check_command",
|
||||||
%attribute string "_*"
|
|
||||||
},
|
|
||||||
%attribute string "check_command",
|
%attribute string "check_command",
|
||||||
%attribute number "max_check_attempts",
|
%attribute number "max_check_attempts",
|
||||||
%attribute string "check_period",
|
%attribute string "check_period",
|
||||||
%attribute number "check_interval",
|
%attribute number "check_interval",
|
||||||
%attribute number "retry_interval",
|
%attribute number "retry_interval",
|
||||||
%attribute dictionary "hostdependencies" {
|
%attribute array "hostdependencies",
|
||||||
%attribute string "*"
|
%attribute array "servicedependencies",
|
||||||
},
|
%attribute array "servicegroups",
|
||||||
%attribute dictionary "servicedependencies" {
|
%attribute array "checkers",
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
|
||||||
%require "host",
|
|
||||||
%attribute string "host",
|
|
||||||
|
|
||||||
%require "service",
|
|
||||||
%attribute string "service"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
%attribute dictionary "servicegroups" {
|
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
%attribute dictionary "checkers" {
|
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
%require "methods",
|
%require "methods",
|
||||||
%attribute dictionary "methods" {
|
%attribute dictionary "methods" {
|
||||||
|
@ -176,23 +116,15 @@ type Service {
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "notifications" {
|
%attribute dictionary "notifications" {
|
||||||
%attribute string "*",
|
|
||||||
%attribute dictionary "*" {
|
%attribute dictionary "*" {
|
||||||
%attribute dictionary "templates" {
|
%attribute array "templates",
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "macros" {
|
%attribute dictionary "macros" {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "users" {
|
%attribute array "users",
|
||||||
%attribute string "*"
|
%attribute array "groups"
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "groups" {
|
|
||||||
%attribute string "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -220,17 +152,10 @@ type Notification {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "users" {
|
%attribute array "users",
|
||||||
%attribute string "*"
|
%attribute array "groups",
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "groups" {
|
%attribute array "notification_command",
|
||||||
%attribute string "*"
|
|
||||||
},
|
|
||||||
|
|
||||||
%attribute dictionary "notification_command" {
|
|
||||||
%attribute string "_*"
|
|
||||||
},
|
|
||||||
%attribute string "notification_command"
|
%attribute string "notification_command"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,9 +166,7 @@ type User {
|
||||||
%attribute string "*"
|
%attribute string "*"
|
||||||
},
|
},
|
||||||
|
|
||||||
%attribute dictionary "groups" {
|
%attribute array "groups"
|
||||||
%attribute string "*"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserGroup {
|
type UserGroup {
|
||||||
|
|
|
@ -32,20 +32,19 @@ Value MacroProcessor::ResolveMacros(const Value& cmd, const Dictionary::Ptr& mac
|
||||||
|
|
||||||
if (cmd.IsScalar()) {
|
if (cmd.IsScalar()) {
|
||||||
result = InternalResolveMacros(cmd, macros);
|
result = InternalResolveMacros(cmd, macros);
|
||||||
} else if (cmd.IsObjectType<Dictionary>()) {
|
} else if (cmd.IsObjectType<Array>()) {
|
||||||
Dictionary::Ptr resultDict = boost::make_shared<Dictionary>();
|
Array::Ptr resultArr = boost::make_shared<Array>();
|
||||||
Dictionary::Ptr dict = cmd;
|
Array::Ptr arr = cmd;
|
||||||
|
|
||||||
ObjectLock olock(dict);
|
ObjectLock olock(arr);
|
||||||
|
|
||||||
Value arg;
|
BOOST_FOREACH(const Value& arg, arr) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, arg), dict) {
|
resultArr->Add(InternalResolveMacros(arg, macros));
|
||||||
resultDict->Add(InternalResolveMacros(arg, macros));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = resultDict;
|
result = resultArr;
|
||||||
} else {
|
} else {
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("Command is not a string or dictionary."));
|
BOOST_THROW_EXCEPTION(invalid_argument("Command is not a string or array."));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -80,7 +80,7 @@ double Service::GetRetryInterval(void) const
|
||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
Dictionary::Ptr Service::GetCheckers(void) const
|
Array::Ptr Service::GetCheckers(void) const
|
||||||
{
|
{
|
||||||
return m_Checkers;
|
return m_Checkers;
|
||||||
}
|
}
|
||||||
|
@ -560,15 +560,14 @@ String Service::StateTypeToString(StateType type)
|
||||||
*/
|
*/
|
||||||
bool Service::IsAllowedChecker(const String& checker) const
|
bool Service::IsAllowedChecker(const String& checker) const
|
||||||
{
|
{
|
||||||
Dictionary::Ptr checkers = GetCheckers();
|
Array::Ptr checkers = GetCheckers();
|
||||||
|
|
||||||
if (!checkers)
|
if (!checkers)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
ObjectLock olock(checkers);
|
ObjectLock olock(checkers);
|
||||||
|
|
||||||
Value pattern;
|
BOOST_FOREACH(const Value& pattern, checkers) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, pattern), checkers) {
|
|
||||||
if (Utility::Match(pattern, checker))
|
if (Utility::Match(pattern, checker))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,9 +221,6 @@ void Service::UpdateSlaveNotifications(void)
|
||||||
String nfcname;
|
String nfcname;
|
||||||
Value nfcdesc;
|
Value nfcdesc;
|
||||||
BOOST_FOREACH(tie(nfcname, nfcdesc), notificationDescs) {
|
BOOST_FOREACH(tie(nfcname, nfcdesc), notificationDescs) {
|
||||||
if (nfcdesc.IsScalar())
|
|
||||||
nfcname = nfcdesc;
|
|
||||||
|
|
||||||
stringstream namebuf;
|
stringstream namebuf;
|
||||||
namebuf << GetName() << "-" << nfcname;
|
namebuf << GetName() << "-" << nfcname;
|
||||||
String name = namebuf.str();
|
String name = namebuf.str();
|
||||||
|
@ -236,29 +233,23 @@ void Service::UpdateSlaveNotifications(void)
|
||||||
|
|
||||||
CopyNotificationAttributes(this, builder);
|
CopyNotificationAttributes(this, builder);
|
||||||
|
|
||||||
if (nfcdesc.IsScalar()) {
|
if (!nfcdesc.IsObjectType<Dictionary>())
|
||||||
builder->AddParent(nfcdesc);
|
BOOST_THROW_EXCEPTION(invalid_argument("Notification description must be a dictionary."));
|
||||||
} else if (nfcdesc.IsObjectType<Dictionary>()) {
|
|
||||||
Dictionary::Ptr notification = nfcdesc;
|
|
||||||
|
|
||||||
Dictionary::Ptr templates = notification->Get("templates");
|
Dictionary::Ptr notification = nfcdesc;
|
||||||
|
|
||||||
if (templates) {
|
Array::Ptr templates = notification->Get("templates");
|
||||||
ObjectLock tlock(templates);
|
|
||||||
|
|
||||||
String tmpl;
|
if (templates) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, tmpl), templates) {
|
ObjectLock tlock(templates);
|
||||||
builder->AddParent(tmpl);
|
|
||||||
}
|
BOOST_FOREACH(const Value& tmpl, templates) {
|
||||||
} else {
|
builder->AddParent(tmpl);
|
||||||
builder->AddParent(nfcname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyNotificationAttributes(notification, builder);
|
|
||||||
} else {
|
|
||||||
BOOST_THROW_EXCEPTION(invalid_argument("Notification description must be either a string or a dictionary."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CopyNotificationAttributes(notification, builder);
|
||||||
|
|
||||||
ConfigItem::Ptr notificationItem = builder->Compile();
|
ConfigItem::Ptr notificationItem = builder->Compile();
|
||||||
notificationItem->Commit();
|
notificationItem->Commit();
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ Dictionary::Ptr Service::GetMacros(void) const
|
||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
Dictionary::Ptr Service::GetHostDependencies(void) const
|
Array::Ptr Service::GetHostDependencies(void) const
|
||||||
{
|
{
|
||||||
return m_HostDependencies;
|
return m_HostDependencies;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ Dictionary::Ptr Service::GetHostDependencies(void) const
|
||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
Dictionary::Ptr Service::GetServiceDependencies(void) const
|
Array::Ptr Service::GetServiceDependencies(void) const
|
||||||
{
|
{
|
||||||
return m_ServiceDependencies;
|
return m_ServiceDependencies;
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ Dictionary::Ptr Service::GetServiceDependencies(void) const
|
||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
Dictionary::Ptr Service::GetGroups(void) const
|
Array::Ptr Service::GetGroups(void) const
|
||||||
{
|
{
|
||||||
return m_ServiceGroups;
|
return m_ServiceGroups;
|
||||||
}
|
}
|
||||||
|
@ -381,14 +381,13 @@ set<Host::Ptr> Service::GetParentHosts(void) const
|
||||||
if (host)
|
if (host)
|
||||||
parents.insert(host);
|
parents.insert(host);
|
||||||
|
|
||||||
Dictionary::Ptr dependencies = GetHostDependencies();
|
Array::Ptr dependencies = GetHostDependencies();
|
||||||
|
|
||||||
if (dependencies) {
|
if (dependencies) {
|
||||||
ObjectLock olock(dependencies);
|
ObjectLock olock(dependencies);
|
||||||
|
|
||||||
String key;
|
BOOST_FOREACH(const Value& dependency, dependencies) {
|
||||||
BOOST_FOREACH(tie(key, tuples::ignore), dependencies) {
|
Host::Ptr host = Host::GetByName(dependency);
|
||||||
Host::Ptr host = Host::GetByName(key);
|
|
||||||
|
|
||||||
if (!host)
|
if (!host)
|
||||||
continue;
|
continue;
|
||||||
|
@ -408,13 +407,11 @@ set<Service::Ptr> Service::GetParentServices(void) const
|
||||||
set<Service::Ptr> parents;
|
set<Service::Ptr> parents;
|
||||||
|
|
||||||
Host::Ptr host = GetHost();
|
Host::Ptr host = GetHost();
|
||||||
Dictionary::Ptr dependencies = GetServiceDependencies();
|
Array::Ptr dependencies = GetServiceDependencies();
|
||||||
|
|
||||||
if (host && dependencies) {
|
if (host && dependencies) {
|
||||||
String key;
|
BOOST_FOREACH(const Value& dependency, dependencies) {
|
||||||
Value value;
|
Service::Ptr service = host->GetServiceByShortName(dependency);
|
||||||
BOOST_FOREACH(tie(key, value), dependencies) {
|
|
||||||
Service::Ptr service = host->GetServiceByShortName(value);
|
|
||||||
|
|
||||||
if (!service)
|
if (!service)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -89,9 +89,9 @@ public:
|
||||||
String GetDisplayName(void) const;
|
String GetDisplayName(void) const;
|
||||||
Host::Ptr GetHost(void) const;
|
Host::Ptr GetHost(void) const;
|
||||||
Dictionary::Ptr GetMacros(void) const;
|
Dictionary::Ptr GetMacros(void) const;
|
||||||
Dictionary::Ptr GetHostDependencies(void) const;
|
Array::Ptr GetHostDependencies(void) const;
|
||||||
Dictionary::Ptr GetServiceDependencies(void) const;
|
Array::Ptr GetServiceDependencies(void) const;
|
||||||
Dictionary::Ptr GetGroups(void) const;
|
Array::Ptr GetGroups(void) const;
|
||||||
String GetHostName(void) const;
|
String GetHostName(void) const;
|
||||||
String GetShortName(void) const;
|
String GetShortName(void) const;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ public:
|
||||||
void SetAcknowledgement(AcknowledgementType acknowledgement);
|
void SetAcknowledgement(AcknowledgementType acknowledgement);
|
||||||
|
|
||||||
/* Checks */
|
/* Checks */
|
||||||
Dictionary::Ptr GetCheckers(void) const;
|
Array::Ptr GetCheckers(void) const;
|
||||||
Value GetCheckCommand(void) const;
|
Value GetCheckCommand(void) const;
|
||||||
long GetMaxCheckAttempts(void) const;
|
long GetMaxCheckAttempts(void) const;
|
||||||
TimePeriod::Ptr GetCheckPeriod(void) const;
|
TimePeriod::Ptr GetCheckPeriod(void) const;
|
||||||
|
@ -254,9 +254,9 @@ private:
|
||||||
|
|
||||||
Attribute<String> m_DisplayName;
|
Attribute<String> m_DisplayName;
|
||||||
Attribute<Dictionary::Ptr> m_Macros;
|
Attribute<Dictionary::Ptr> m_Macros;
|
||||||
Attribute<Dictionary::Ptr> m_HostDependencies;
|
Attribute<Array::Ptr> m_HostDependencies;
|
||||||
Attribute<Dictionary::Ptr> m_ServiceDependencies;
|
Attribute<Array::Ptr> m_ServiceDependencies;
|
||||||
Attribute<Dictionary::Ptr> m_ServiceGroups;
|
Attribute<Array::Ptr> m_ServiceGroups;
|
||||||
Attribute<String> m_ShortName;
|
Attribute<String> m_ShortName;
|
||||||
Attribute<long> m_Acknowledgement;
|
Attribute<long> m_Acknowledgement;
|
||||||
Attribute<double> m_AcknowledgementExpiry;
|
Attribute<double> m_AcknowledgementExpiry;
|
||||||
|
@ -269,7 +269,7 @@ private:
|
||||||
Attribute<double> m_CheckInterval;
|
Attribute<double> m_CheckInterval;
|
||||||
Attribute<double> m_RetryInterval;
|
Attribute<double> m_RetryInterval;
|
||||||
Attribute<double> m_NextCheck;
|
Attribute<double> m_NextCheck;
|
||||||
Attribute<Dictionary::Ptr> m_Checkers;
|
Attribute<Array::Ptr> m_Checkers;
|
||||||
Attribute<String> m_CurrentChecker;
|
Attribute<String> m_CurrentChecker;
|
||||||
Attribute<long> m_CheckAttempt;
|
Attribute<long> m_CheckAttempt;
|
||||||
Attribute<long> m_State;
|
Attribute<long> m_State;
|
||||||
|
|
|
@ -155,14 +155,12 @@ void ServiceGroup::RefreshMembersCache(void)
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("Service")) {
|
||||||
const Service::Ptr& service = static_pointer_cast<Service>(object);
|
const Service::Ptr& service = static_pointer_cast<Service>(object);
|
||||||
|
|
||||||
Dictionary::Ptr dict;
|
Array::Ptr groups = service->GetGroups();
|
||||||
dict = service->GetGroups();
|
|
||||||
|
|
||||||
if (dict) {
|
if (groups) {
|
||||||
ObjectLock mlock(dict);
|
ObjectLock mlock(groups);
|
||||||
Value servicegroup;
|
BOOST_FOREACH(const Value& group, groups) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, servicegroup), dict) {
|
newMembersCache[group].push_back(service);
|
||||||
newMembersCache[servicegroup].push_back(service);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ String User::GetDisplayName(void) const
|
||||||
/**
|
/**
|
||||||
* @threadsafety Always.
|
* @threadsafety Always.
|
||||||
*/
|
*/
|
||||||
Dictionary::Ptr User::GetGroups(void) const
|
Array::Ptr User::GetGroups(void) const
|
||||||
{
|
{
|
||||||
return m_Groups;
|
return m_Groups;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
static User::Ptr GetByName(const String& name);
|
static User::Ptr GetByName(const String& name);
|
||||||
|
|
||||||
String GetDisplayName(void) const;
|
String GetDisplayName(void) const;
|
||||||
Dictionary::Ptr GetGroups(void) const;
|
Array::Ptr GetGroups(void) const;
|
||||||
|
|
||||||
Dictionary::Ptr GetMacros(void) const;
|
Dictionary::Ptr GetMacros(void) const;
|
||||||
Dictionary::Ptr CalculateDynamicMacros(void) const;
|
Dictionary::Ptr CalculateDynamicMacros(void) const;
|
||||||
|
@ -51,7 +51,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
Attribute<String> m_DisplayName;
|
Attribute<String> m_DisplayName;
|
||||||
Attribute<Dictionary::Ptr> m_Macros;
|
Attribute<Dictionary::Ptr> m_Macros;
|
||||||
Attribute<Dictionary::Ptr> m_Groups;
|
Attribute<Array::Ptr> m_Groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,14 +137,12 @@ void UserGroup::RefreshMembersCache(void)
|
||||||
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
|
BOOST_FOREACH(const DynamicObject::Ptr& object, DynamicType::GetObjects("User")) {
|
||||||
const User::Ptr& user = static_pointer_cast<User>(object);
|
const User::Ptr& user = static_pointer_cast<User>(object);
|
||||||
|
|
||||||
Dictionary::Ptr dict;
|
Array::Ptr groups = user->GetGroups();
|
||||||
dict = user->GetGroups();
|
|
||||||
|
|
||||||
if (dict) {
|
if (groups) {
|
||||||
ObjectLock mlock(dict);
|
ObjectLock mlock(groups);
|
||||||
Value UserGroup;
|
BOOST_FOREACH(const Value& group, groups) {
|
||||||
BOOST_FOREACH(tie(tuples::ignore, UserGroup), dict) {
|
newMembersCache[group].push_back(user);
|
||||||
newMembersCache[UserGroup].push_back(user);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue