Skip to content

Commit b804bb2

Browse files
authored
Merge pull request #3140 from olehermanse/format
Ran cfengine format on some subfolders of MPF
2 parents 46c3c07 + 0cf6471 commit b804bb2

7 files changed

Lines changed: 81 additions & 94 deletions

File tree

services/autorun/hello.cf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bundle agent hello_world_autorun
22
{
33
meta:
4-
"tags" slist => { "autorun" };
4+
"tags" slist => { "autorun" };
55

66
reports:
77
verbose_mode::

services/init.cf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# This is loaded very early, only use hard classes or classes from def.json here.
99
#
1010
###############################################################################
11-
1211
# For example:
1312
# promise agent git
1413
# {

services/main.cf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
# - User/Site policy entry
55
#
66
###############################################################################
7-
87
bundle agent mpf_main
98
# User Defined Service Catalogue
109
{
1110
methods:
12-
# Activate your custom policies here
13-
11+
# Activate your custom policies here
1412
}

tests/acceptance/promises/autorun-D.cf

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,35 @@
33
# Test autorun
44
#
55
#######################################################
6-
76
body common control
87
{
9-
inputs => { '../default.cf.sub' };
10-
bundlesequence => { default("$(this.promise_filename)") };
11-
version => "1.0";
8+
inputs => { '../default.cf.sub' };
9+
bundlesequence => { default("$(this.promise_filename)") };
10+
version => "1.0";
1211
}
1312

1413
bundle agent init
1514
{
1615
commands:
17-
"$(G.make) install DESTDIR=$(G.testdir)"
18-
contain => in_dir_shell("$(this.promise_dirname)/../../..");
16+
"$(G.make) install DESTDIR=$(G.testdir)"
17+
contain => in_dir_shell("$(this.promise_dirname)/../../..");
18+
1919
vars:
20-
# If masterfiles are installed with --prefix=/other/prefix then we
21-
# need to figure out where did "make install DESTDIR=..." has put
22-
# the files.
23-
"promises_cf_slist" slist =>
24-
findfiles("$(G.testdir)/**/promises.cf");
25-
"promises_cf_path" string => nth(promises_cf_slist, 0);
20+
# If masterfiles are installed with --prefix=/other/prefix then we
21+
# need to figure out where did "make install DESTDIR=..." has put
22+
# the files.
23+
"promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf");
24+
"promises_cf_path" string => nth(promises_cf_slist, 0);
2625
}
27-
2826
#######################################################
29-
3027
bundle agent check
3128
{
3229
methods:
33-
"" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
34-
"",
35-
"$(sys.cf_agent) -Dservices_autorun -v -f $(init.promises_cf_path) | $(G.grep) Hello",
36-
$(this.promise_filename));
30+
""
31+
usebundle => dcs_passif_output(
32+
".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
33+
"",
34+
"$(sys.cf_agent) -Dservices_autorun -v -f $(init.promises_cf_path) | $(G.grep) Hello",
35+
$(this.promise_filename)
36+
);
3737
}

tests/acceptance/promises/autorun-def_json.cf

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,55 @@
33
# Test autorun
44
#
55
#######################################################
6-
76
body common control
87
{
9-
inputs => { '../default.cf.sub' };
10-
bundlesequence => { default("$(this.promise_filename)") };
11-
version => "1.0";
8+
inputs => { '../default.cf.sub' };
9+
bundlesequence => { default("$(this.promise_filename)") };
10+
version => "1.0";
1211
}
1312

1413
bundle agent init
1514
{
1615
commands:
17-
"$(G.make) install DESTDIR=$(G.testdir)"
18-
contain => in_dir_shell("$(this.promise_dirname)/../../..");
19-
vars:
20-
# If masterfiles are installed with --prefix=/other/prefix then we
21-
# need to figure out where did "make install DESTDIR=..." has put
22-
# the files.
23-
"promises_cf_slist" slist =>
24-
findfiles("$(G.testdir)/**/promises.cf");
25-
"promises_cf_path" string => nth(promises_cf_slist, 0);
16+
"$(G.make) install DESTDIR=$(G.testdir)"
17+
contain => in_dir_shell("$(this.promise_dirname)/../../..");
2618

27-
"masterfiles_path" string => dirname("$(promises_cf_path)");
28-
"def_json_path" string => concat("$(masterfiles_path)", "/def.json");
19+
vars:
20+
# If masterfiles are installed with --prefix=/other/prefix then we
21+
# need to figure out where did "make install DESTDIR=..." has put
22+
# the files.
23+
"promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf");
24+
"promises_cf_path" string => nth(promises_cf_slist, 0);
25+
"masterfiles_path" string => dirname("$(promises_cf_path)");
26+
"def_json_path" string => concat("$(masterfiles_path)", "/def.json");
2927
}
3028

3129
bundle agent test
3230
{
3331
meta:
34-
"description" string => "Test that def.json can enable autorun as expected.";
35-
32+
"description"
33+
string => "Test that def.json can enable autorun as expected.";
3634
# We need to lay down the def.json that will enable autorun.
3735
files:
38-
"$(init.def_json_path)"
39-
create => "true",
40-
edit_line => enable_autorun;
36+
"$(init.def_json_path)"
37+
create => "true",
38+
edit_line => enable_autorun;
4139
}
4240

4341
bundle edit_line enable_autorun
4442
{
4543
insert_lines:
46-
'{ "classes": { "services_autorun": ["any"] } }';
44+
'{ "classes": { "services_autorun": ["any"] } }';
4745
}
48-
4946
#######################################################
50-
5147
bundle agent check
5248
{
5349
methods:
54-
"" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
55-
"",
56-
"$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello",
57-
$(this.promise_filename));
50+
""
51+
usebundle => dcs_passif_output(
52+
".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
53+
"",
54+
"$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello",
55+
$(this.promise_filename)
56+
);
5857
}

tests/acceptance/promises/autorun.cf

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,34 @@
33
# Test autorun
44
#
55
#######################################################
6-
76
body common control
87
{
9-
inputs => { '../default.cf.sub' };
10-
bundlesequence => { default("$(this.promise_filename)") };
11-
version => "1.0";
8+
inputs => { '../default.cf.sub' };
9+
bundlesequence => { default("$(this.promise_filename)") };
10+
version => "1.0";
1211
}
1312

1413
bundle agent init
1514
{
1615
commands:
17-
"$(G.make) install DESTDIR=$(G.testdir)"
18-
contain => in_dir_shell("$(this.promise_dirname)/../../..");
19-
vars:
20-
# If masterfiles are installed with --prefix=/other/prefix then we
21-
# need to figure out where did "make install DESTDIR=..." has put
22-
# the files.
23-
"promises_cf_slist" slist =>
24-
findfiles("$(G.testdir)/**/promises.cf");
25-
"promises_cf_path" string => nth(promises_cf_slist, 0);
16+
"$(G.make) install DESTDIR=$(G.testdir)"
17+
contain => in_dir_shell("$(this.promise_dirname)/../../..");
2618

27-
"masterfiles_path" string => dirname("$(promises_cf_path)");
28-
"def_cf_path" string => concat("$(masterfiles_path)", "/controls/def.cf");
19+
vars:
20+
# If masterfiles are installed with --prefix=/other/prefix then we
21+
# need to figure out where did "make install DESTDIR=..." has put
22+
# the files.
23+
"promises_cf_slist" slist => findfiles("$(G.testdir)/**/promises.cf");
24+
"promises_cf_path" string => nth(promises_cf_slist, 0);
25+
"masterfiles_path" string => dirname("$(promises_cf_path)");
26+
"def_cf_path" string => concat("$(masterfiles_path)", "/controls/def.cf");
2927
}
3028

3129
bundle agent test
3230
{
3331
meta:
34-
35-
36-
"description"
37-
string => "Test that enabling autorun from policy is not sufficient for activation.
32+
"description"
33+
string => "Test that enabling autorun from policy is not sufficient for activation.
3834

3935
In order to prevent the parsing of files unnecessarily we guard that with the
4036
definition of the services_autorun class. If that class is defined from
@@ -44,27 +40,28 @@ behavior to change so that defining from policy worked as desired. This
4440
test is intended to track that specific case and if ever fixed, simply
4541
update this test to allow it to pass.";
4642

47-
"test_soft_fail"
48-
string => "any",
49-
meta => { "redmine7572", "jiraCFE2135"};
43+
"test_soft_fail"
44+
string => "any",
45+
meta => { "redmine7572", "jiraCFE2135" };
5046

5147
files:
52-
"$(init.def_cf_path)" edit_line => enable_autorun;
48+
"$(init.def_cf_path)" edit_line => enable_autorun;
5349
}
5450

5551
bundle edit_line enable_autorun
5652
{
5753
insert_lines:
58-
'bundle common __autorun_enable { classes: "services_autorun" expression => "any"; }';
54+
'bundle common __autorun_enable { classes: "services_autorun" expression => "any"; }';
5955
}
60-
6156
#######################################################
62-
6357
bundle agent check
6458
{
6559
methods:
66-
"" usebundle => dcs_passif_output(".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
67-
"",
68-
"$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello",
69-
$(this.promise_filename));
60+
""
61+
usebundle => dcs_passif_output(
62+
".*R: hello_world_autorun: Hello, this is an automatically loaded bundle.*",
63+
"",
64+
"$(sys.cf_agent) -v -f $(init.promises_cf_path) | $(G.grep) Hello",
65+
$(this.promise_filename)
66+
);
7067
}

tests/acceptance/promises/promises.cf

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,38 @@
33
# Test promises.cf
44
#
55
#######################################################
6-
76
body common control
87
{
9-
inputs => { '../default.cf.sub' };
10-
bundlesequence => { default("$(this.promise_filename)") };
11-
version => "1.0";
8+
inputs => { '../default.cf.sub' };
9+
bundlesequence => { default("$(this.promise_filename)") };
10+
version => "1.0";
1211
}
13-
1412
#######################################################
15-
1613
bundle agent init
1714
{
1815
}
19-
2016
#######################################################
21-
2217
bundle agent test
2318
{
2419
vars:
25-
"rundir" string => dirname($(this.promise_filename));
20+
"rundir" string => dirname($(this.promise_filename));
2621

2722
commands:
28-
"$(sys.cf_promises) -c --eval-functions -f $(this.promise_dirname)/../../../promises.cf"
29-
classes => if_ok("agent_worked_all_right");
23+
"$(sys.cf_promises) -c --eval-functions -f $(this.promise_dirname)/../../../promises.cf"
24+
classes => if_ok("agent_worked_all_right");
3025
}
31-
3226
#######################################################
33-
3427
bundle agent check
3528
{
3629
classes:
37-
"ok" and => { "agent_worked_all_right" };
30+
"ok" and => { "agent_worked_all_right" };
3831

3932
reports:
4033
DEBUG::
4134

4235
ok::
4336
"$(this.promise_filename) Pass";
37+
4438
!ok::
4539
"$(this.promise_filename) FAIL";
4640
}

0 commit comments

Comments
 (0)