neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
12 stars 14 forks source link

feat: search also provider config for username #158

Closed pvoborni closed 2 years ago

pvoborni commented 2 years ago

feat: search also provider config for username

Cloud images might have a different default user based on provider, e.g. RHEL has ec2-user but OpenStack image has cloud-user. This allows to define default user per OS in provider section of provisioning config.

feat: find_value_in_config_hierarchy utility method

For getting a configuration value from the most specific to the least specific. Design in a way to be usable for multiple of attributes.

E.g. first looking in host object then host definition in metadata then in provider configuration and then in global provisioning configuration.

pvoborni commented 2 years ago

The new utility method can be used to a bit simplify other logic, e.g. as visible here: https://github.com/pvoborni/mrack/commit/1df617edbd4f970f6964c663da8514a88699c054 (could be sent when this is merged)

pvoborni commented 2 years ago

Thanks for review. I agree with the suggested changes, but I'll merge as it is approved and I'm lazy to do them :) - could be done when this code is touched again.

Tiboris commented 2 years ago

Agree