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

Conversation

victormlg
Copy link
Contributor

No description provided.

@victormlg victormlg requested a review from olehermanse January 15, 2025 14:46
@CLAassistant
Copy link

CLAassistant commented Jan 15, 2025

CLA assistant check
All committers have signed the CLA.

Ticket: ENT-10078
Signed-off-by: Victor Moene <[email protected]>
Changelog: Introduced a new variable default:sys.cf_edition that keeps track whether cfengine is community or enterprise.
@victormlg victormlg force-pushed the ENT-10078-add-cfedition-variable branch from e4f055d to 81a56e8 Compare January 15, 2025 15:16
@olehermanse
Copy link
Member

@cf-bottom jenkins, please

@cf-bottom
Copy link

Copy link
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

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

Well done 🚀

@olehermanse
Copy link
Member

@cf-bottom try jenkins again, please :)

@cf-bottom
Copy link

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");

@olehermanse olehermanse merged commit 8bf3d06 into cfengine:master Jan 16, 2025
39 checks passed
@victormlg victormlg deleted the ENT-10078-add-cfedition-variable branch January 29, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants