Open
Conversation
…iles without extension This commit improves the SN file reading functionality in install.sh: 1. Added read_sn_from_file() function that supports: - Plain text files (.txt) - JSON format files (.json) - YAML format files (.yaml, .yml) - Key-value pair format - Files without extension 2. Enhanced file validation logic: - Support files without extension (e.g., "sn", "info") - For files without extension: if sn_field is provided, try structured formats first, fallback to plain text if not provided - For files with extension: validate extension is in allowed list (.txt, .json, .yaml, .yml) 3. Improved field matching behavior: - If sn_field is provided, must match successfully in the file, otherwise return error - If sn_field is not provided, treat file as plain text - This ensures data integrity and prevents silent failures 4. Error handling improvements: - Better error messages when field is not found - Handles cases where jq/yq tools are not available (fallback to grep/sed) - Proper handling of grep failures in set -e mode 5. Code improvements: - All comments and log messages in English - Better code organization and readability - Consistent error handling The changes ensure that: - Files with extension + sn_field: must match, error if not found - Files without extension + sn_field: must match, error if not found - Files without extension + no sn_field: treat as plain text - .txt files: always treat as plain text (sn_field optional)
- Remove automatic REMOVE_CONFIG flag setting (uninstall.sh already handles config cleanup) - Save SN value to SERIAL_NUM when using --sn_file (for manual --remove_config support) - Add API response content logging for better debugging - Improve error handling and logging throughout SN validation process
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.
No description provided.