Skip to content

Instantly share code, notes, and snippets.

@krujos
Last active November 16, 2015 22:11
Show Gist options
  • Save krujos/92a020218761eb8b658c to your computer and use it in GitHub Desktop.
Save krujos/92a020218761eb8b658c to your computer and use it in GitHub Desktop.
Take a PCF manifest and pull out the instances to figure out what you need in terms of VM's. Outputs CSV
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