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
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,14 @@ bundle agent check
vars:
"inst" string => "$(sys.workdir)/state/software_packages.csv";
"inst_expr" string => "^($(p.name[1])|$(p.name[2])|$(p.name[3])),.*";
"inst_matches" int => countlinesmatching("$(inst_expr)", "$(inst)");
"inst_matches"
int => countlinesmatching("$(inst_expr)", "$(inst)"),
if => fileexists("$(inst)");
"upd" string => "$(sys.workdir)/state/software_patches_avail.csv";
"upd_expr" string => "^($(p.name[1])|$(p.name[2])|$(p.name[3])),.*";
"upd_matches" int => countlinesmatching("$(upd_expr)", "$(upd)");
"upd_matches"
int => countlinesmatching("$(upd_expr)", "$(upd)"),
if => fileexists("$(upd)");

classes:
# Should match all packages except the second one.
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/17_packages/packages-info.cf.sub
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ bundle agent clear_packages(key)

commands:
redhat|suse|sles::
"$(paths.path[rpm]) -e --allmatches $(p.name[$(p.packages)]) $(output_sink)"
# Only remove installed packages, rpm -e fails on missing ones
"! $(paths.path[rpm]) -q $(p.name[$(p.packages)]) > $(G.dev_null) 2>&1 || $(paths.path[rpm]) -e --allmatches $(p.name[$(p.packages)]) $(output_sink)"
contain => in_shell,
comment => $(key);
debian|sles::
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/30_custom_promise_types/20_depends_on.cf
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ bundle agent check
{
vars:
"expected" string => "CAEBD";
"found" string => readfile("$(G.testfile)");
"found"
string => readfile("$(G.testfile)"),
if => fileexists("$(G.testfile)");

classes:
"ok" expression => strcmp("$(expected)", "$(found)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ bundle agent check
{
vars:
"expected" string => "abcdef";
"found" string => readfile("$(G.testfile)");
"found"
string => readfile("$(G.testfile)"),
if => fileexists("$(G.testfile)");

classes:
"ok" expression => strcmp("$(expected)", "$(found)");
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/30_custom_promise_types/22_bodies.cf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ bundle agent check
"expected"
string => '{"example_body": {"alice": "1", "bob": "3", "charlie": "4"}}';

"found" string => readfile("$(G.testfile)");
"found"
string => readfile("$(G.testfile)"),
if => fileexists("$(G.testfile)");

classes:
"ok" expression => strcmp("$(expected)", "$(found)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ bundle agent check
{
vars:
"expected" string => "hello";
"found" string => readfile("$(G.testfile)");
"found"
string => readfile("$(G.testfile)"),
if => fileexists("$(G.testfile)");

classes:
"ok" expression => strcmp("$(expected)", "$(found)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ bundle agent test
"/tmp/dummyfile" smth => "hello";

vars:
"content" string => readfile("/tmp/dummyfile");
"content"
string => readfile("/tmp/dummyfile"),
if => fileexists("/tmp/dummyfile");

files:
"/tmp/dummyfile" content => "ok";

vars:
"content" string => readfile("/tmp/dummyfile");
"content"
string => readfile("/tmp/dummyfile"),
if => fileexists("/tmp/dummyfile");

classes:
"ok" expression => strcmp("$(content)", "ok");
Expand Down
Loading