-
Notifications
You must be signed in to change notification settings - Fork 181
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
Add a guide for writing a new provider from scratch #457
Conversation
8c33455
to
982318d
Compare
982318d
to
0e32d29
Compare
0e32d29
to
6d91f24
Compare
6d91f24
to
4b3d908
Compare
4d1496b
to
6dc4781
Compare
Okay I ran through this end-to-end with the example code segments and all were successful. Taking out of WIP |
end | ||
``` | ||
|
||
You'll have to add your vendor name to the core `VmOrTemplate` `VENDOR_TYPES` in order for the VMs to be saved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: we have a checklist item for this ManageIQ/manageiq#19440
c52b6d0
to
8a46407
Compare
8a46407
to
61f5847
Compare
:name => image.name, | ||
:location => "unknown", | ||
:raw_power_state => "never", | ||
:template => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raw_power_state
and template
are the same for every provider, consider adding these as default values to the core miq_templates inventory collection definition
:location => "unknown", | ||
:raw_power_state => "never", | ||
:template => true, | ||
:vendor => "awesome_cloud" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have this as a default value as well by pulling the vendor type from the ext_management_system
.
>> ems = ManageIQ::Providers::AwesomeCloud::CloudManager.create!(:name => "My Awesome Cloud", :zone => Zone.default_zone) | ||
``` | ||
|
||
Now that we have that done it is time to start filling out our new provider. The first step is to find the SDK gem for this provider. If there isn't a provider SDK for Ruby you have a few options which we'll cover later. For now lets assume that Awesome Cloud has a ruby gem called 'awesome_cloud'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but we might want to rename this fake gem to "awesome_cloud_client" or "awesome_cloud_sdk" or something to make it clearer.
# it (instance-lavel) it fails. | ||
def self.validate_connection(connection) | ||
# Perform a simple and fast operation that verifies the credentials are correct | ||
!!connection.list_regions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the method that must return a boolean? If so, should we state that here? I wonder there's a nice way to ensure that at the base level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No this can return anything, we handle the "must return a boolean" in core.
We should add more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All minor stuff
Applied review feedback, PTAL @Fryguy |
TODO:
.raw_connect
,.verify_credentials
,#connect
, and#verify_credentials