Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cf-agent/verify_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ static PromiseResult VerifyFilePromise(EvalContext *ctx, char *path, const Promi

PromiseResult render_result = WriteContentFromString(ctx, path, &a, pp);
result = PromiseResultUpdate(result, render_result);

goto exit;
}

/* Phase 3b - content editing */
Expand Down
72 changes: 72 additions & 0 deletions tests/acceptance/10_files/01_create/013.cf
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#######################################################
#
# Create a file with content attribute and owner via perms,
# but witout create attribute, check owner
#
#######################################################

body common control
{
inputs => { "../../default.cf.sub" };
bundlesequence => { default("$(this.promise_filename)") };
version => "1.0";
}

#######################################################

bundle agent init
{
files:
"$(G.testfile)"
delete => init_delete;
}

body delete init_delete
{
dirlinks => "delete";
rmdirs => "true";
}

#######################################################

bundle agent test
{
vars:
"owner" string => "sys";

files:
"$(G.testfile)"
content => "",
perms => test_perms($(owner));
}

body perms test_perms(o)
{
rxdirs => "false";
mode => "644";
owners => { "$(o)" };
groups => { "0" };
}

#######################################################

bundle agent check
{
vars:
"ui" data => getuserinfo(filestat($(G.testfile), "uid"));

classes:
"not_ok" not => strcmp($(test.owner), $(ui[username]));

reports:
DEBUG::
"expected: username = '$(test.owner)'";
"got: username = '$(ui[username])'";
!not_ok::
"$(this.promise_filename) Pass";
not_ok::
"$(this.promise_filename) FAIL";
}

### PROJECT_ID: core
### CATEGORY_ID: 27
Loading