mirror of https://github.com/Icinga/icinga2.git
Implement new validation type: name(Type)
This commit is contained in:
parent
76cc0061b3
commit
288a877625
|
@ -1,5 +1,5 @@
|
|||
|
||||
#line 3 "config_lexer.cc"
|
||||
#line 3 "../../../lib/config/config_lexer.cc"
|
||||
|
||||
#define YY_INT_ALIGNED short int
|
||||
|
||||
|
@ -370,8 +370,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
|
|||
*yy_cp = '\0'; \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
|
||||
#define YY_NUM_RULES 56
|
||||
#define YY_END_OF_BUFFER 57
|
||||
#define YY_NUM_RULES 57
|
||||
#define YY_END_OF_BUFFER 58
|
||||
/* This struct is not used in this scanner,
|
||||
but its presence is necessary. */
|
||||
struct yy_trans_info
|
||||
|
@ -379,28 +379,30 @@ struct yy_trans_info
|
|||
flex_int32_t yy_verify;
|
||||
flex_int32_t yy_nxt;
|
||||
};
|
||||
static yyconst flex_int16_t yy_accept[191] =
|
||||
static yyconst flex_int16_t yy_accept[194] =
|
||||
{ 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 57, 55,
|
||||
21, 21, 1, 55, 43, 55, 55, 55, 49, 55,
|
||||
50, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||
43, 43, 55, 18, 19, 12, 3, 2, 56, 15,
|
||||
15, 0, 0, 0, 43, 53, 51, 49, 52, 16,
|
||||
20, 54, 0, 46, 47, 48, 0, 44, 43, 43,
|
||||
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||
43, 43, 43, 43, 0, 17, 12, 11, 4, 5,
|
||||
9, 10, 6, 8, 7, 0, 0, 0, 0, 20,
|
||||
49, 45, 43, 28, 43, 43, 43, 43, 43, 43,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 58, 56,
|
||||
21, 21, 1, 56, 44, 56, 56, 56, 50, 56,
|
||||
51, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 56, 18, 19, 12, 3, 2, 57, 15,
|
||||
15, 0, 0, 0, 44, 54, 52, 50, 53, 16,
|
||||
20, 55, 0, 47, 48, 49, 0, 45, 44, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 44, 44, 44, 0, 17, 12, 11, 4,
|
||||
5, 9, 10, 6, 8, 7, 0, 0, 0, 0,
|
||||
20, 50, 46, 44, 28, 44, 44, 44, 44, 44,
|
||||
|
||||
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
|
||||
44, 44, 13, 4, 5, 14, 0, 0, 0, 44,
|
||||
44, 44, 44, 44, 44, 44, 44, 29, 40, 44,
|
||||
44, 44, 44, 44, 44, 42, 22, 4, 0, 0,
|
||||
0, 44, 24, 44, 43, 44, 44, 44, 34, 44,
|
||||
44, 44, 44, 44, 44, 0, 0, 0, 44, 44,
|
||||
44, 44, 44, 25, 35, 44, 27, 26, 44, 0,
|
||||
0, 0, 44, 44, 37, 44, 38, 41, 44, 0,
|
||||
31, 0, 33, 44, 39, 36, 0, 0, 44, 32,
|
||||
30, 23, 0
|
||||
|
||||
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
|
||||
13, 4, 5, 14, 0, 0, 0, 43, 43, 43,
|
||||
43, 43, 43, 43, 43, 39, 43, 43, 43, 43,
|
||||
43, 43, 41, 22, 4, 0, 0, 0, 43, 24,
|
||||
43, 42, 43, 43, 43, 33, 43, 43, 43, 43,
|
||||
43, 43, 0, 0, 0, 43, 43, 43, 43, 43,
|
||||
25, 34, 43, 27, 26, 43, 0, 0, 0, 43,
|
||||
43, 36, 43, 37, 40, 43, 0, 30, 0, 32,
|
||||
43, 38, 35, 0, 0, 43, 31, 29, 23, 0
|
||||
} ;
|
||||
|
||||
static yyconst flex_int32_t yy_ec[256] =
|
||||
|
@ -444,156 +446,162 @@ static yyconst flex_int32_t yy_meta[43] =
|
|||
1, 1
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_base[199] =
|
||||
static yyconst flex_int16_t yy_base[202] =
|
||||
{ 0,
|
||||
0, 0, 340, 339, 40, 42, 302, 301, 342, 347,
|
||||
347, 347, 347, 28, 326, 325, 37, 44, 44, 323,
|
||||
347, 323, 42, 49, 46, 51, 54, 53, 63, 56,
|
||||
64, 69, 296, 347, 326, 0, 347, 347, 99, 347,
|
||||
293, 297, 310, 313, 316, 347, 347, 86, 347, 347,
|
||||
0, 347, 76, 347, 294, 347, 313, 347, 36, 74,
|
||||
78, 75, 79, 100, 85, 103, 102, 92, 110, 84,
|
||||
112, 113, 91, 118, 287, 347, 0, 347, 126, 128,
|
||||
347, 347, 347, 347, 347, 285, 289, 291, 295, 0,
|
||||
130, 347, 120, 308, 129, 131, 134, 135, 138, 137,
|
||||
0, 0, 346, 345, 40, 42, 308, 307, 348, 353,
|
||||
353, 353, 353, 28, 332, 331, 37, 44, 44, 329,
|
||||
353, 329, 42, 49, 46, 51, 54, 53, 63, 56,
|
||||
64, 69, 302, 353, 332, 0, 353, 353, 99, 353,
|
||||
299, 303, 316, 319, 322, 353, 353, 86, 353, 353,
|
||||
0, 353, 76, 353, 300, 353, 319, 353, 78, 75,
|
||||
85, 81, 74, 92, 79, 106, 102, 109, 113, 90,
|
||||
114, 91, 116, 120, 122, 293, 353, 0, 353, 131,
|
||||
133, 353, 353, 353, 353, 353, 291, 295, 297, 301,
|
||||
0, 136, 353, 134, 314, 135, 136, 125, 138, 137,
|
||||
|
||||
139, 140, 147, 148, 144, 150, 158, 159, 160, 161,
|
||||
347, 166, 175, 347, 287, 283, 293, 165, 167, 174,
|
||||
173, 175, 176, 178, 179, 304, 180, 183, 187, 190,
|
||||
184, 191, 303, 302, 205, 289, 288, 292, 203, 298,
|
||||
195, 297, 197, 206, 208, 296, 209, 210, 211, 213,
|
||||
214, 216, 290, 272, 281, 217, 219, 222, 221, 225,
|
||||
284, 265, 226, 264, 263, 227, 239, 253, 238, 231,
|
||||
234, 258, 236, 256, 255, 237, 232, 347, 235, 251,
|
||||
239, 248, 247, 238, 224, 241, 347, 347, 242, 347,
|
||||
281, 285, 289, 98, 293, 297, 301, 305
|
||||
141, 144, 142, 149, 154, 160, 153, 155, 162, 164,
|
||||
165, 170, 353, 170, 175, 353, 293, 289, 299, 176,
|
||||
177, 179, 180, 181, 183, 185, 184, 310, 309, 186,
|
||||
187, 195, 197, 190, 199, 308, 307, 212, 294, 293,
|
||||
297, 210, 303, 200, 302, 205, 211, 215, 299, 216,
|
||||
218, 220, 219, 221, 222, 287, 271, 268, 227, 225,
|
||||
229, 228, 230, 271, 270, 232, 269, 268, 234, 244,
|
||||
258, 242, 238, 243, 262, 242, 261, 259, 244, 236,
|
||||
353, 240, 254, 245, 253, 251, 241, 172, 248, 353,
|
||||
353, 93, 353, 288, 292, 296, 47, 300, 304, 308,
|
||||
|
||||
312
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_def[199] =
|
||||
static yyconst flex_int16_t yy_def[202] =
|
||||
{ 0,
|
||||
190, 1, 191, 191, 192, 192, 193, 193, 190, 190,
|
||||
190, 190, 190, 190, 194, 190, 190, 190, 190, 195,
|
||||
190, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 190, 190, 190, 196, 190, 190, 197, 190,
|
||||
190, 190, 190, 190, 194, 190, 190, 190, 190, 190,
|
||||
198, 190, 190, 190, 190, 190, 195, 190, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 190, 190, 196, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 198,
|
||||
190, 190, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
193, 1, 194, 194, 195, 195, 196, 196, 193, 193,
|
||||
193, 193, 193, 193, 197, 193, 193, 193, 193, 198,
|
||||
193, 197, 197, 197, 197, 197, 197, 197, 197, 197,
|
||||
197, 197, 193, 193, 193, 199, 193, 193, 200, 193,
|
||||
193, 193, 193, 193, 197, 193, 193, 193, 193, 193,
|
||||
201, 193, 193, 193, 193, 193, 198, 193, 197, 197,
|
||||
197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
|
||||
197, 197, 197, 197, 197, 193, 193, 199, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
201, 193, 193, 197, 197, 197, 197, 197, 197, 197,
|
||||
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
190, 190, 190, 190, 190, 190, 190, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 190, 190, 190, 190, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
|
||||
194, 194, 190, 190, 190, 194, 194, 194, 194, 194,
|
||||
194, 194, 194, 194, 194, 194, 190, 190, 190, 194,
|
||||
194, 194, 194, 194, 194, 194, 190, 190, 190, 194,
|
||||
194, 194, 194, 190, 190, 194, 190, 190, 194, 0,
|
||||
190, 190, 190, 190, 190, 190, 190, 190
|
||||
197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
|
||||
197, 197, 193, 193, 193, 193, 193, 193, 193, 197,
|
||||
197, 197, 197, 197, 197, 197, 197, 197, 197, 197,
|
||||
197, 197, 197, 197, 197, 197, 197, 193, 193, 193,
|
||||
193, 197, 197, 197, 197, 197, 197, 197, 197, 197,
|
||||
197, 197, 197, 197, 197, 193, 193, 193, 197, 197,
|
||||
197, 197, 197, 197, 197, 197, 197, 197, 197, 193,
|
||||
193, 193, 197, 197, 197, 197, 197, 197, 197, 193,
|
||||
193, 193, 197, 197, 197, 197, 193, 193, 197, 193,
|
||||
193, 197, 0, 193, 193, 193, 193, 193, 193, 193,
|
||||
|
||||
193
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_nxt[390] =
|
||||
static yyconst flex_int16_t yy_nxt[396] =
|
||||
{ 0,
|
||||
10, 11, 12, 13, 14, 15, 16, 17, 10, 18,
|
||||
19, 19, 10, 20, 21, 10, 22, 10, 23, 22,
|
||||
22, 24, 22, 25, 22, 22, 26, 22, 27, 22,
|
||||
28, 29, 30, 22, 22, 31, 32, 22, 22, 22,
|
||||
33, 10, 37, 38, 37, 38, 42, 48, 48, 50,
|
||||
190, 49, 53, 51, 48, 48, 190, 39, 52, 39,
|
||||
190, 59, 43, 190, 63, 190, 44, 190, 190, 54,
|
||||
190, 93, 60, 55, 69, 62, 61, 190, 190, 56,
|
||||
65, 64, 68, 190, 70, 66, 91, 91, 190, 190,
|
||||
67, 72, 190, 190, 53, 96, 48, 48, 190, 190,
|
||||
45, 49, 53, 51, 48, 48, 193, 39, 52, 39,
|
||||
193, 59, 43, 193, 63, 193, 44, 193, 193, 54,
|
||||
193, 67, 60, 55, 70, 62, 61, 193, 193, 56,
|
||||
65, 64, 69, 193, 71, 66, 92, 92, 193, 193,
|
||||
68, 73, 193, 193, 53, 193, 48, 48, 101, 193,
|
||||
|
||||
71, 45, 106, 73, 100, 190, 190, 97, 74, 79,
|
||||
80, 54, 95, 94, 190, 55, 190, 190, 81, 104,
|
||||
98, 56, 82, 101, 190, 99, 190, 190, 109, 83,
|
||||
102, 103, 190, 84, 190, 85, 112, 113, 113, 113,
|
||||
91, 91, 108, 190, 105, 190, 107, 119, 190, 190,
|
||||
110, 190, 190, 190, 190, 54, 118, 125, 190, 55,
|
||||
123, 190, 190, 122, 190, 56, 127, 120, 126, 121,
|
||||
128, 124, 190, 190, 190, 190, 135, 113, 130, 190,
|
||||
129, 190, 133, 134, 131, 113, 113, 190, 190, 190,
|
||||
190, 132, 190, 190, 190, 142, 145, 190, 190, 139,
|
||||
72, 97, 98, 74, 193, 193, 193, 193, 75, 80,
|
||||
81, 54, 99, 94, 95, 55, 193, 100, 82, 96,
|
||||
193, 56, 83, 193, 107, 109, 102, 193, 193, 84,
|
||||
193, 103, 108, 85, 193, 86, 193, 104, 105, 193,
|
||||
106, 114, 115, 115, 115, 110, 92, 92, 193, 193,
|
||||
193, 193, 193, 121, 112, 193, 193, 111, 193, 125,
|
||||
123, 54, 127, 193, 128, 55, 124, 193, 193, 193,
|
||||
120, 56, 122, 130, 193, 126, 193, 129, 193, 193,
|
||||
138, 115, 131, 133, 193, 115, 115, 136, 134, 132,
|
||||
193, 193, 137, 193, 193, 193, 135, 193, 193, 193,
|
||||
|
||||
141, 190, 147, 148, 190, 190, 140, 146, 150, 190,
|
||||
144, 190, 143, 149, 151, 113, 113, 190, 158, 152,
|
||||
190, 156, 190, 190, 190, 190, 157, 190, 190, 163,
|
||||
190, 190, 159, 190, 166, 190, 190, 170, 165, 190,
|
||||
190, 190, 160, 161, 172, 190, 162, 164, 190, 171,
|
||||
190, 190, 181, 190, 175, 190, 190, 173, 188, 183,
|
||||
187, 190, 190, 176, 174, 190, 185, 180, 184, 190,
|
||||
190, 182, 190, 186, 179, 178, 177, 190, 190, 190,
|
||||
189, 34, 34, 34, 34, 36, 36, 36, 36, 40,
|
||||
40, 40, 40, 57, 57, 57, 57, 77, 190, 169,
|
||||
193, 193, 145, 148, 193, 144, 191, 151, 150, 193,
|
||||
142, 193, 149, 193, 193, 153, 143, 147, 146, 193,
|
||||
154, 152, 115, 115, 193, 193, 161, 155, 159, 193,
|
||||
193, 160, 193, 193, 193, 193, 193, 162, 166, 193,
|
||||
169, 193, 193, 193, 193, 168, 193, 173, 193, 163,
|
||||
164, 175, 193, 167, 165, 174, 193, 193, 193, 193,
|
||||
178, 184, 193, 190, 176, 193, 186, 193, 193, 177,
|
||||
179, 188, 187, 193, 183, 193, 193, 185, 182, 189,
|
||||
181, 180, 193, 193, 193, 193, 172, 192, 34, 34,
|
||||
34, 34, 36, 36, 36, 36, 40, 40, 40, 40,
|
||||
|
||||
57, 57, 57, 57, 78, 171, 170, 78, 79, 79,
|
||||
79, 79, 91, 193, 91, 91, 193, 193, 158, 157,
|
||||
156, 193, 193, 193, 193, 141, 140, 139, 193, 119,
|
||||
118, 117, 116, 113, 58, 93, 193, 90, 89, 88,
|
||||
87, 77, 76, 193, 58, 47, 46, 193, 41, 41,
|
||||
35, 35, 9, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193
|
||||
|
||||
77, 78, 78, 78, 78, 90, 168, 90, 90, 167,
|
||||
190, 190, 190, 155, 154, 153, 190, 190, 190, 138,
|
||||
137, 136, 190, 117, 116, 115, 114, 111, 58, 92,
|
||||
190, 89, 88, 87, 86, 76, 75, 190, 58, 47,
|
||||
46, 190, 41, 41, 35, 35, 9, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190
|
||||
} ;
|
||||
|
||||
static yyconst flex_int16_t yy_chk[390] =
|
||||
static yyconst flex_int16_t yy_chk[396] =
|
||||
{ 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,
|
||||
1, 1, 5, 5, 6, 6, 14, 17, 17, 18,
|
||||
59, 17, 19, 18, 19, 19, 23, 5, 18, 6,
|
||||
197, 17, 19, 18, 19, 19, 23, 5, 18, 6,
|
||||
25, 23, 14, 24, 25, 26, 14, 28, 27, 19,
|
||||
30, 59, 23, 19, 30, 24, 23, 29, 31, 19,
|
||||
27, 26, 29, 32, 31, 27, 53, 53, 60, 62,
|
||||
28, 32, 61, 63, 48, 62, 48, 48, 70, 65,
|
||||
30, 28, 23, 19, 30, 24, 23, 29, 31, 19,
|
||||
27, 26, 29, 32, 31, 27, 53, 53, 63, 60,
|
||||
28, 32, 59, 65, 48, 62, 48, 48, 65, 61,
|
||||
|
||||
31, 194, 70, 32, 65, 73, 68, 63, 32, 39,
|
||||
39, 48, 61, 60, 64, 48, 67, 66, 39, 68,
|
||||
64, 48, 39, 66, 69, 64, 71, 72, 73, 39,
|
||||
67, 67, 74, 39, 93, 39, 79, 79, 80, 80,
|
||||
91, 91, 72, 95, 69, 96, 71, 95, 97, 98,
|
||||
74, 100, 99, 101, 102, 91, 93, 101, 105, 91,
|
||||
99, 103, 104, 98, 106, 91, 103, 96, 102, 97,
|
||||
104, 100, 107, 108, 109, 110, 112, 112, 106, 118,
|
||||
105, 119, 109, 110, 107, 113, 113, 121, 120, 122,
|
||||
123, 108, 124, 125, 127, 121, 124, 128, 131, 118,
|
||||
31, 62, 63, 32, 70, 72, 64, 192, 32, 39,
|
||||
39, 48, 64, 59, 60, 48, 67, 64, 39, 61,
|
||||
66, 48, 39, 68, 70, 72, 66, 69, 71, 39,
|
||||
73, 67, 71, 39, 74, 39, 75, 68, 68, 98,
|
||||
69, 80, 80, 81, 81, 73, 92, 92, 94, 96,
|
||||
97, 100, 99, 96, 75, 101, 103, 74, 102, 100,
|
||||
98, 92, 102, 104, 103, 92, 99, 107, 105, 108,
|
||||
94, 92, 97, 105, 106, 101, 109, 104, 110, 111,
|
||||
114, 114, 106, 108, 112, 115, 115, 111, 109, 107,
|
||||
120, 121, 112, 122, 123, 124, 110, 125, 127, 126,
|
||||
|
||||
120, 129, 127, 128, 130, 132, 119, 125, 130, 141,
|
||||
123, 143, 122, 129, 131, 135, 135, 139, 143, 132,
|
||||
144, 139, 145, 147, 148, 149, 141, 150, 151, 149,
|
||||
152, 156, 144, 157, 152, 159, 158, 156, 151, 160,
|
||||
163, 166, 145, 147, 158, 170, 148, 150, 171, 157,
|
||||
173, 176, 171, 181, 163, 186, 189, 159, 185, 176,
|
||||
184, 183, 182, 166, 160, 180, 179, 170, 177, 175,
|
||||
174, 173, 172, 181, 169, 168, 167, 165, 164, 162,
|
||||
186, 191, 191, 191, 191, 192, 192, 192, 192, 193,
|
||||
193, 193, 193, 195, 195, 195, 195, 196, 161, 155,
|
||||
130, 131, 123, 126, 134, 122, 188, 131, 130, 132,
|
||||
120, 133, 127, 135, 144, 133, 121, 125, 124, 146,
|
||||
134, 132, 138, 138, 142, 147, 146, 135, 142, 148,
|
||||
150, 144, 151, 153, 152, 154, 155, 147, 152, 160,
|
||||
155, 159, 162, 161, 163, 154, 166, 159, 169, 148,
|
||||
150, 161, 173, 153, 151, 160, 176, 174, 179, 184,
|
||||
166, 174, 189, 187, 162, 186, 179, 185, 183, 163,
|
||||
169, 182, 180, 178, 173, 177, 175, 176, 172, 184,
|
||||
171, 170, 168, 167, 165, 164, 158, 189, 194, 194,
|
||||
194, 194, 195, 195, 195, 195, 196, 196, 196, 196,
|
||||
|
||||
198, 198, 198, 198, 199, 157, 156, 199, 200, 200,
|
||||
200, 200, 201, 149, 201, 201, 145, 143, 141, 140,
|
||||
139, 137, 136, 129, 128, 119, 118, 117, 95, 90,
|
||||
89, 88, 87, 76, 57, 55, 45, 44, 43, 42,
|
||||
41, 35, 33, 22, 20, 16, 15, 9, 8, 7,
|
||||
4, 3, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193, 193, 193, 193, 193, 193,
|
||||
193, 193, 193, 193, 193
|
||||
|
||||
196, 197, 197, 197, 197, 198, 154, 198, 198, 153,
|
||||
146, 142, 140, 138, 137, 136, 134, 133, 126, 117,
|
||||
116, 115, 94, 89, 88, 87, 86, 75, 57, 55,
|
||||
45, 44, 43, 42, 41, 35, 33, 22, 20, 16,
|
||||
15, 9, 8, 7, 4, 3, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
|
||||
190, 190, 190, 190, 190, 190, 190, 190, 190
|
||||
} ;
|
||||
|
||||
/* Table of booleans, true if rule could match eol. */
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[57] =
|
||||
static yyconst flex_int32_t yy_rule_can_match_eol[58] =
|
||||
{ 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, 0, 0, 0, 1, 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, };
|
||||
|
||||
/* The intent behind this definition is that it'll catch
|
||||
* any uses of REJECT which flex missed.
|
||||
|
@ -697,7 +705,7 @@ static char *lb_steal(lex_buf *lb)
|
|||
|
||||
|
||||
|
||||
#line 701 "config_lexer.cc"
|
||||
#line 709 "../../../lib/config/config_lexer.cc"
|
||||
|
||||
#define INITIAL 0
|
||||
#define C_COMMENT 1
|
||||
|
@ -954,7 +962,7 @@ YY_DECL
|
|||
|
||||
lex_buf string_buf;
|
||||
|
||||
#line 958 "config_lexer.cc"
|
||||
#line 966 "../../../lib/config/config_lexer.cc"
|
||||
|
||||
yylval = yylval_param;
|
||||
|
||||
|
@ -1011,13 +1019,13 @@ yy_match:
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 191 )
|
||||
if ( yy_current_state >= 194 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
++yy_cp;
|
||||
}
|
||||
while ( yy_current_state != 190 );
|
||||
while ( yy_current_state != 193 );
|
||||
yy_cp = yyg->yy_last_accepting_cpos;
|
||||
yy_current_state = yyg->yy_last_accepting_state;
|
||||
|
||||
|
@ -1249,103 +1257,103 @@ YY_RULE_SETUP
|
|||
case 29:
|
||||
YY_RULE_SETUP
|
||||
#line 197 "config_lexer.ll"
|
||||
{ return T_VALIDATOR; }
|
||||
{ yylval->type = TypeName; return T_TYPE_NAME; }
|
||||
YY_BREAK
|
||||
case 30:
|
||||
YY_RULE_SETUP
|
||||
#line 198 "config_lexer.ll"
|
||||
{ return T_REQUIRE; }
|
||||
{ return T_VALIDATOR; }
|
||||
YY_BREAK
|
||||
case 31:
|
||||
YY_RULE_SETUP
|
||||
#line 199 "config_lexer.ll"
|
||||
{ return T_ATTRIBUTE; }
|
||||
{ return T_REQUIRE; }
|
||||
YY_BREAK
|
||||
case 32:
|
||||
YY_RULE_SETUP
|
||||
#line 200 "config_lexer.ll"
|
||||
return T_ABSTRACT;
|
||||
{ return T_ATTRIBUTE; }
|
||||
YY_BREAK
|
||||
case 33:
|
||||
YY_RULE_SETUP
|
||||
#line 201 "config_lexer.ll"
|
||||
return T_LOCAL;
|
||||
return T_ABSTRACT;
|
||||
YY_BREAK
|
||||
case 34:
|
||||
YY_RULE_SETUP
|
||||
#line 202 "config_lexer.ll"
|
||||
return T_OBJECT;
|
||||
return T_LOCAL;
|
||||
YY_BREAK
|
||||
case 35:
|
||||
YY_RULE_SETUP
|
||||
#line 203 "config_lexer.ll"
|
||||
return T_TEMPLATE;
|
||||
return T_OBJECT;
|
||||
YY_BREAK
|
||||
case 36:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "config_lexer.ll"
|
||||
return T_INCLUDE;
|
||||
return T_TEMPLATE;
|
||||
YY_BREAK
|
||||
case 37:
|
||||
YY_RULE_SETUP
|
||||
#line 205 "config_lexer.ll"
|
||||
return T_LIBRARY;
|
||||
return T_INCLUDE;
|
||||
YY_BREAK
|
||||
case 38:
|
||||
YY_RULE_SETUP
|
||||
#line 206 "config_lexer.ll"
|
||||
return T_INHERITS;
|
||||
return T_LIBRARY;
|
||||
YY_BREAK
|
||||
case 39:
|
||||
YY_RULE_SETUP
|
||||
#line 207 "config_lexer.ll"
|
||||
return T_NULL;
|
||||
return T_INHERITS;
|
||||
YY_BREAK
|
||||
case 40:
|
||||
YY_RULE_SETUP
|
||||
#line 208 "config_lexer.ll"
|
||||
return T_PARTIAL;
|
||||
return T_NULL;
|
||||
YY_BREAK
|
||||
case 41:
|
||||
YY_RULE_SETUP
|
||||
#line 209 "config_lexer.ll"
|
||||
{ yylval->num = 1; return T_NUMBER; }
|
||||
return T_PARTIAL;
|
||||
YY_BREAK
|
||||
case 42:
|
||||
YY_RULE_SETUP
|
||||
#line 210 "config_lexer.ll"
|
||||
{ yylval->num = 0; return T_NUMBER; }
|
||||
{ yylval->num = 1; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 43:
|
||||
YY_RULE_SETUP
|
||||
#line 211 "config_lexer.ll"
|
||||
{ yylval->text = strdup(yytext); return T_IDENTIFIER; }
|
||||
{ yylval->num = 0; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 44:
|
||||
/* rule 44 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 212 "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
|
||||
case 45:
|
||||
/* rule 45 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 213 "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
|
||||
case 46:
|
||||
YY_RULE_SETUP
|
||||
#line 214 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||
{ yylval->num = strtod(yytext, NULL) / 1000; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 47:
|
||||
YY_RULE_SETUP
|
||||
#line 215 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||
{ yylval->num = strtod(yytext, NULL) * 60 * 60; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 48:
|
||||
YY_RULE_SETUP
|
||||
#line 216 "config_lexer.ll"
|
||||
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||
{ yylval->num = strtod(yytext, NULL) * 60; return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 49:
|
||||
YY_RULE_SETUP
|
||||
|
@ -1355,40 +1363,45 @@ YY_RULE_SETUP
|
|||
case 50:
|
||||
YY_RULE_SETUP
|
||||
#line 218 "config_lexer.ll"
|
||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||
{ yylval->num = strtod(yytext, NULL); return T_NUMBER; }
|
||||
YY_BREAK
|
||||
case 51:
|
||||
YY_RULE_SETUP
|
||||
#line 219 "config_lexer.ll"
|
||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
{ yylval->op = OperatorSet; return T_EQUAL; }
|
||||
YY_BREAK
|
||||
case 52:
|
||||
YY_RULE_SETUP
|
||||
#line 220 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
{ yylval->op = OperatorPlus; return T_PLUS_EQUAL; }
|
||||
YY_BREAK
|
||||
case 53:
|
||||
YY_RULE_SETUP
|
||||
#line 221 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
{ yylval->op = OperatorMinus; return T_MINUS_EQUAL; }
|
||||
YY_BREAK
|
||||
case 54:
|
||||
YY_RULE_SETUP
|
||||
#line 222 "config_lexer.ll"
|
||||
{ yylval->op = OperatorMultiply; return T_MULTIPLY_EQUAL; }
|
||||
YY_BREAK
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 223 "config_lexer.ll"
|
||||
{ yylval->op = OperatorDivide; return T_DIVIDE_EQUAL; }
|
||||
YY_BREAK
|
||||
|
||||
case 55:
|
||||
YY_RULE_SETUP
|
||||
#line 225 "config_lexer.ll"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case 56:
|
||||
YY_RULE_SETUP
|
||||
#line 227 "config_lexer.ll"
|
||||
#line 226 "config_lexer.ll"
|
||||
return yytext[0];
|
||||
YY_BREAK
|
||||
case 57:
|
||||
YY_RULE_SETUP
|
||||
#line 228 "config_lexer.ll"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1392 "config_lexer.cc"
|
||||
#line 1405 "../../../lib/config/config_lexer.cc"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(C_COMMENT):
|
||||
case YY_STATE_EOF(STRING):
|
||||
|
@ -1686,7 +1699,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 191 )
|
||||
if ( yy_current_state >= 194 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
|
@ -1715,11 +1728,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
|
|||
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
|
||||
{
|
||||
yy_current_state = (int) yy_def[yy_current_state];
|
||||
if ( yy_current_state >= 191 )
|
||||
if ( yy_current_state >= 194 )
|
||||
yy_c = yy_meta[(unsigned int) yy_c];
|
||||
}
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 190);
|
||||
yy_is_jam = (yy_current_state == 193);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
@ -2578,7 +2591,7 @@ void yyfree (void * ptr , yyscan_t yyscanner)
|
|||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 227 "config_lexer.ll"
|
||||
#line 228 "config_lexer.ll"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ number { yylval->type = TypeNumber; return T_TYPE_NUMBER; }
|
|||
string { yylval->type = TypeString; return T_TYPE_STRING; }
|
||||
scalar { yylval->type = TypeScalar; return T_TYPE_SCALAR; }
|
||||
any { yylval->type = TypeAny; return T_TYPE_ANY; }
|
||||
name { yylval->type = TypeName; return T_TYPE_NAME; }
|
||||
%validator { return T_VALIDATOR; }
|
||||
%require { return T_REQUIRE; }
|
||||
%attribute { return T_ATTRIBUTE; }
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -79,7 +79,7 @@ using namespace icinga;
|
|||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 83 "config_parser.h"
|
||||
#line 83 "../../../lib/config/config_parser.h"
|
||||
|
||||
/* Tokens. */
|
||||
#ifndef YYTOKENTYPE
|
||||
|
@ -103,18 +103,19 @@ using namespace icinga;
|
|||
T_TYPE_STRING = 271,
|
||||
T_TYPE_SCALAR = 272,
|
||||
T_TYPE_ANY = 273,
|
||||
T_VALIDATOR = 274,
|
||||
T_REQUIRE = 275,
|
||||
T_ATTRIBUTE = 276,
|
||||
T_TYPE = 277,
|
||||
T_ABSTRACT = 278,
|
||||
T_LOCAL = 279,
|
||||
T_OBJECT = 280,
|
||||
T_TEMPLATE = 281,
|
||||
T_INCLUDE = 282,
|
||||
T_LIBRARY = 283,
|
||||
T_INHERITS = 284,
|
||||
T_PARTIAL = 285
|
||||
T_TYPE_NAME = 274,
|
||||
T_VALIDATOR = 275,
|
||||
T_REQUIRE = 276,
|
||||
T_ATTRIBUTE = 277,
|
||||
T_TYPE = 278,
|
||||
T_ABSTRACT = 279,
|
||||
T_LOCAL = 280,
|
||||
T_OBJECT = 281,
|
||||
T_TEMPLATE = 282,
|
||||
T_INCLUDE = 283,
|
||||
T_LIBRARY = 284,
|
||||
T_INHERITS = 285,
|
||||
T_PARTIAL = 286
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
|
@ -134,18 +135,19 @@ using namespace icinga;
|
|||
#define T_TYPE_STRING 271
|
||||
#define T_TYPE_SCALAR 272
|
||||
#define T_TYPE_ANY 273
|
||||
#define T_VALIDATOR 274
|
||||
#define T_REQUIRE 275
|
||||
#define T_ATTRIBUTE 276
|
||||
#define T_TYPE 277
|
||||
#define T_ABSTRACT 278
|
||||
#define T_LOCAL 279
|
||||
#define T_OBJECT 280
|
||||
#define T_TEMPLATE 281
|
||||
#define T_INCLUDE 282
|
||||
#define T_LIBRARY 283
|
||||
#define T_INHERITS 284
|
||||
#define T_PARTIAL 285
|
||||
#define T_TYPE_NAME 274
|
||||
#define T_VALIDATOR 275
|
||||
#define T_REQUIRE 276
|
||||
#define T_ATTRIBUTE 277
|
||||
#define T_TYPE 278
|
||||
#define T_ABSTRACT 279
|
||||
#define T_LOCAL 280
|
||||
#define T_OBJECT 281
|
||||
#define T_TEMPLATE 282
|
||||
#define T_INCLUDE 283
|
||||
#define T_LIBRARY 284
|
||||
#define T_INHERITS 285
|
||||
#define T_PARTIAL 286
|
||||
|
||||
|
||||
|
||||
|
@ -170,7 +172,7 @@ typedef union YYSTYPE
|
|||
|
||||
|
||||
/* Line 2068 of yacc.c */
|
||||
#line 174 "config_parser.h"
|
||||
#line 176 "../../../lib/config/config_parser.h"
|
||||
} YYSTYPE;
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||
|
|
|
@ -78,6 +78,7 @@ using namespace icinga;
|
|||
%token <type> T_TYPE_STRING "string (T_TYPE_STRING)"
|
||||
%token <type> T_TYPE_SCALAR "scalar (T_TYPE_SCALAR)"
|
||||
%token <type> T_TYPE_ANY "any (T_TYPE_ANY)"
|
||||
%token <type> T_TYPE_NAME "name (T_TYPE_NAME)"
|
||||
%token T_VALIDATOR "%validator (T_VALIDATOR)"
|
||||
%token T_REQUIRE "%require (T_REQUIRE)"
|
||||
%token T_ATTRIBUTE "%attribute (T_ATTRIBUTE)"
|
||||
|
@ -246,14 +247,22 @@ typerule: T_REQUIRE T_STRING
|
|||
}
|
||||
| T_ATTRIBUTE type T_STRING
|
||||
{
|
||||
TypeRule rule($2, $3, TypeRuleList::Ptr(), yylloc);
|
||||
TypeRule rule($2, String(), $3, TypeRuleList::Ptr(), yylloc);
|
||||
free($3);
|
||||
|
||||
m_RuleLists.top()->AddRule(rule);
|
||||
}
|
||||
| T_ATTRIBUTE T_TYPE_NAME '(' identifier ')' T_STRING
|
||||
{
|
||||
TypeRule rule($2, $4, $6, TypeRuleList::Ptr(), yylloc);
|
||||
free($4);
|
||||
free($6);
|
||||
|
||||
m_RuleLists.top()->AddRule(rule);
|
||||
}
|
||||
| T_ATTRIBUTE type T_STRING typerulelist
|
||||
{
|
||||
TypeRule rule($2, $3, *$4, yylloc);
|
||||
TypeRule rule($2, String(), $3, *$4, yylloc);
|
||||
free($3);
|
||||
delete $4;
|
||||
m_RuleLists.top()->AddRule(rule);
|
||||
|
@ -274,6 +283,7 @@ type: T_TYPE_DICTIONARY
|
|||
| T_TYPE_STRING
|
||||
| T_TYPE_SCALAR
|
||||
| T_TYPE_ANY
|
||||
| T_TYPE_NAME
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,8 @@ void ConfigType::ValidateItem(const ConfigItem::Ptr& item) const
|
|||
item->GetLinkedExpressionList()->Execute(attrs);
|
||||
|
||||
std::vector<String> locations;
|
||||
locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "')");
|
||||
DebugInfo debugInfo = item->GetDebugInfo();
|
||||
locations.push_back("Object '" + item->GetName() + "' (Type: '" + item->GetType() + "') at " + debugInfo.Path + ":" + Convert::ToString(debugInfo.FirstLine));
|
||||
|
||||
ConfigType::Ptr parent;
|
||||
if (m_Parent.IsEmpty()) {
|
||||
|
@ -144,12 +145,13 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
|
|||
BOOST_FOREACH(boost::tie(key, value), dictionary) {
|
||||
TypeValidationResult overallResult = ValidationUnknownField;
|
||||
std::vector<TypeRuleList::Ptr> subRuleLists;
|
||||
String hint;
|
||||
|
||||
locations.push_back("Attribute '" + key + "'");
|
||||
|
||||
BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
|
||||
TypeRuleList::Ptr subRuleList;
|
||||
TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList);
|
||||
TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList, &hint);
|
||||
|
||||
if (subRuleList)
|
||||
subRuleLists.push_back(subRuleList);
|
||||
|
@ -168,8 +170,14 @@ void ConfigType::ValidateDictionary(const Dictionary::Ptr& dictionary,
|
|||
|
||||
if (overallResult == ValidationUnknownField)
|
||||
ConfigCompilerContext::GetContext()->AddError(true, "Unknown attribute: " + LocationToString(locations));
|
||||
else if (overallResult == ValidationInvalidType)
|
||||
ConfigCompilerContext::GetContext()->AddError(false, "Invalid type for attribute: " + LocationToString(locations));
|
||||
else if (overallResult == ValidationInvalidType) {
|
||||
String message = "Invalid value for attribute: " + LocationToString(locations);
|
||||
|
||||
if (!hint.IsEmpty())
|
||||
message += ": " + hint;
|
||||
|
||||
ConfigCompilerContext::GetContext()->AddError(false, message);
|
||||
}
|
||||
|
||||
if (!subRuleLists.empty() && value.IsObjectType<Dictionary>())
|
||||
ValidateDictionary(value, subRuleLists, locations);
|
||||
|
@ -223,12 +231,13 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
|
|||
|
||||
TypeValidationResult overallResult = ValidationUnknownField;
|
||||
std::vector<TypeRuleList::Ptr> subRuleLists;
|
||||
String hint;
|
||||
|
||||
locations.push_back("Attribute '" + key + "'");
|
||||
locations.push_back("Index " + key);
|
||||
|
||||
BOOST_FOREACH(const TypeRuleList::Ptr& ruleList, ruleLists) {
|
||||
TypeRuleList::Ptr subRuleList;
|
||||
TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList);
|
||||
TypeValidationResult result = ruleList->ValidateAttribute(key, value, &subRuleList, &hint);
|
||||
|
||||
if (subRuleList)
|
||||
subRuleLists.push_back(subRuleList);
|
||||
|
@ -247,8 +256,14 @@ void ConfigType::ValidateArray(const Array::Ptr& array,
|
|||
|
||||
if (overallResult == ValidationUnknownField)
|
||||
ConfigCompilerContext::GetContext()->AddError(true, "Unknown attribute: " + LocationToString(locations));
|
||||
else if (overallResult == ValidationInvalidType)
|
||||
ConfigCompilerContext::GetContext()->AddError(false, "Invalid type for array index: " + LocationToString(locations));
|
||||
else if (overallResult == ValidationInvalidType) {
|
||||
String message = "Invalid value for array index: " + LocationToString(locations);
|
||||
|
||||
if (!hint.IsEmpty())
|
||||
message += ": " + hint;
|
||||
|
||||
ConfigCompilerContext::GetContext()->AddError(false, message);
|
||||
}
|
||||
|
||||
if (!subRuleLists.empty() && value.IsObjectType<Dictionary>())
|
||||
ValidateDictionary(value, subRuleLists, locations);
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "config/typerule.h"
|
||||
#include "config/configitem.h"
|
||||
#include "config/configcompilercontext.h"
|
||||
#include "base/convert.h"
|
||||
#include "base/utility.h"
|
||||
#include "base/dictionary.h"
|
||||
|
@ -25,9 +27,10 @@
|
|||
|
||||
using namespace icinga;
|
||||
|
||||
TypeRule::TypeRule(TypeSpecifier type, const String& namePattern,
|
||||
const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo)
|
||||
: m_Type(type), m_NamePattern(namePattern), m_SubRules(subRules), m_DebugInfo(debuginfo)
|
||||
TypeRule::TypeRule(TypeSpecifier type, const String& nameType,
|
||||
const String& namePattern, const TypeRuleList::Ptr& subRules,
|
||||
const DebugInfo& debuginfo)
|
||||
: m_Type(type), m_NameType(nameType), m_NamePattern(namePattern), m_SubRules(subRules), m_DebugInfo(debuginfo)
|
||||
{ }
|
||||
|
||||
TypeRuleList::Ptr TypeRule::GetSubRules(void) const
|
||||
|
@ -40,8 +43,11 @@ bool TypeRule::MatchName(const String& name) const
|
|||
return (Utility::Match(m_NamePattern, name));
|
||||
}
|
||||
|
||||
bool TypeRule::MatchValue(const Value& value) const
|
||||
bool TypeRule::MatchValue(const Value& value, String *hint) const
|
||||
{
|
||||
ConfigCompilerContext *context;
|
||||
ConfigItem::Ptr item;
|
||||
|
||||
if (value.IsEmpty())
|
||||
return true;
|
||||
|
||||
|
@ -69,6 +75,25 @@ bool TypeRule::MatchValue(const Value& value) const
|
|||
case TypeArray:
|
||||
return value.IsObjectType<Array>();
|
||||
|
||||
case TypeName:
|
||||
if (!value.IsScalar())
|
||||
return false;
|
||||
|
||||
context = ConfigCompilerContext::GetContext();
|
||||
|
||||
if (context)
|
||||
item = context->GetItem(m_NameType, value);
|
||||
|
||||
if (!item && (!context || (context->GetFlags() & CompilerLinkExisting)))
|
||||
item = ConfigItem::GetObject(m_NameType, value);
|
||||
|
||||
if (!item) {
|
||||
*hint = "Object '" + value + "' of type '" + m_NameType + "' does not exist.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ enum TypeSpecifier
|
|||
TypeNumber,
|
||||
TypeString,
|
||||
TypeDictionary,
|
||||
TypeArray
|
||||
TypeArray,
|
||||
TypeName
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -50,16 +51,18 @@ enum TypeSpecifier
|
|||
struct I2_CONFIG_API TypeRule
|
||||
{
|
||||
public:
|
||||
TypeRule(TypeSpecifier type, const String& namePattern,
|
||||
const TypeRuleList::Ptr& subRules, const DebugInfo& debuginfo);
|
||||
TypeRule(TypeSpecifier type, const String& nameType,
|
||||
const String& namePattern, const TypeRuleList::Ptr& subRules,
|
||||
const DebugInfo& debuginfo);
|
||||
|
||||
TypeRuleList::Ptr GetSubRules(void) const;
|
||||
|
||||
bool MatchName(const String& name) const;
|
||||
bool MatchValue(const Value& value) const;
|
||||
bool MatchValue(const Value& value, String *hint) const;
|
||||
|
||||
private:
|
||||
TypeSpecifier m_Type;
|
||||
String m_NameType;
|
||||
String m_NamePattern;
|
||||
TypeRuleList::Ptr m_SubRules;
|
||||
DebugInfo m_DebugInfo;
|
||||
|
|
|
@ -113,10 +113,11 @@ size_t TypeRuleList::GetLength(void) const
|
|||
* @param name The name of the attribute.
|
||||
* @param value The value of the attribute.
|
||||
* @param[out] subRules The list of sub-rules for the matching rule.
|
||||
* @param[out] hint A hint describing the validation failure.
|
||||
* @returns The validation result.
|
||||
*/
|
||||
TypeValidationResult TypeRuleList::ValidateAttribute(const String& name,
|
||||
const Value& value, TypeRuleList::Ptr *subRules) const
|
||||
const Value& value, TypeRuleList::Ptr *subRules, String *hint) const
|
||||
{
|
||||
bool foundField = false;
|
||||
BOOST_FOREACH(const TypeRule& rule, m_Rules) {
|
||||
|
@ -125,7 +126,7 @@ TypeValidationResult TypeRuleList::ValidateAttribute(const String& name,
|
|||
|
||||
foundField = true;
|
||||
|
||||
if (rule.MatchValue(value)) {
|
||||
if (rule.MatchValue(value, hint)) {
|
||||
*subRules = rule.GetSubRules();
|
||||
return ValidationOK;
|
||||
}
|
||||
|
@ -136,4 +137,3 @@ TypeValidationResult TypeRuleList::ValidateAttribute(const String& name,
|
|||
else
|
||||
return ValidationUnknownField;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
void AddRule(const TypeRule& rule);
|
||||
void AddRules(const TypeRuleList::Ptr& ruleList);
|
||||
|
||||
TypeValidationResult ValidateAttribute(const String& name, const Value& value, TypeRuleList::Ptr *subRules) const;
|
||||
TypeValidationResult ValidateAttribute(const String& name, const Value& value, TypeRuleList::Ptr *subRules, String *hint) const;
|
||||
|
||||
size_t GetLength(void) const;
|
||||
|
||||
|
|
|
@ -21,15 +21,15 @@ type Host {
|
|||
%attribute string "display_name",
|
||||
%attribute string "hostcheck",
|
||||
%attribute array "hostgroups" {
|
||||
%attribute string "*"
|
||||
%attribute name(HostGroup) "*"
|
||||
},
|
||||
%attribute array "hostdependencies" {
|
||||
%attribute string "*"
|
||||
%attribute name(Host) "*"
|
||||
},
|
||||
%attribute array "servicedependencies" {
|
||||
%attribute dictionary "*" {
|
||||
%require "host",
|
||||
%attribute string "host",
|
||||
%attribute name(Host) "host",
|
||||
|
||||
%require "service",
|
||||
%attribute string "service"
|
||||
|
@ -40,7 +40,7 @@ type Host {
|
|||
|
||||
%attribute dictionary "*" {
|
||||
%attribute array "templates" {
|
||||
%attribute string "*"
|
||||
%attribute name(Service) "*"
|
||||
},
|
||||
|
||||
%attribute string "short_name",
|
||||
|
@ -52,26 +52,26 @@ type Host {
|
|||
|
||||
%attribute array "export_macros",
|
||||
|
||||
%attribute string "check_period",
|
||||
%attribute name(TimePeriod) "check_period",
|
||||
%attribute number "check_interval",
|
||||
%attribute number "retry_interval",
|
||||
|
||||
%attribute number "notification_interval",
|
||||
%attribute string "notification_period",
|
||||
%attribute name(TimePeriod) "notification_period",
|
||||
|
||||
%attribute array "servicegroups" {
|
||||
%attribute string "*"
|
||||
%attribute name(ServiceGroup) "*"
|
||||
},
|
||||
%attribute array "checkers" {
|
||||
%attribute string "*"
|
||||
},
|
||||
%attribute array "hostdependencies" {
|
||||
%attribute string "*"
|
||||
%attribute name(Host) "*"
|
||||
},
|
||||
%attribute array "servicedependencies" {
|
||||
%attribute dictionary "*" {
|
||||
%require "host",
|
||||
%attribute string "host",
|
||||
%attribute name(Host) "host",
|
||||
|
||||
%require "service",
|
||||
%attribute string "service"
|
||||
|
@ -81,20 +81,22 @@ type Host {
|
|||
%attribute dictionary "notifications" {
|
||||
%attribute dictionary "*" {
|
||||
%attribute array "templates" {
|
||||
%attribute string "*"
|
||||
%attribute name(Notification) "*"
|
||||
},
|
||||
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute name(User) "*"
|
||||
},
|
||||
%attribute array "groups" {
|
||||
%attribute string "*"
|
||||
%attribute name(UserGroup) "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -104,41 +106,45 @@ type Host {
|
|||
%attribute dictionary "notifications" {
|
||||
%attribute dictionary "*" {
|
||||
%attribute array "templates" {
|
||||
%attribute string "*"
|
||||
%attribute name(Notification) "*"
|
||||
},
|
||||
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute name(User) "*"
|
||||
},
|
||||
%attribute array "groups" {
|
||||
%attribute string "*"
|
||||
%attribute name(UserGroup) "*"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/* service attributes */
|
||||
%attribute number "max_check_attempts",
|
||||
%attribute string "check_period",
|
||||
%attribute name(TimePeriod) "check_period",
|
||||
%attribute number "check_interval",
|
||||
%attribute number "retry_interval",
|
||||
|
||||
%attribute number "notification_interval",
|
||||
%attribute string "notification_period",
|
||||
%attribute name(TimePeriod) "notification_period",
|
||||
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "servicegroups" {
|
||||
%attribute string "*"
|
||||
%attribute name(ServiceGroup) "*"
|
||||
},
|
||||
%attribute array "checkers" {
|
||||
%attribute string "*"
|
||||
|
@ -158,7 +164,9 @@ type IcingaApplication {
|
|||
%attribute string "service",
|
||||
%attribute string "pid_path",
|
||||
%attribute string "state_path",
|
||||
%attribute dictionary "macros"
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
}
|
||||
}
|
||||
|
||||
type Service {
|
||||
|
@ -172,34 +180,36 @@ type Service {
|
|||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "check_command" {
|
||||
%attribute string "*"
|
||||
},
|
||||
%attribute string "check_command",
|
||||
%attribute number "max_check_attempts",
|
||||
%attribute string "check_period",
|
||||
%attribute name(TimePeriod) "check_period",
|
||||
%attribute number "check_interval",
|
||||
%attribute number "retry_interval",
|
||||
|
||||
%attribute number "notification_interval",
|
||||
%attribute string "notification_period",
|
||||
%attribute name(TimePeriod) "notification_period",
|
||||
|
||||
%attribute array "hostdependencies" {
|
||||
%attribute string "*"
|
||||
%attribute name(Host) "*"
|
||||
},
|
||||
%attribute array "servicedependencies" {
|
||||
%attribute dictionary "*" {
|
||||
%require "host",
|
||||
%attribute string "host",
|
||||
%attribute name(Host) "host",
|
||||
|
||||
%require "service",
|
||||
%attribute string "service"
|
||||
}
|
||||
},
|
||||
%attribute array "servicegroups" {
|
||||
%attribute string "*"
|
||||
%attribute name(ServiceGroup) "*"
|
||||
},
|
||||
%attribute array "checkers" {
|
||||
%attribute string "*"
|
||||
|
@ -214,20 +224,22 @@ type Service {
|
|||
%attribute dictionary "notifications" {
|
||||
%attribute dictionary "*" {
|
||||
%attribute array "templates" {
|
||||
%attribute string "*"
|
||||
%attribute name(Notification) "*"
|
||||
},
|
||||
|
||||
%attribute dictionary "macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute name(User) "*"
|
||||
},
|
||||
%attribute array "groups" {
|
||||
%attribute string "*"
|
||||
%attribute name(UserGroup) "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,13 +266,15 @@ type Notification {
|
|||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "export_macros",
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute array "export_macros" {
|
||||
%attribute string "*"
|
||||
},
|
||||
|
||||
%attribute array "users" {
|
||||
%attribute name(User) "*"
|
||||
},
|
||||
%attribute array "groups" {
|
||||
%attribute string "*"
|
||||
%attribute name(UserGroup) "*"
|
||||
},
|
||||
|
||||
%attribute array "notification_command" {
|
||||
|
@ -269,7 +283,7 @@ type Notification {
|
|||
%attribute string "notification_command",
|
||||
|
||||
%attribute number "notification_interval",
|
||||
%attribute string "notification_period"
|
||||
%attribute name(TimePeriod) "notification_period"
|
||||
}
|
||||
|
||||
type User {
|
||||
|
@ -280,7 +294,7 @@ type User {
|
|||
},
|
||||
|
||||
%attribute array "groups" {
|
||||
%attribute string "*"
|
||||
%attribute name(UserGroup) "*"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue