Skip to content

Commit

Permalink
Fixed modules_presence bundle for Windows agents
Browse files Browse the repository at this point in the history
With findfiles returning proper back-slashed paths this policy was broken due to _vendored_dir and _override_dir being used with mixed slashed path and used as a replacement string.

Ticket: ENT-11959
Changelog: none
  • Loading branch information
craigcomstock committed Jul 9, 2024
1 parent 2ec8181 commit aa4d04b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cfe_internal/update/update_policy.cf
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,15 @@ bundle agent modules_presence
# be updated in $(sys.workdir)/modules, including any sub-directories.
{
vars:
"_vendored_dir" string => "$(this.promise_dirname)/../../modules/packages/vendored/";
"_override_dir" string => "$(this.promise_dirname)/../../modules/packages/";
"_custom_template_dir" string => "$(this.promise_dirname)/../../modules/mustache/";
"_vendored_dir" string => "$(this.promise_dirname)$(const.dirsep)..$(const.dirsep)..$(const.dirsep)modules$(const.dirsep)packages$(const.dirsep)vendored$(const.dirsep)";
"_override_dir" string => "$(this.promise_dirname)$(const.dirsep)..$(const.dirsep)..$(const.dirsep)modules$(const.dirsep)packages$(const.dirsep)";
"_custom_template_dir" string => "$(this.promise_dirname)$(const.dirsep)..$(const.dirsep)..$(const.dirsep)modules$(const.dirsep)mustache$(const.dirsep)";
"_vendored_paths" slist => findfiles("$(_vendored_dir)*.mustache");
"_custom_template_paths" slist => findfiles("$(_custom_template_dir)*.mustache"), if => isdir( "$(_custom_template_dir)" );
"_package_paths" slist => filter("$(_override_dir)vendored", _package_paths_tmp, "false", "true", 999);

windows::
"_package_paths_tmp" slist => findfiles("\Q$(_override_dir)\E*");
"_package_paths_tmp" slist => findfiles("$(_override_dir)*");
"_vendored_modules" slist => maplist(regex_replace("$(this)", "\Q$(_vendored_dir)\E(.*).mustache", "$1", "g"), @(_vendored_paths));
"_override_modules" slist => maplist(regex_replace("$(this)", "\Q$(_override_dir)\E(.*)", "$1", "g"), @(_package_paths));
# replace single backslashes in a windows path with double-backslashes
Expand Down

0 comments on commit aa4d04b

Please sign in to comment.