-
Notifications
You must be signed in to change notification settings - Fork 165
[WIP] Dynaconf for yamls #9376
base: master
Are you sure you want to change the base?
[WIP] Dynaconf for yamls #9376
Conversation
25c5259
to
3ca401b
Compare
cd05992
to
57bcdb8
Compare
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.
@kedark3 can you provide some comments on how to test this PR locally? Is it as simple as checking out this PR, checkout our your yamls PR and then doing
from cfme.utils import conf_copy
print(conf_copy.cfme_data)
I get an KeyError
when I try to do conf_copy.cfme_data.basic_info
?
@john-dupuy yes please pull my YAMLs PR 832 and then you can run:
|
57bcdb8
to
3ac67a2
Compare
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.
One Suggestion, Else LGTM 👍
cfme/utils/config_copy.py
Outdated
|
||
class Configuration(object): | ||
""" | ||
holds the current configuration |
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.
Suggestion:
Can you please elaborate more? with example if possible.?
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.
Added some comments.
3ac67a2
to
84d2f20
Compare
I am waiting on my Dynaconf PR before working on this one. In the meanwhile feel free to leave reviews. I will fix travis later. |
Moving to WIPTEST based off of #9376 (comment), let me know if you'd like to leave it RFR @kedark3 |
ad12dfb
to
ae84262
Compare
f5c230c
to
b53649f
Compare
To Reviewers: This PR passed the jenkins run, I can point you to it if needed.Kindly review. |
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.
A few small questions, but looks great! Nice work KK! 🎉
Travis build is timing out, waiting for travis to be fixed before moving to 1LP.
cfme/utils/log.py
Outdated
except KeyError: | ||
# env not loaded yet | ||
pass | ||
# try: |
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.
@kedark3 do you want to remove these lines?
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.
removing it now as I see no effect of this in test run on jenkins.
cfme/utils/config.py
Outdated
""" | ||
if self.settings is None: | ||
self.settings = { | ||
file.basename[:-5]: ConfigData(env=file.basename[:-5]) |
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.
Why the -5
? Maybe add a comment here?
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.
.yml is also a valid file type, this is a bad practice.
Since file
here is a Py.path.local instance, you want to use file.purebasename
.
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.
s = {f.purebasename: 'a value' for f in conf_path.listdir() if '.local.yaml' not in f.basename and f.ext in ['.yaml', '.yml']}
Purebasename alone gets tripped up by the .local.yaml files, (as you pointed out in chat! :) ) but you should be fine using it like above since you're filtering the files anyway within the comprehension.
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.
fixed this
3db5b3c
to
f3768c6
Compare
cfme/utils/config.py
Outdated
'perf_tests': <cfme.utils.config_copy.ConfigData at 0x7f2a943ad2e8>} | ||
|
||
""" | ||
if self.settings is 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.
Why not use a cached_property? That appears to be what this method is.
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.
added
cfme/utils/config.py
Outdated
|
||
:param name: name of the configuration object | ||
""" | ||
self.configure() |
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.
No need to explicitly call this when the data that its filling is provided by the cached_property on access.
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.
removed
f3768c6
to
df73523
Compare
df73523
to
49751d6
Compare
49751d6
to
d3623c5
Compare
d3623c5
to
b60bf6c
Compare
@@ -279,6 +287,7 @@ PyYAML==5.1 | |||
pyzmq==18.0.1 | |||
qtconsole==4.4.3 | |||
redfish-client==0.1.0 | |||
redis==3.3.10 |
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.
added as part of dynaconf requirements . https://github.com/rochacbruno/dynaconf/blob/master/setup.py
b60bf6c
to
3f167ce
Compare
Would you mind rebasing this Pull Request against latest master, please? |
Purpose or Intent
This PR is an enhancement of what I have done in PR #9315 as it is able to read values for all the available yamls in conf/ directory.
It does have limitations though(dynaconf imposed):
.local.yaml
files[Update] I have a PR that may fix the issue number 1 listed above: https://github.com/rochacbruno/dynaconf/pull/238 - waiting on them to release new version
runtime
as the conf had[Update] I have made it possible to mimic the runtime property with dynaconf and it seems to collect alright locally.
You still need my latest GitLab PR to make this code work locally.
File names
_copy
are not final, will rename files before merge.