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
1 change: 1 addition & 0 deletions libenv/sysinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ static void BuiltinClasses(EvalContext *ctx)
char vbuff[CF_BUFSIZE];

EvalContextClassPutHard(ctx, "any", "source=agent"); /* This is a reserved word / wildcard */
EvalContextClassPutHard(ctx, "true", "source=agent");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ticket does not mention adding true as a hard class. I wonder if this can get some implications. It should be possible to map the JSON type true to the hard class any when parsing the augments, without adding a new hard class. Whether or not true should be a hard class or not, we can discuss with @olehermanse and @nickanderson .

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would be quite wary of introducing such a generic class. My concern woul d be people using it within a bundle as a bundle scoped class for some condition (like pass in tests) that all of the sudden is now always true.


snprintf(vbuff, CF_BUFSIZE, "cfengine_%s", CanonifyName(Version()));
CreateHardClassesFromCanonification(ctx, vbuff, "inventory,attribute_name=none,source=agent");
Expand Down
5 changes: 2 additions & 3 deletions libpromises/generic_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ static bool LoadAugmentsData(EvalContext *ctx, const char *filename, const JsonE
if (!(StringEqual(key, "vars") ||
StringEqual(key, "classes") ||
StringEqual(key, "inputs") ||
StringEqual(key, "augments")))
StringEqual(key, "augments") ||
StringEqual(key, "variables")))
{
Log(LOG_LEVEL_VERBOSE, "Unknown augments key '%s' in file '%s', skipping it",
key, filename);
Expand Down Expand Up @@ -1590,8 +1591,6 @@ void GenericAgentInitialize(EvalContext *ctx, GenericAgentConfig *config)
OpenLog(default_facility);
SetSyslogFacility(default_facility);

EvalContextClassPutHard(ctx, "any", "source=agent");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain why this is redundant in the commit message. It's not clear from looking at the diff.


GenericAgentAddEditionClasses(ctx); // May set "enterprise_edition" class

const Class *enterprise_edition = EvalContextClassGet(ctx, "default", "enterprise_edition");
Expand Down
4 changes: 0 additions & 4 deletions libpromises/logic_expressions.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ ExpressionValue EvalExpression(const Expression *expr,
{
return EXPRESSION_VALUE_ERROR;
}
else if (strcmp("true", name) == 0)
{
ret = EXPRESSION_VALUE_TRUE;
}
Comment on lines -253 to -256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Some explanation would be helpful :)

else if (strcmp("false", name) == 0)
{
ret = EXPRESSION_VALUE_FALSE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ bundle agent main
"augments_class_from_classexpression_not",
"augments_class_from_classexpression_or",
"augments_class_from_classexpression_complex",
"augments_class_from_true",
not("augments_class_from_false")
};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"augments_class_from_classexpression_and": [ "cfengine.cfengine_3::" ],
"augments_class_from_classexpression_not": [ "!MISSING::" ],
"augments_class_from_classexpression_or": [ "cfengine|cfengine_3::" ],
"augments_class_from_classexpression_complex": [ "(cfengine|cfengine_3).!MISSING::" ]
"augments_class_from_classexpression_complex": [ "(cfengine|cfengine_3).!MISSING::" ],
"augments_class_from_true": [ true ],
"augments_class_from_false": [ false ]
}
}
Loading