Skip to content

Commit

Permalink
Merge pull request #6 from chef-partners/adamleff/resource-bugfix
Browse files Browse the repository at this point in the history
Moving resources to an instance variable hash
  • Loading branch information
adamleff committed Dec 17, 2015
2 parents 451b18c + 115abbd commit c22fb0a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/chef/provisioning/vra_driver/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def initialize(driver_url, config)
super

_, @base_url = driver_url.split(':', 2)
@resources = {}
end

def allocate_machine(action_handler, machine_spec, machine_options)
Expand Down Expand Up @@ -126,12 +127,12 @@ def description(machine_spec)

def resource_for(machine_spec)
return nil if machine_spec.location.nil?
return @resource if @resource

begin
@resource = vra_client.resources.by_id(machine_spec.location['resource_id'])
resource_id = machine_spec.location['resource_id']
@resources[resource_id] ||= vra_client.resources.by_id(resource_id)
rescue Vra::Exception::NotFound
return nil
nil
end
end

Expand Down

0 comments on commit c22fb0a

Please sign in to comment.