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 'redis'
|
||||||
require 'yaml'
|
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
|
vsphere_helper = VsphereHelper.new
|
||||||
|
|
||||||
# Load the pool configuration
|
Dir.chdir( File.dirname( __FILE__ ) )
|
||||||
pools = YAML.load_file('vmware-host-pooler.yaml')[:pools]
|
|
||||||
|
|
||||||
# Load fog credentials
|
# Load the configuration file
|
||||||
fog_file = File.expand_path("~/.fog")
|
config_file = File.expand_path( 'vmware-host-pooler.yaml' )
|
||||||
fog_data = YAML.load_file(fog_file)[:default]
|
|
||||||
|
pools = YAML.load_file( config_file )[:pools]
|
||||||
|
vsphere = YAML.load_file( config_file )[:vsphere]
|
||||||
|
|
||||||
# Connect to vSphere
|
# Connect to vSphere
|
||||||
$vim = RbVmomi::VIM.connect(
|
$vim = RbVmomi::VIM.connect(
|
||||||
:host => fog_data[:vsphere_server],
|
:host => vsphere['server'],
|
||||||
:user => fog_data[:vsphere_username],
|
:user => vsphere['username'],
|
||||||
:password => fog_data[:vsphere_password],
|
:password => vsphere['password'],
|
||||||
:ssl => true,
|
:ssl => true,
|
||||||
:insecure => true,
|
:insecure => true,
|
||||||
:rev => '5.1'
|
:rev => '5.1'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue