Actions
Bug #14692
closedRudder agent check does not repair policies if they are broken
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Fix check:
Regression:
Description
I volontarly corrupted policies and ran rudder agent check
Output is
# rudder agent check WARNING: No disable file detected and no agent executor process either. Restarting agent service...ok: stop service rudder-agent succeeded ok: start service rudder-agent succeeded Done /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: syntax error iii ^ /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: Expected 'bundle' or 'body' keyword, wrong input 'iii' iii ^ error: There are syntax errors in policy files ok: Rudder agent check ran without errors.
cf-promises does return exit code 1, but
# /var/rudder/cfengine-community/bin/cf-promises | grep error /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: syntax error iii ^ /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: Expected 'bundle' or 'body' keyword, wrong input 'iii' iii ^ error: There are syntax errors in policy files root@agent1:/home/vagrant# echo $? 1
errors are now in stderr rather than in stdout, so grep fails (but we could get exit code)
we could also use stderr in
# /var/rudder/cfengine-community/bin/cf-promises 2>&1 | grep error /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: syntax error /var/rudder/cfengine-community/inputs/promises.cf:18:4: error: Expected 'bundle' or 'body' keyword, wrong input 'iii' error: There are syntax errors in policy files root@agent1:/home/vagrant# echo $? 0
Actions