Draft
Conversation
- Add script OS type detection based on shebang, syntax, and commands - Modify CreateFirstbootConfigMap to filter scripts by VM OS compatibility - Prevent Windows scripts from running on Linux VMs and vice versa - Add comprehensive unit tests for script detection logic - Log warnings when incompatible scripts are skipped This ensures Windows-specific scripts (e.g., .bat files) only run on Windows VMs and Linux scripts only run on Linux VMs, preventing migration failures when mixed VM types are selected. Co-authored-by: Roopak Parikh <roopakparikh@users.noreply.github.com>
- Define ScriptOSTypeWindows, ScriptOSTypeLinux, ScriptOSTypeUnknown - Replace hardcoded strings with constants throughout codebase - Update tests to use constants - Addresses goconst linter warnings Co-authored-by: Roopak Parikh <roopakparikh@users.noreply.github.com>
|
Cursor Agent can help with this pull request. Just |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this PR does / why we need it
This PR resolves goconst linter warnings by introducing constants for script OS types (
ScriptOSTypeWindows,ScriptOSTypeLinux,ScriptOSTypeUnknown).Additionally, it integrates script OS compatibility detection and validation logic. This ensures firstboot scripts are compatible with the target VM's OS, replacing incompatible ones with safe no-op scripts and adding relevant logging.
Which issue(s) this PR fixes
(optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged)fixes #
Special notes for your reviewer
The core changes, including the introduction of constants and the script OS compatibility logic, were cherry-picked from PR #1529 "Script OS compatibility" to address the reported linter errors and enhance script handling.
Testing done
please add testing details (logs, screenshots, etc.)