Ask Your Question

Multiple custom providers

asked 2016-03-24 20:41:52 -0500

DarylW gravatar image

If I am making custom Types/Providers, how do they get applied? I saw that there are some ways to use 'command', 'feature' etc.. to confine them, but if multiple options can resolve, how is a 'default' one chosen?

My use case is to create a pair of providers that can serve s3 files. one will use the Aws ruby SDK, and the other one will shell out to the AWS command.

If I want to prefer to use the ruby sdk provider, but fallback to the awscli provider, how would I do that? How do I provide a good error message if none of the providers are suitable?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-03-24 22:12:56 -0500

updated 2016-03-26 00:43:07 -0500

I think: a set of confine conditions is returned, and confine will apply if and only if all of these conditions are matched. The related code is here.


To choose a default have a look at this for example. There's also an interesting discussion going on about the limitations of this design here. The discussion seems to imply there's no way of having a hierarchy of defaults, and that's the issue behind an open bug PUP-5296. Does that help?

edit flag offensive delete link more


That explains how multiple confines work on a single provider, but I am wondering what happens if you have multiple providers and they all pass their confine checks... which one is used? I wonder if I would have to model the ordering in a feature?

DarylW gravatar imageDarylW ( 2016-03-25 18:46:24 -0500 )edit

OK, updated.

Alex Harvey gravatar imageAlex Harvey ( 2016-03-26 00:37:26 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-03-24 20:41:52 -0500

Seen: 149 times

Last updated: Mar 26 '16