mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Load libraries and config from app's relative directory
This commit is contained in:
parent
6fdeed596e
commit
b130e9911a
1 changed files with 13 additions and 9 deletions
|
|
@ -4,21 +4,25 @@ require 'rbvmomi'
|
|||
require 'redis'
|
||||
require 'yaml'
|
||||
|
||||
require File.expand_path( File.dirname( __FILE__ ), 'lib/vsphere_helper.rb' )
|
||||
$:.unshift( File.dirname( __FILE__ ) )
|
||||
require 'lib/require_relative'
|
||||
require 'lib/vsphere_helper'
|
||||
|
||||
vsphere_helper = VsphereHelper.new
|
||||
|
||||
# Load the pool configuration
|
||||
pools = YAML.load_file('vmware-host-pooler.yaml')[:pools]
|
||||
Dir.chdir( File.dirname( __FILE__ ) )
|
||||
|
||||
# Load fog credentials
|
||||
fog_file = File.expand_path("~/.fog")
|
||||
fog_data = YAML.load_file(fog_file)[:default]
|
||||
# Load the configuration file
|
||||
config_file = File.expand_path( 'vmware-host-pooler.yaml' )
|
||||
|
||||
pools = YAML.load_file( config_file )[:pools]
|
||||
vsphere = YAML.load_file( config_file )[:vsphere]
|
||||
|
||||
# Connect to vSphere
|
||||
$vim = RbVmomi::VIM.connect(
|
||||
:host => fog_data[:vsphere_server],
|
||||
:user => fog_data[:vsphere_username],
|
||||
:password => fog_data[:vsphere_password],
|
||||
:host => vsphere['server'],
|
||||
:user => vsphere['username'],
|
||||
:password => vsphere['password'],
|
||||
:ssl => true,
|
||||
:insecure => true,
|
||||
:rev => '5.1'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue