-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provider based case statements in services #16
Comments
Looked to he examples. Concur. That code must get pushed down to the providers. On Fri, Feb 14, 2014 at 6:40 AM, Paul Thornthwaite
|
My examples got a bit muddled (bad namespaces) but I hope the thinking is still sound. Existing behaviour...
One possible implementation where
Unfortunately that's making the initializer a second level of "factory" accounting for the version. Maybe we should consider making |
its funny we have a developer book club at HP cloud and are looking at some of the same issues, in a general sense. Nice to see a real application of it |
Of course, we can’t yet use JSON-style hashes though because 1.8.7. Not just yet. ;-) |
I'm THRILLED that that code jumped out at you guys as a code smell - it sure did to me when I first saw it. If we operate based on the idea that we are all-in on openstack, and we want to focus as much of our effort on the openstack provider (push as much code as possible there), the following emerges: fog-core (gem) <-- fog-openstack (gem) <-- fog-openstack- (gem) Mike and I are going to tackle authentication as the first order of business, and hopefully this will allow us to flesh out the relationships between the above three gems and bring to light any muddiness in our thinking ;-) |
@elight Of course. I found using hash rockets taking too much space for the examples which in my mind were barely more than pseudocode! Not sure if I like the idea that Feels messy overloading the initializer. |
@elight whats the drill on that? How do we handle deprecation here? I will add a lot more questions, more relevant to openstack on the TNG project on this, for instance when does Keystone v1 die? (or Nova v1 for that matter) |
@mwhagedorn Is there a need to deprecate something here? If the behavior gets extracted from fog-core and pushed down into the HP, Rackspace, et al providers then the behavior remains the same while the implementation changes. And that's a good thing. 😄 Can't speak to when Keystone V1 or Nova V1 dies. As I mentioned Wed, I haven't heard anything about Keystone V1 going away anytime even though few people use it with Rackspace AFAIK. I know nada about Nova V1 WRT Rackspace right now. |
Makes sense @elight - that's definitely specific to a given provider. |
@elight .. yeah just thinking too much about the specifics, and we arent there yet. abstract! abstract! |
Seems good 👍 |
This issue has been automatically marked stale due to inactivity. It will be closed if no further activity occurs. Thank you for your contributions. |
The factories for services appear to have the same problem based on a case statement around some providers.
So when
Fog::Compute[:provider]
orFog::Compute.new(:provider => "provider")
is called in almost all cases we requirefog/provider/service
then return a new instance ofFog::Provider::Service
I'm pretty sure that we can scrap most of this stuff.
new_servers
is just a wrapper aroundbare_metal_cloud
and can probably go.version
. I think this can probably be pushed down to a factory for each provider.Fog::Compute[:hp] => Fog::HP::Compute.new(:version => "v1") => Fog::HP::ComputeV1.new
Fog.providers
can be added.vclouddirector => VcloudDirector
The behaviour is so similar / copy pasted that I think we can eliminate most of this.
We could even add something and enumerate over all providers asking if they recognise the symbol and use that.
Basically we don't want anything in core that doesn't need to be there or needs updating when a new provider is added.
Examples:
https://github.com/fog/fog-core/blob/master/lib/fog/compute.rb#L13-L62
https://github.com/fog/fog-core/blob/master/lib/fog/storage.rb#L10-L27
The text was updated successfully, but these errors were encountered: