Skip to content

If config_file is None, use cwd, not its parent#8894

Merged
jmchilton merged 1 commit intogalaxyproject:devfrom
jdavcs:sg_config40
Oct 28, 2019
Merged

If config_file is None, use cwd, not its parent#8894
jmchilton merged 1 commit intogalaxyproject:devfrom
jdavcs:sg_config40

Conversation

@jdavcs
Copy link
Member

@jdavcs jdavcs commented Oct 28, 2019

Addresses this comment:
#921 (comment)

@natefoo , @nsoranzo - is this correct?

(the added empty lines improve readability, I hope)

@jdavcs jdavcs added area/configuration Galaxy's configuration system kind/bug labels Oct 28, 2019
@jdavcs jdavcs added this to the 20.01 milestone Oct 28, 2019
@nsoranzo
Copy link
Member

I'm still not sure if overwriting self.config_dir at line 139 is correct, maybe we can refactor that too?

@jmchilton
Copy link
Member

This needs to be back ported to 19.09 I think.

@jmchilton jmchilton merged commit 61be9ed into galaxyproject:dev Oct 28, 2019
@jdavcs
Copy link
Member Author

jdavcs commented Oct 28, 2019

@nsoranzo about line 139: I don't know. As I understand, if the config file is not specified, cannot be found, etc., and galaxy is running from source tree, just use the config/ dir in the source tree. Should it default to some other location?

@jdavcs
Copy link
Member Author

jdavcs commented Oct 28, 2019

backporting in a min..

@nsoranzo
Copy link
Member

@ic4f One issue is that if a value is specified for 'config_dir' in config_kwargs, it is overwritten by os.path.join(self.root, 'config') .

@jdavcs
Copy link
Member Author

jdavcs commented Oct 28, 2019

@nsoranzo you're right! (config_file looked too much like config_dir - so i didn't notice this!). I'll suggest a fix later today.

jdavcs added a commit to jdavcs/galaxy that referenced this pull request Oct 30, 2019
1. Split method body in two
2. Change assignment of config_dir when running from source
3. Ensure value of config_dir is an absolute path

I think splitting the method imporoves readability: its functionality
can be easily grouped into 2 parts: (1) finding and reading the main
config file (I've removed the comment because it was not quite in place
and, I think, not essential to understanding the code); and (2)
setting paths for core config properties based on part (1).

The change to config_dir addresses previous discussions:
galaxyproject#8894 (comment)
galaxyproject#921 (comment)

I could've changed the line in question:
galaxyproject#921 (comment)
to this:
`if self.config_file is None and `config_dir` is not in config_kwargs:`

However, in my opinion, such an edit would further obfuscate the logic
of assigning that value. The proposed solution, I think, although more
verbose, makes the code more straightforward: it is immediately clear
what values are assigned under what circumstances.

Finally, in the previous version `config_dir` can be a relative path if
`config_file` exists, but `config_dir` is set by the user (to a relative
path). That, I believe, was a bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/configuration Galaxy's configuration system kind/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants