-
Notifications
You must be signed in to change notification settings - Fork 102
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
ENT-11959: Fixed modules_presence bundle for Windows agents #2923
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -860,6 +861,8 @@ bundle agent modules_presence | |
|
||
reports: | ||
DEBUG:: | ||
"_override_dir: $(_override_dir)"; | ||
"_package_paths_tmp: $(with)" with => storejson(_package_paths_tmp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added |
||
"_not_vendored_modules_pathname_regex: $(_not_vendored_modules_pathname_regex)"; | ||
"_vendored_modules: $(_vendored_modules)"; | ||
"_override_modules: $(_override_modules)"; | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the treatment as literal string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, because this.promise_dirname on windows contains backslashes. SO this change switches to using only backslashes on windows. but what were we protecting against with \Q \E?. findfiles() is glob, but \Q\E is pcre right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because findfiles doesn't work with those in there.
If I leave these out I get
If I leave them in I get
I guess that new findfiles() handles windows paths with back-slashes in a different way which "just works" now?
Maybe because it uses true/fixed globbing where before it used PCRE?
@larsewi would know for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notice the acceptance tests for findfiles on windows...
https://github.com/cfengine/core/blob/305ea57c670a49ec6e8025c89359e9cc093d4e93/tests/acceptance/01_vars/02_functions/findfiles.cf#L87-L96
All back-slashes