TraGicCode / tragiccode-ravendb

0 stars 1 forks source link

Add Ability to manage databases and their configuration #21

Open TraGicCode opened 6 years ago

TraGicCode commented 6 years ago

RavenDB Exposes a restful API. Lets see what we can come up with in order to be able to manage ravendb databases utilizing it's rest API using types and providers. Before i can do this i need to play around with the following.

Look at a couple of modules to see how they organize helper methods and stuff that make the actual rest apis

Methods of possibly reusing a gem

TraGicCode commented 6 years ago

1 would not quite work if the gem itself had dependencies on other gems. I would literally have to vendor not just the libraries code but its dependencies as well somehow. That would lead to a problem i don't want to get into.

TraGicCode commented 6 years ago

2 Has same problem as number 1. What about dependencies.

TraGicCode commented 5 years ago

Example of how to require the gem at the top of the provider without it blowing up before the gym is installed

http://alcy.github.io/2012/11/21/handling-gem-dependencies-in-custom-puppet-providers/

TraGicCode commented 5 years ago

Sounds like as long as there is a proper require on the custom type the provider code can require the gem and work fine. This makes sure the provider code is evaluated after the gen is installed

TraGicCode commented 5 years ago

I talked with someone from puppet and they informed me i cant get rid of the require. here is the conversation:

you have to be careful not to put any "require" statements which may not be "available" yet
You should be able to drop the "require" statement, since that's a side effect of the feature evaluating to true (and allowing your provider to become suitable)
or you can put `Puppet.features.ravendbapiclient?` in your provider code (either at the top or inside to make it more explicit), but it's not necessary

puppet internally will call `Puppet.features.ravendbapiclient?` to determine if your provider is suitable
That method will require the library/gem, and only if it succeeds will your provider be called
so you don't need to explicitly require the gem

So it sounds like the 2 main possibly candidates are

  1. Drop the require and the confine feature will automatically load the library if the feature is present
  2. Add a require at the top and a conditional Puppet.features.ravendbapiclient? to conditionally require the gem