Skip to content

CFE-4000: Added time based sys variables#5865

Merged
larsewi merged 2 commits into
cfengine:masterfrom
victormlg:sys_time_vars
Sep 9, 2025
Merged

CFE-4000: Added time based sys variables#5865
larsewi merged 2 commits into
cfengine:masterfrom
victormlg:sys_time_vars

Conversation

@victormlg

@victormlg victormlg commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

@victormlg victormlg requested review from jakub-nt and larsewi August 27, 2025 11:20

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you create an acceptance test using variablesmatching(). E.g., variablesmatching() on sys.time_based_dom should return a list of length 1 and the value should match ^Day[1-3][0-9]?$ Similarly classesmatching() should return list of length 1.

Comment thread libenv/time_classes.c Outdated
Comment thread libenv/time_classes.c Outdated
Comment thread tests/acceptance/01_vars/01_basic/time_based_vars.cf Outdated
Comment thread tests/acceptance/01_vars/01_basic/time_based_vars.cf Outdated
Comment thread tests/acceptance/01_vars/01_basic/time_based_vars.cf
@larsewi

larsewi commented Aug 29, 2025

Copy link
Copy Markdown
Contributor

Please rebase with upstream master, now that libntech module is updated.

@victormlg victormlg force-pushed the sys_time_vars branch 3 times, most recently from 5e2c5cc to 48b517b Compare August 29, 2025 12:20
@victormlg victormlg requested a review from larsewi August 29, 2025 14:01
@larsewi

larsewi commented Aug 29, 2025

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cfengine cfengine deleted a comment from cf-bottom Aug 29, 2025
@cfengine cfengine deleted a comment from cf-bottom Aug 29, 2025
@cf-bottom

Copy link
Copy Markdown

@larsewi larsewi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

19:10:11 scheduled-reports.c:686:35: error: initialization of ‘StringSet *’ from incompatible pointer type ‘StringMap *’ [-Wincompatible-pointer-types]
19:10:11   686 |         StringSet *time_classes = GetTimeClasses(time);
19:10:11       |                                   ^~~~~~~~~~~~~~

Looks like the GetTimeClasses() function is used in more places

@victormlg

Copy link
Copy Markdown
Contributor Author
19:10:11 scheduled-reports.c:686:35: error: initialization of ‘StringSet *’ from incompatible pointer type ‘StringMap *’ [-Wincompatible-pointer-types]
19:10:11   686 |         StringSet *time_classes = GetTimeClasses(time);
19:10:11       |                                   ^~~~~~~~~~~~~~

Looks like the GetTimeClasses() function is used in more places

Fix here https://github.com/cfengine/nova/pull/2448

@larsewi

larsewi commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

Build Status

@larsewi

larsewi commented Sep 3, 2025

