Skip to content

feat(utils) - Utility Scripts for Virtual Machines - #1

Open
mealsbytaresco wants to merge 2 commits into
mainfrom
feat/vm_admin_scripts
Open

feat(utils) - Utility Scripts for Virtual Machines#1
mealsbytaresco wants to merge 2 commits into
mainfrom
feat/vm_admin_scripts

Conversation

@mealsbytaresco

Copy link
Copy Markdown

Utility scripts for setting up users and packages on shared VMs/development environments

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces utility scripts for managing users and packages on shared virtual machines/development environments. The scripts provide functions for user management (creation, deletion, SSH setup) and global package installation (conda, poetry, uv) with shared caching configurations.

Key changes:

  • User administration functions for creating/deleting users with custom directories and group management
  • Package administration functions for installing Python package managers globally with shared caches
  • Environment setup utilities for configuring user-specific cache directories and shell profiles

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
scripts/vm_admin/user_admin.sh User management functions including creation, deletion, SSH setup, and environment configuration
scripts/vm_admin/opt_admin.sh Global package manager installation functions for conda, poetry, and uv with shared cache setup

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +94 to +95
sudo chown -R root:"$group_owner" "$python_install_dir"
sudo chmod -R 2775 "$python_install_dir"

Copilot AI Sep 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chown and chmod operations on lines 94-95 should target $python_bin_dir instead of $python_install_dir, as the mkdir operation on line 93 creates the $python_bin_dir directory.

Suggested change
sudo chown -R root:"$group_owner" "$python_install_dir"
sudo chmod -R 2775 "$python_install_dir"
sudo chown -R root:"$group_owner" "$python_bin_dir"
sudo chmod -R 2775 "$python_bin_dir"

Copilot uses AI. Check for mistakes.
sudo ln -s "$userdir" "$scratch_link"
sudo chown -h "$username:$username" "$scratch_link"

add_user_to_groups "$username" "${groups[@]}"

Copilot AI Sep 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function call will fail if the groups array is empty because add_user_to_groups returns 1 when no groups are specified, but this is inside the conditional block that only executes when userdir is set. Consider moving this outside the conditional or handling the empty groups case differently.

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +95
sudo chown -R root:"$group_owner" "$python_install_dir"
sudo chmod -R 2775 "$python_install_dir"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be $python_bin_dir?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants