Skip to content

Commit 7b0a3fe

Browse files
authored
Merge pull request #5848 from larsewi/skipping
CFE-4569: Fixed bug where files content promises skips remaining promises
2 parents 8d9d357 + 313724e commit 7b0a3fe

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

cf-agent/verify_files.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,6 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi
619619

620620
PromiseResult render_result = WriteContentFromString(ctx, path, &a, pp);
621621
result = PromiseResultUpdate(result, render_result);
622-
623-
goto exit;
624622
}
625623

626624
/* Phase 3b - content editing */
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
##############################################################################
2+
#
3+
# Test that fsattrs validation is not skipped when combining it with the
4+
# content attribute (see CFE-4569).
5+
#
6+
##############################################################################
7+
8+
body common control
9+
{
10+
inputs => { "../../default.cf.sub" };
11+
bundlesequence => { default("$(this.promise_filename)") };
12+
version => "1.0";
13+
}
14+
15+
bundle agent global
16+
{
17+
vars:
18+
"testfile"
19+
string => "/tmp/13_immutable.txt";
20+
}
21+
22+
body fsattrs immutable(value)
23+
{
24+
immutable => "$(value)";
25+
}
26+
27+
bundle agent init
28+
{
29+
files:
30+
"$(global.testfile)"
31+
delete => tidy,
32+
depends_on => { "testfile is not immutable" };
33+
34+
commands:
35+
"chattr -i $(global.testfile)"
36+
contain => in_shell,
37+
if => fileexists("$(global.testfile)"),
38+
handle => "testfile is not immutable";
39+
}
40+
41+
bundle agent test
42+
{
43+
meta:
44+
"description" -> { "CFE-4569" }
45+
string => "Test that fsattrs validation is not skipped when combining it with the content attribute";
46+
47+
"test_skip_unsupported"
48+
string => "hpux|aix|solaris|windows";
49+
50+
files:
51+
"$(global.testfile)"
52+
content => "You can't touch this",
53+
fsattrs => immutable("true");
54+
}
55+
56+
bundle agent check
57+
{
58+
methods:
59+
"check"
60+
usebundle => dcs_passif_output(".*Immutable.*", "", "lsattr -l $(global.testfile)", "$(this.promise_filename)");
61+
}
62+
63+
bundle agent destroy
64+
{
65+
files:
66+
"$(global.testfile)"
67+
delete => tidy,
68+
depends_on => { "testfile is no longer immutable" };
69+
70+
commands:
71+
"chattr -i $(global.testfile)"
72+
contain => in_shell,
73+
if => fileexists("$(global.testfile)"),
74+
handle => "testfile is no longer immutable";
75+
}

0 commit comments

Comments
 (0)