Copy link
Copy Markdown
Contributor
1:11:00 scheduled-reports.c: In function ‘ScheduledReportsExecutor’:
11:11:00 scheduled-reports.c:709:35: error: initialization of ‘StringMap *’ from incompatible pointer type ‘StringSet *’ [-Wincompatible-pointer-types]
11:11:00   709 |         StringMap *time_classes = StringMapToStringSet(GetTimeClasses(time), false);
11:11:00       |                                   ^~~~~~~~~~~~~~~~~~~~
11:11:00 scheduled-reports.c:713:58: error: passing argument 1 of ‘StringSetToBuffer’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   713 |             Buffer *time_classes_buf = StringSetToBuffer(time_classes, ',');
11:11:00       |                                                          ^~~~~~~~~~~~
11:11:00       |                                                          |
11:11:00       |                                                          StringMap *
11:11:00 In file included from /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libpromises/eval_context.h:31,
11:11:00                  from scheduled-reports.c:5:
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:142:38: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00   142 | Buffer *StringSetToBuffer(StringSet *set, const char delimiter);
11:11:00       |                           ~~~~~~~~~~~^~~
11:11:00 scheduled-reports.c:730:30: error: passing argument 1 of ‘StringSetDestroy’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   730 |             StringSetDestroy(time_classes);
11:11:00       |                              ^~~~~~~~~~~~
11:11:00       |                              |
11:11:00       |                              StringMap *
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:70:42: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00    70 |     void Prefix##SetDestroy(Prefix##Set *set);                          \
11:11:00       |                                          ^
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:138:1: note: in expansion of macro ‘TYPED_SET_DECLARE’
11:11:00   138 | TYPED_SET_DECLARE(String, char *)
11:11:00       | ^~~~~~~~~~~~~~~~~
11:11:00 scheduled-reports.c:735:37: error: passing argument 1 of ‘ResetExecutedSchedules’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   735 |         if (!ResetExecutedSchedules(time_classes, conn))
11:11:00       |                                     ^~~~~~~~~~~~
11:11:00       |                                     |
11:11:00       |                                     StringMap *
11:11:00 scheduled-reports.c:69:16: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00    69 |     StringSet *time_classes, CFDB_Connection *conn)
11:11:00       |     ~~~~~~~~~~~^~~~~~~~~~~~
11:11:00 scheduled-reports.c:738:30: error: passing argument 1 of ‘StringSetDestroy’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   738 |             StringSetDestroy(time_classes);
11:11:00       |                              ^~~~~~~~~~~~
11:11:00       |                              |
11:11:00       |                              StringMap *
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:70:42: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00    70 |     void Prefix##SetDestroy(Prefix##Set *set);                          \
11:11:00       |                                          ^
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:138:1: note: in expansion of macro ‘TYPED_SET_DECLARE’
11:11:00   138 | TYPED_SET_DECLARE(String, char *)
11:11:00       | ^~~~~~~~~~~~~~~~~
11:11:00 scheduled-reports.c:744:44: error: passing argument 1 of ‘CFDB_QueryPendingSchedulesList’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   744 |             CFDB_QueryPendingSchedulesList(time_classes, conn);
11:11:00       |                                            ^~~~~~~~~~~~
11:11:00       |                                            |
11:11:00       |                                            StringMap *
11:11:00 scheduled-reports.c:127:16: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00   127 |     StringSet *time_classes, CFDB_Connection *conn)
11:11:00       |     ~~~~~~~~~~~^~~~~~~~~~~~
11:11:00 scheduled-reports.c:748:30: error: passing argument 1 of ‘StringSetDestroy’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   748 |             StringSetDestroy(time_classes);
11:11:00       |                              ^~~~~~~~~~~~
11:11:00       |                              |
11:11:00       |                              StringMap *
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:70:42: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00    70 |     void Prefix##SetDestroy(Prefix##Set *set);                          \
11:11:00       |                                          ^
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:138:1: note: in expansion of macro ‘TYPED_SET_DECLARE’
11:11:00   138 | TYPED_SET_DECLARE(String, char *)
11:11:00       | ^~~~~~~~~~~~~~~~~
11:11:00 scheduled-reports.c:757:26: error: passing argument 1 of ‘StringSetDestroy’ from incompatible pointer type [-Wincompatible-pointer-types]
11:11:00   757 |         StringSetDestroy(time_classes);
11:11:00       |                          ^~~~~~~~~~~~
11:11:00       |                          |
11:11:00       |                          StringMap *
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:70:42: note: expected ‘StringSet *’ but argument is of type ‘StringMap *’
11:11:00    70 |     void Prefix##SetDestroy(Prefix##Set *set);                          \
11:11:00       |                                          ^
11:11:00 /home/jenkins/workspace/testing-pr/label/PACKAGES_HUB_arm_64_linux_ubuntu_24/nova/../core/libntech/libutils/set.h:138:1: note: in expansion of macro ‘TYPED_SET_DECLARE’
11:11:00   138 | TYPED_SET_DECLARE(String, char *)
11:11:00       | ^~~~~~~~~~~~~~~~~
11:11:00 gmake[1]: *** [Makefile:680: scheduled-reports.o] Error 1

@larsewi

larsewi commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

Comment thread tests/unit/eval_context_test.c Outdated
Ticket: CFE-4000
Signed-off-by: Victor Moene <victor.moene@northern.tech>
Signed-off-by: Victor Moene <victor.moene@northern.tech>
@larsewi larsewi merged commit d9d2a28 into cfengine:master Sep 9, 2025
12 checks passed
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.

3 participants