Skip to content
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

[DRAFT FOR DISCUSSION] Support for helper-scripts environment variables #906

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

remz1337
Copy link
Contributor

🛠️ Note:
We are meticulous about merging code into the main branch, so please understand that pull requests not meeting the project's standards may be rejected. It's never personal!
🎮 Note for game-related scripts: These have a lower likelihood of being merged.


✍️ Description

This is a draft PR, following some ideas we had discussed over Discord a few weeks ago. It was also requested by a few users (can't recall where)

Idea is to be able to save/reuse come configurations/parameters. I'm using a configuration file in /etc/pve-helper-scripts.conf to store the variables, and load them in memory when calling install_script function.

Variables are stored like this in the config file:

APT_CACHER_IP='192.168.1.123'
SSH_USER='admin'
SSH_PASSWORD='$1$PCdmJEPa$.YOlH8I4qBP15r7LV8Ho50'

🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

✅ Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

@github-actions github-actions bot added the high risk A change that can affect many scripts label Dec 18, 2024
@havardthom
Copy link
Contributor

I would prefer to make this simpler and just support reading a /etc/pve-helper-scripts.conf file if it exists and not do any writing to it. Any environment variable defined in the config file would be prefilled in the input during advanced install. Then just have some docs informing about the possibility.

@newzealandpaul
Copy link
Contributor

I think either/or is a good idea. Doing advanced mode and setting everything one at a time is tedious. I would like to be promoted specifically showing what values are overriding the defaults (maybe "****" our the passwords).

@michelroegl-brunner
Copy link
Member

michelroegl-brunner commented Dec 19, 2024

I would side with @havardthom on this. We should not overcomplicate the UI, keep it simpler then bloat it.

One addition could be that we make the path configerable. When you have more then one node in a Cluster you could make it so the config file can be shared on a Network Share / a folder wich is accesible from everey Host in the cluster. This Way you only need one consitent config file and not 5 different one.

This could mabe look somthing like this:

import /NFS/folder/pve-helper-scripts.conf  #Here you may import a "global" config file"

IP_ADDRESS=10.0.0.1 #Settings only relevant for this host, when you have more then one VLAN/Network for example.

With this feature implemente we could also more easily look into supoorting SSH Keys.

Also maybe @BramSuurdje could in addition to Documentation create a Config File Editor similar to the JSON-Editor.

@remz1337
Copy link
Contributor Author

remz1337 commented Dec 22, 2024

I like your ideas, simply reading the config file should be enough for more advanced user to go and edit manually (given enough documention). And supporting multi-host configs sounds nice, but I have no idea how it could be done. How can we ensure that wherever in the cluster a script is run, that it finds/reads the right config file?

@havardthom
Copy link
Contributor

We could just use static path /etc/pve-helper-scripts.conf and people that want in another folder (e.g. shared) could create it there and symlink it to /etc/pve-helper-scripts.conf

@michelroegl-brunner
Copy link
Member

Thats a good ideea.

@remz1337
Copy link
Contributor Author

remz1337 commented Jan 3, 2025

I pushed a commit to make it only read from the file, and loaded some variables in their respective advanced configuration menu. Should we support more environment variables, such as PW1, BRG...?

@michelroegl-brunner
Copy link
Member

I pushed a commit to make it only read from the file, and loaded some variables in their respective advanced configuration menu. Should we support more environment variables, such as PW1, BRG...?

In my opinion we should support all the things a user can change with advanced settings.

@cbrunnkvist
Copy link

Tangential to this issue - is any work being done towards enabling the Helper Scripts to run non-interactively / under automation tools?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high risk A change that can affect many scripts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants