Azure / azure-init

A minimal provisioning agent designed for Azure Linux VMs.
MIT License
7 stars 10 forks source link

Implement a builder-style provisioning API #91

Closed jeremycline closed 1 week ago

jeremycline commented 3 weeks ago

This is based on top of PR https://github.com/Azure/azure-init/pull/86 so I'd recommend just looking at the last commit in the series. It is a first draft of a builder-style interface to allow library users to select the backend for tools when provisioning.

It's not ready to be merged since there's no tests, documentation, or implementation of default behavior when no backend is explicitly selected. Additionally, I've not gated backends behind feature flags, either. I'd love feedback on the general approach and what to do by default.

My personal opinion is that the default option should iterate through all available backends until one succeeds.

dongsupark commented 3 weeks ago

Code looks good in general. :+1:

My personal opinion is that the default option should iterate through all available backends until one succeeds.

Looks good to me.

anhvoms commented 3 weeks ago

+1 on having the default iterate through all available backend and letting user pass in their own backend

jeremycline commented 3 weeks ago

Okay, I've made a few changes and this should have all the things implemented (but not documented yet). At this point I probably could break some of these changes out into smaller PRs, like the ssh authorized_key tests/changes.

After a bunch of fiddling I decided I didn't love the "iterate through all the backends" approach and decided that the user needs to specify which ones they want to use. It makes the interface more verbose, and to be honest I don't really like what I've built, but my experience writing library APIs in Rust is not large.

However, what I've got is, I think, service-able and can do the things we want it to. I've added some feature flags to show how a user could restrict which backends get used.

jeremycline commented 1 week ago

Okay, I cleaned up the Rust docs and ensured all the publicly exported types have documentation, I think this is now ready.

peytonr18 commented 1 week ago

Thank you Jeremy!!!