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
18 changes: 15 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 @@ -730,6 +731,10 @@ static bool LoadAugmentsData(EvalContext *ctx, const char *filename, const JsonE
EvalContextClassPutSoft(ctx, ckey, CONTEXT_SCOPE_NAMESPACE, default_tags);
}
}
else if (StringEqual(check, "true"))
{
EvalContextClassPutSoft(ctx, ckey, CONTEXT_SCOPE_NAMESPACE, default_tags);
}
free(check);
}
else if (JsonGetElementType(data) == JSON_ELEMENT_TYPE_CONTAINER &&
Expand All @@ -753,6 +758,10 @@ static bool LoadAugmentsData(EvalContext *ctx, const char *filename, const JsonE
free(check);
break;
}
else if (StringEqual(check, "true"))
{
EvalContextClassPutSoft(ctx, ckey, CONTEXT_SCOPE_NAMESPACE, default_tags);
}

free(check);
}
Expand Down Expand Up @@ -790,6 +799,11 @@ static bool LoadAugmentsData(EvalContext *ctx, const char *filename, const JsonE
installed = EvalContextClassPutSoftTagsSetWithComment(ctx, ckey, CONTEXT_SCOPE_NAMESPACE,
tags, comment);
}
else if (StringEqual(check, "true"))
{
installed = EvalContextClassPutSoftTagsSetWithComment(ctx, ckey, CONTEXT_SCOPE_NAMESPACE,
tags, comment);
}
free(check);
break;
}
Expand Down Expand Up @@ -1590,8 +1604,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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hard class is already defined in DetectEnvironment so It feels redundant to define in generic_agent.c as well. Also sysinfo.c is where most hard class and special vars are defined already

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant please explain why this is redundant in the commit message for the sake of the commit history.


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

const Class *enterprise_edition = EvalContextClassGet(ctx, "default", "enterprise_edition");
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