You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am implementing pyrax in a larger project and would like to be able to use a single config file to run the project and pyrax. I noticed that in read_config there is a for loop iterating each of the sections and looking of values in each. This causes a lot of problems when more than on section is defined. When Identity type isn't defined in each section you get a None back which causes _id_type to fail.
I have two proposed solutions that I would like to open up for discussion.
Only look for a dedicated pyrax section.
or
Add a default value of "rackspace" to the safe_get call.
The first is more appealing to me but I don't want to submit a patch and have it break existing functionality. Is there a reason there is a for loop over each of the sections?
The text was updated successfully, but these errors were encountered:
Sorry for taking so long to respond; I was away at PyCon.
Specifying the identity type being used is a fundamental requirement for a configuration, and not having defined should be an error. But I agree that it should only raise the error if the configuration is used. I saw your PR, and I think the solution is much simpler than what you propose.
Previously, any section missing the 'identity_type' definition would
cause pyrax to raise an exception on startup. Now it will only raise an
exception if you attempt to use the environment defined in that section.
This addresses GitHub #346.
I agree that my solution was a bit overwrought for the problem mentioned. I do think that there were some good parts to the patch. Specifically, not having read config traverse every section of the config file. Also, having the ability to specify the config file. It would be very helpful to embed the pyrax config in a more general application config.
I would be happy to file new issues against these and fix up the code from this patch to be satisfactory. Let me know what you think.
I am implementing pyrax in a larger project and would like to be able to use a single config file to run the project and pyrax. I noticed that in read_config there is a for loop iterating each of the sections and looking of values in each. This causes a lot of problems when more than on section is defined. When Identity type isn't defined in each section you get a None back which causes _id_type to fail.
I have two proposed solutions that I would like to open up for discussion.
or
The first is more appealing to me but I don't want to submit a patch and have it break existing functionality. Is there a reason there is a for loop over each of the sections?
The text was updated successfully, but these errors were encountered: