-
Notifications
You must be signed in to change notification settings - Fork 293
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
config: allow reading teuthology config from env var location #1998
base: main
Are you sure you want to change the base?
Conversation
Recursion error looks real and possibly related to this change. Will investigate. |
teuthology/config.py
Outdated
@@ -285,10 +284,13 @@ def set_config_attr(obj): | |||
|
|||
|
|||
def _get_config_path(): | |||
config_path = os.environ.get('TEUTHOLOGY_CONFIG', '~/.teuthology.yaml') | |||
config_path = os.path.join(os.path.expanduser(config_path)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bad style, overriding variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if we declare the env for the config, we should stop immediately if such file does not exists.
@@ -137,7 +137,6 @@ class TeuthologyConfig(YamlConfig): | |||
objects. Currently it serves as a convenient interface to | |||
~/.teuthology.yaml and nothing else. | |||
""" | |||
yaml_path = os.path.join(os.path.expanduser('~/.teuthology.yaml')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess if drop this line you have to update the comment above about "interface to ~/.teuthology.yaml and nothing else".
for path in (config_path, system_config_path): | ||
if os.path.exists(path): | ||
return path | ||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to always return a meaningful value, see usage of config constructor below.
0410a2f
to
2fd6215
Compare
@zmc is there a primer on how & what basic tests to run locally? I'd like to upstream parts of my "hacked up local teuthology" and this is merely the first part. So getting a better handle on how you all test it would hopefully avoid me stumbling over the same problems again and again. Thanks. |
any updates? |
Allow changing the default "user" location of the teuthology configuration yaml using the (optional) TEUTHOLOGY_CONFIG environment variable. This change aids my effort to run a customized local teuthology environment. Signed-off-by: John Mulligan <[email protected]>
2fd6215
to
d9274fc
Compare
_SYSTEM_CONFIG_PATH = '/etc/teuthology.yaml' | ||
_USER_CONFIG_PATH = '~/.teuthology.yaml' | ||
_ALT_PATH_ENV_VAR = 'TEUTHOLOGY_CONFIG' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to PEP8 there is no need to add _ (underscore) in the beginning of the constant name, may we have just SYSTEM_CONFIG_PATH
and USER_CONFIG_PATH
?
Also, I think to keep similar naming to env, like CONFIG_PATH_ENV_NAME
.
Allow changing the default "user" location of the teuthology configuration yaml using the (optional) TEUTHOLOGY_CONFIG environment variable. This change aids my effort to run a customized local teuthology environment.