Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added default:sys.cf_edition variable #5679

Merged
Merged
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
12 changes: 11 additions & 1 deletion libpromises/generic_agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,17 @@ void GenericAgentInitialize(EvalContext *ctx, GenericAgentConfig *config)

EvalContextClassPutHard(ctx, "any", "source=agent");

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

const Class *enterprise_edition = EvalContextClassGet(ctx, "default", "enterprise_edition");
if (enterprise_edition == NULL)
{
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "community", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report");
Copy link
Member

Choose a reason for hiding this comment

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

I see we have one more tag which we typically use for things like this:

Suggested change
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "community", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report");
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "community", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report,source=agent");

source=agent means this is defined in the agent (in the C code), as opposed to being defined in the policy.

}
else
{
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "enterprise", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report");
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "enterprise", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report");
EvalContextVariablePutSpecial(ctx, SPECIAL_SCOPE_SYS, "cf_edition", "enterprise", CF_DATA_TYPE_STRING, "derived-from=enterprise_edition,report,source=agent");

}

/* Make sure the chroot for recording changes this process would normally
* make on the system is setup if that was requested. */
Expand Down
Loading