Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors environment/config handling and adds stronger preflight checks to the host-update and git-pull utilities, with a small README update to reflect behavior.
Changes:
- Add
.envloading and new/updated environment-variable validation inupdatehosts.pyandgitpull.py. - Add an
--update-gitpullmode and improvescperror handling/logging inupdatehosts.py. - Add source-repo accessibility checking and tweak destination path handling in
gitpull.py; update README text accordingly.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
updatehosts.py |
Adds .env loading, new required-env checks, and an --update-gitpull flow using scp. |
gitpull.py |
Adds .env loading, validates source repo with git ls-remote, adjusts origin/destination handling, and updates repo-cleanup behavior. |
README.md |
Updates behavior description regarding createdir behavior (but currently mismatched with actual CLI flag). |
Comments suppressed due to low confidence (1)
gitpull.py:302
target_path = Path(args.target_path).resolve()resolves~as a literal directory name (relative to CWD). This can cause the existence/creation check to operate on the wrong path, whiledestinationlater usesexpanduser(). Useexpanduser()beforeresolve()fortarget_pathso validation/creation anddestinationare consistent.
target_path = Path(args.target_path).resolve()
if not target_path.exists() or not target_path.is_dir():
if args.createdirs:
# Create the target directory if it doesn't exist
logger.info(f"Creating target directory: {target_path}")
try:
target_path.mkdir(parents=True, exist_ok=True)
except Exception as e:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Address at least some of the comments.
Rearranged README to document all the pieces, needs much more work.