Last active
November 16, 2015 22:11
Take a PCF manifest and pull out the instances to figure out what you need in terms of VM's. Outputs CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
y = YAML.load_file './cf-deployment.yml' | |
puts 'name, instances, vm_type, disk, ram, vcpu' | |
y['jobs'].each do |job| | |
rp_name = job['resource_pool'] | |
cloud_props = nil | |
y['resource_pools'].each do |rp| | |
if rp['name'] == rp_name | |
cloud_props = rp['cloud_properties'] | |
end | |
end | |
persistent_disk_size = 0 | |
unless job['persistent_disk_pool'].nil? | |
y['disk_pools'].each do |pool| | |
if pool['name'] == job['persistent_disk_pool'] | |
persistent_disk_size = pool['disk_size'] | |
end | |
end | |
end | |
puts "#{job['name']}, #{job['instances']}, #{cloud_props['instance_type']}, #{cloud_props['disk']}, #{cloud_props['ram']}, #{cloud_props['cpu']}, #{persistent_disk_size}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment