Class: Vmpooler::Parsing
- Inherits:
-
Object
- Object
- Vmpooler::Parsing
- Defined in:
- lib/vmpooler/util/parsing.rb
Class Method Summary collapse
-
.get_domain_for_pool(config, pool_name) ⇒ String
-
domain name for pool, if set in the provider for the pool or in the config block.
-
- .get_platform_pool_count(requested, &_block) ⇒ Object
Class Method Details
.get_domain_for_pool(config, pool_name) ⇒ String
Returns - domain name for pool, if set in the provider for the pool or in the config block.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vmpooler/util/parsing.rb', line 19 def self.get_domain_for_pool(config, pool_name) pool = config[:pools].find { |p| p['name'] == pool_name } return nil unless pool provider_name = pool.fetch('provider', 'vsphere') # see vmpooler.yaml.example where it states defaulting to vsphere if config[:providers] && config[:providers][provider_name.to_sym] && config[:providers][provider_name.to_sym]['domain'] domain = config[:providers][provider_name.to_sym]['domain'] elsif config[:config] && config[:config]['domain'] domain = config[:config]['domain'] else domain = nil end domain end |
.get_platform_pool_count(requested, &_block) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/vmpooler/util/parsing.rb', line 6 def self.get_platform_pool_count(requested, &_block) requested_platforms = requested.split(',') requested_platforms.each do |platform| platform_alias, pool, count = platform.split(':') raise ArgumentError if platform_alias.nil? || pool.nil? || count.nil? yield platform_alias, pool, count end end |