Skip to content

Commit

Permalink
Update writing_a_new_provider to use config/regions.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
agrare committed Mar 19, 2024
1 parent ebce4a3 commit 1ab72ce
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions providers/writing_a_new_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,24 +344,24 @@ class ManageIQ::Providers::AwesomeCloud::CloudManager < ManageIQ::Providers::Clo
end
```
```
module ManageIQ::Providers::AwesomeCloud::Regions
REGIONS = {
"us-east-1" => {:name => "us-east-1", :hostname => "us-east-1.awesome.cloud"}
}.freeze
def self.regions
REGIONS
Now create a `app/models/manageiq/providers/awesome_cloud/regions.rb`
```ruby
module ManageIQ
module Providers::AwesomeCloud
class Regions < ManageIQ::Providers::Regions
end
end
end
```
def self.all
regions.values
end
And a `config/regions.yml`
def self.names
regions.keys
end
end
```yml
---
us-east-1:
:name: us-east-1
:hostname: us-east-1.awesome.cloud
:description: US East 1
```
With that added you should be able to go to the UI, add a cloud provider, and see your new cloud type. For development typically the best way to test code in the UI is to run a rails server and a simulated generic worker via the terminal.
Expand Down

0 comments on commit 1ab72ce

Please sign in to comment.