#!/usr/bin/env ruby

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

unless ARGV[0]
  puts 'Usage: pry.rb <director_config_yaml>'
  exit 1
end

require 'yaml'

require 'pry'
require 'cloud'
require 'cloud/vsphere'

bosh_director_config = OpenStruct.new(logger: Logger.new(STDOUT), uuid: 'uuid', task_checkpoint: nil)

Bosh::Clouds::Config.configure(bosh_director_config)

director_config = YAML.load_file(ARGV[0])
vsphere_properties = director_config['cloud']['properties']

cpi = Bosh::Clouds::VSphere.new(vsphere_properties)

puts "You are connected to #{vsphere_properties['vcenters'].first['host']}"

# Welcome to the vSphere console!
# you can access the cpi through the 'cpi' object

Pry.start binding
