Project

General

Profile

Actions

Bug #11122

closed

File check exists generic method produces error when file does not exist

Added by Hamlyn Mootoo almost 7 years ago. Updated over 6 years ago.

Status:
Rejected
Priority:
N/A
Assignee:
-
Category:
Techniques
Target version:
-
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Priority:
52
Name check:
Fix check:
Regression:

Description

A directive created from a technique using the "File check exists" method created using the technique editor causes an error when the agent runs. this error is also reflected in the GUI.

I had intended to use the output condition of the "File check exists" method as input to decide whether another method should get executed, but even in this scenario, an error is generated. The subsequent method correctly does not get executed because the indicated file does not actually exist, but the generation of the error is not what I expected so it throws off the compliance percentage.

E| error test File check exists /etc/pam.d/passwo| Check if /etc/pam.d/password-auth exists could not be repaired
E| n/a test Sharedfile to node password-auth Sharedfile to node password-auth if any.file_check_exists__etc_pam_d_password_auth_kept was not applicable


Files

user_technique_in_editor.JPG (133 KB) user_technique_in_editor.JPG Hamlyn Mootoo, 2017-07-09 23:32
Actions #1

Updated by Benoît PECCATTE over 6 years ago

  • Status changed from New to Rejected

File check exists in the methods that check if the file exists and returns an error if not.
So this is the indented behaviour.
There is currently not "if" on generic methods. However there is a confition_from_command() generic methods that can do this based on a shell command (test -f for example)

Actions #2

Updated by Hamlyn Mootoo over 6 years ago

Thanks! That worked. I used the status from the Condition_from_command method, and separately tried the Command_execution_result, and they both worked as I wanted. The Condition_from_command method always seems to return "compliant", but the Command_execution_result had more descriptive output of what was going on.

Actions #3

Updated by Benoît PECCATTE over 6 years ago

Condition_from_command method returns compliant as long as the return code matches either true_codes or false_codes. If it doesn't match one of them, it should report an error. But never a repair.

Command_execution_result doesn't return true or false, but can return a repair, which is not the same in the interface.

Actions

Also available in: Atom PDF