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

Prevent setting LSF_SERVER to an undefined environment variable #6051

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

larsevj
Copy link
Contributor

@larsevj larsevj commented Sep 5, 2023

Issue
Resolves #6031

Pre review checklist

  • Read through the code changes carefully after finishing work
  • Make sure tests pass locally (after every commit!)
  • Prepare changes in small commits for more convenient review (optional)
  • PR title captures the intent of the changes, and is fitting for release notes.
  • Updated documentation
  • Ensured new behaviour is tested (opened GUI? screenshots? tried workflows?)

Pre merge checklist

  • Added appropriate release note label
  • Commit history is consistent and clean, in line with the contribution guidelines.

@codecov-commenter
Copy link

codecov-commenter commented Sep 7, 2023

Codecov Report

Merging #6051 (b9dcb76) into main (2a84448) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #6051      +/-   ##
==========================================
+ Coverage   82.44%   82.47%   +0.03%     
==========================================
  Files         350      350              
  Lines       21431    21433       +2     
  Branches      839      839              
==========================================
+ Hits        17668    17677       +9     
+ Misses       3465     3458       -7     
  Partials      298      298              
Files Changed Coverage Δ
src/ert/config/parsing/config_schema_item.py 100.00% <ø> (ø)
src/ert/config/queue_config.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

if option_name == "LSF_SERVER" and values[0].startswith("$"):
raise ConfigValidationError(
f"Invalid server name for QUEUE_OPTION LSF LSF_SERVER: "
f"{values[0]}. Check for empty enviroment variable. "
Copy link
Contributor

Choose a reason for hiding this comment

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

enviroment -> environment

"The LSF_SERVER is usually specified in the site-config file. " - maybe more like something like this?
"The LSF_SERVER value is usually provided by default in a site-configuration file. If you have no special needs you can safely remove it from your configuration"

@larsevj larsevj force-pushed the prevent_empty_LSF_SERVER_env branch 2 times, most recently from d7d37e4 to a75c648 Compare September 23, 2023 12:26
@larsevj larsevj self-assigned this Sep 23, 2023
@larsevj larsevj added the release-notes:maintenance Automatically categorise as maintenance change in release notes label Sep 25, 2023
@larsevj larsevj changed the title Prevent empty enviroment variables Prevent LSF_SERVER value from being an empty environment variable Sep 25, 2023
if option_name == "LSF_SERVER" and values[0].startswith("$"):
raise ConfigValidationError(
"Invalid server name for QUEUE_OPTION LSF LSF_SERVER:"
f" {values[0]}. Check for empty environment variable. The"
Copy link
Contributor

@andreas-el andreas-el Sep 25, 2023

Choose a reason for hiding this comment

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

Is the environment variable empty? Or is it just not set?
Will the code hold if you set you own server to;

export MY_LSF_SERVER=""

@larsevj larsevj changed the title Prevent LSF_SERVER value from being an empty environment variable Throw error on setting LSF_SERVER to an unexported environment variable Sep 25, 2023
@larsevj larsevj changed the title Throw error on setting LSF_SERVER to an unexported environment variable Throw error on setting LSF_SERVER to an undefined environment variable Sep 25, 2023
@larsevj larsevj changed the title Throw error on setting LSF_SERVER to an undefined environment variable Prevent setting LSF_SERVER to an undefined environment variable Sep 25, 2023
Comment on lines 97 to 100
f" {values[0]}. Check for an undefined environment variable. "
"The LSF_SERVER value is usually provided by default in a"
" site-configuration file. If you have no special needs you"
" can safely remove it from your configuration."
Copy link
Contributor

Choose a reason for hiding this comment

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

This is obviously up for discussion but you could consider something like this?

"Invalid server name specified for QUEUE_OPTION LSF LSF_SERVER:"
f" {values[0]}. Server name is currently an undefined environment variable. "
"The LSF_SERVER keyword is usually provided by the site-configuration file, "
"beware that you are effectively replacing the default value provided."

Copy link
Contributor

@andreas-el andreas-el left a comment

Choose a reason for hiding this comment

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

Please take a look at the feedback provided.

PR-name and commit is done perfectly. 🚀

Copy link
Contributor

@andreas-el andreas-el left a comment

Choose a reason for hiding this comment

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

You nailed it! 🚀

@larsevj larsevj merged commit 24669d1 into equinor:main Sep 26, 2023
40 checks passed
@larsevj larsevj deleted the prevent_empty_LSF_SERVER_env branch September 26, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes:maintenance Automatically categorise as maintenance change in release notes
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Detect if empty environment variable is used for LSF_SERVER
4 participants