Skip to content

Commit ec20d0d

Browse files
authored
Merge pull request #1751 from jrha/indentation-cron
ncm-cron: Cleanup pan templates
2 parents d98b5e4 + 14da539 commit ec20d0d

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

ncm-cron/src/main/pan/components/cron/config.pan

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
${componentconfig}
22

33
'securitypath' ?= {
4-
if (exists('/system/archetype/os') &&
5-
value('/system/archetype/os') == 'solaris') {
4+
if (exists('/system/archetype/os') && value('/system/archetype/os') == 'solaris') {
65
'/etc/cron.d';
76
} else {
87
'/etc';

ncm-cron/src/main/pan/components/cron/schema.pan

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ include 'quattor/types/component';
77
}
88
function structure_cron_log_valid = {
99
if (is_defined(SELF['disabled']) && SELF['disabled']) {
10-
if (is_defined(SELF['name']) ||
10+
if (
11+
is_defined(SELF['name']) ||
1112
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.');
1416
};
1517
};
1618
true;
@@ -49,7 +51,7 @@ type structure_cron_log = {
4951
}
5052
function valid_cron_timing = {
5153
if (ARGC != 4) {
52-
error(format('%s: expected 4 parameters, received %d', FUNCTION, ARGC));
54+
error('%s: expected 4 parameters, received %d', FUNCTION, ARGC);
5355
};
5456

5557
timing_value = to_lowercase(ARGV[0]);
@@ -58,18 +60,18 @@ function valid_cron_timing = {
5860
text_regex = ARGV[3];
5961

6062
# 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);
6264

6365
# Find runs of digits and validate them against provided bounds
6466
foreach(k; v; matches(timing_value, '([0-9]+)')) {
6567
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);
6870
};
6971

7072
# Find runs of letters and validate them against provided regex
7173
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);
7375
};
7476

7577
# Ignore all other characters
@@ -119,7 +121,7 @@ type structure_cron_timing = {
119121
}
120122
function valid_cron_frequency = {
121123
if (ARGC != 1) {
122-
error(format('%s: expected 1 parameter, received %d', FUNCTION, ARGC));
124+
error('%s: expected 1 parameter, received %d', FUNCTION, ARGC);
123125
};
124126

125127
frequency = ARGV[0];
@@ -131,7 +133,7 @@ function valid_cron_frequency = {
131133
fields = split(' ', frequency);
132134

133135
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));
135137
};
136138

137139
match(fields[0], '^AUTO$') || valid_cron_minute(fields[0]);
@@ -194,7 +196,7 @@ type structure_cron = {
194196

195197
function no_duplicate_cron_entries = {
196198
if (ARGC != 1) {
197-
error(format('%s: expected 1 parameter, received %d', FUNCTION, ARGC));
199+
error('%s: expected 1 parameter, received %d', FUNCTION, ARGC);
198200
};
199201

200202
names = dict();

0 commit comments

Comments
 (0)