@@ -7,10 +7,12 @@ include 'quattor/types/component';
7
7
}
8
8
function structure_cron_log_valid = {
9
9
if (is_defined (SELF[' disabled' ]) && SELF[' disabled' ]) {
10
- if (is_defined (SELF[' name' ]) ||
10
+ if (
11
+ is_defined (SELF[' name' ]) ||
11
12
is_defined (SELF[' owner' ]) ||
12
- is_defined (SELF[' mode' ]) ) {
13
- error (' cron log file properties are present despite log file creation has been disabled.' );
13
+ is_defined (SELF[' mode' ])
14
+ ) {
15
+ error (' cron log file properties are present despite log file creation has been disabled.' );
14
16
};
15
17
};
16
18
true;
@@ -49,7 +51,7 @@ type structure_cron_log = {
49
51
}
50
52
function valid_cron_timing = {
51
53
if (ARGC ! = 4) {
52
- error (format ( ' %s: expected 4 parameters, received %d' , FUNCTION, ARGC) );
54
+ error (' %s: expected 4 parameters, received %d' , FUNCTION, ARGC);
53
55
};
54
56
55
57
timing_value = to_lowercase (ARGV[0]);
@@ -58,18 +60,18 @@ function valid_cron_timing = {
58
60
text_regex = ARGV[3];
59
61
60
62
# Check that the field contains only valid characters
61
- if (! match (timing_value, ' ^(?:[a-z0-9/*\-,]+)$' )) error (format ( ' "%s" contains invalid characters' , timing_value) );
63
+ if (! match (timing_value, ' ^(?:[a-z0-9/*\-,]+)$' )) error (' "%s" contains invalid characters' , timing_value);
62
64
63
65
# Find runs of digits and validate them against provided bounds
64
66
foreach (k; v; matches (timing_value, ' ([0-9]+)' )) {
65
67
i = to_long (v);
66
- if (i < lower_bound) error (format ( ' Value %d is below lower bound of %d' , i, lower_bound) );
67
- if (i > upper_bound) error (format ( ' Value %d is above upper bound of %d' , i, upper_bound) );
68
+ if (i < lower_bound) error (' Value %d is below lower bound of %d' , i, lower_bound);
69
+ if (i > upper_bound) error (' Value %d is above upper bound of %d' , i, upper_bound);
68
70
};
69
71
70
72
# Find runs of letters and validate them against provided regex
71
73
foreach (k; v; matches (timing_value, ' ([a-z]+)' )) {
72
- if (! match (v, text_regex)) error (format ( ' "%s" is not a valid value for this field item' , v) );
74
+ if (! match (v, text_regex)) error (' "%s" is not a valid value for this field item' , v);
73
75
};
74
76
75
77
# Ignore all other characters
@@ -119,7 +121,7 @@ type structure_cron_timing = {
119
121
}
120
122
function valid_cron_frequency = {
121
123
if (ARGC ! = 1) {
122
- error (format ( ' %s: expected 1 parameter, received %d' , FUNCTION, ARGC) );
124
+ error (' %s: expected 1 parameter, received %d' , FUNCTION, ARGC);
123
125
};
124
126
125
127
frequency = ARGV[0];
@@ -131,7 +133,7 @@ function valid_cron_frequency = {
131
133
fields = split (' ' , frequency);
132
134
133
135
if (length (fields) ! = 5) {
134
- error (format ( ' cron frequency "%s" should have 5 fields, it only has %d' , frequency, length (fields) ));
136
+ error (' cron frequency "%s" should have 5 fields, it only has %d' , frequency, length (fields));
135
137
};
136
138
137
139
match (fields[0], ' ^AUTO$' ) || valid_cron_minute(fields[0]);
@@ -194,7 +196,7 @@ type structure_cron = {
194
196
195
197
function no_duplicate_cron_entries = {
196
198
if (ARGC ! = 1) {
197
- error (format ( ' %s: expected 1 parameter, received %d' , FUNCTION, ARGC) );
199
+ error (' %s: expected 1 parameter, received %d' , FUNCTION, ARGC);
198
200
};
199
201
200
202
names = dict ();
0 commit comments