File tree Expand file tree Collapse file tree 1 file changed +85
-0
lines changed
tests/acceptance/10_files/unsafe Expand file tree Collapse file tree 1 file changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ ##############################################################################
2
+ #
3
+ # Test that agent can override the immutable bit when using perms attribute
4
+ #
5
+ ##############################################################################
6
+
7
+ body common control
8
+ {
9
+ inputs => { "../../default.cf.sub" };
10
+ bundlesequence => { default("$(this.promise_filename)") };
11
+ version => "1.0";
12
+ }
13
+
14
+ bundle agent global
15
+ {
16
+ vars:
17
+ "testfile"
18
+ string => "/tmp/07_immutable.txt";
19
+ }
20
+
21
+ body fsattrs set_immutable
22
+ {
23
+ immutable => "true";
24
+ }
25
+
26
+ bundle agent init
27
+ {
28
+ files:
29
+ "$(global.testfile)"
30
+ create => "true",
31
+ perms => m("600");
32
+
33
+ commands:
34
+ "chattr +i $(global.testfile)"
35
+ contain => in_shell;
36
+ }
37
+
38
+ bundle agent test
39
+ {
40
+ meta:
41
+ "description" -> { "CFE-1840", "ENT-10961" }
42
+ string => "Test that agent can override the immutable bit on a file while using the perms attribute";
43
+
44
+ "test_skip_unsupported"
45
+ string => "hpux|aix|solaris|windows";
46
+
47
+ files:
48
+ "$(global.testfile)"
49
+ fsattrs => set_immutable,
50
+ perms => m("644");
51
+ }
52
+
53
+ bundle agent check
54
+ {
55
+ vars:
56
+ "expected"
57
+ string => "644";
58
+ "actual"
59
+ string => string_tail(filestat("$(global.testfile)", "modeoct"), "3");
60
+
61
+ classes:
62
+ "ok"
63
+ expression => strcmp("$(actual)", "$(expected)");
64
+
65
+ reports:
66
+ ok::
67
+ "$(this.promise_filename) Pass";
68
+ !ok::
69
+ "$(this.promise_filename) FAIL";
70
+ any::
71
+ "Expected: '$(expected)', actual: '$(actual)'";
72
+ }
73
+
74
+ bundle agent destroy
75
+ {
76
+ commands:
77
+ "chattr -i $(global.testfile)"
78
+ contain => in_shell,
79
+ handle => "is mutable";
80
+
81
+ files:
82
+ "$(global.testfile)"
83
+ delete => tidy,
84
+ depends_on => { "is mutable" };
85
+ }
You can’t perform that action at this time.
0 commit comments