Skip to content

Commit

Permalink
Merge pull request #2 from poliva83/master
Browse files Browse the repository at this point in the history
Version 0.4.2 - 8/12/2015
  • Loading branch information
poliva83 committed Feb 22, 2016
2 parents b65d105 + 347df30 commit b4d3a5a
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.4.2 (8/12/2015)
- Fixed one_vnet_lease :hold action logic.

## 0.4.0 (7/12/2015)
- Added http_port to one_image resource so that port other than 8066 (default) can be used to upload images.
- Fixed error message in one_image resource
Expand Down Expand Up @@ -84,4 +87,4 @@

## 0.1.0 (4/30/2015)

- Initial submission of chef-provisioning-opennebula gem
- Initial submission of chef-provisioning-opennebula gem
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ machine_options {
:use_agent => true,
:user_known_hosts_file => '/dev/null'
}
:connection_timeout => [Integer] max wait time to establish connection
}
```

Expand Down
6 changes: 5 additions & 1 deletion lib/chef/provider/one_image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ def exists?
cpid = Process.wait
fail "Could not start HTTP server on port #{@new_resource.http_port}" if cpid == pid && !success
end
pid = Process.spawn("python -m SimpleHTTPServer #{@new_resource.http_port}", :chdir => ::File.dirname(@new_resource.image_file), STDOUT => "/dev/null", STDERR => "/dev/null", :pgroup => true)
pid = Process.spawn("python -m SimpleHTTPServer #{@new_resource.http_port}",
:chdir => ::File.dirname(@new_resource.image_file),
STDOUT => "/dev/null",
STDERR => "/dev/null",
:pgroup => true)
new_driver.one.upload_img(image_config)
success = true
@new_resource.updated_by_last_action(true)
Expand Down
17 changes: 1 addition & 16 deletions lib/chef/provider/one_vnet_lease.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,7 @@ def exists?
ar_pool = get_ar_pool(ar_pool, @new_resource.ar_id.to_s)
fail "ar_id not found '#{@new_resource.ar_id}'" if ar_pool.nil?
end
available = lease_available?(ar_pool, lookup)
fail "'#{name}' is already allocated to a VM (ID: #{vm})" unless available
available
# ar_pool.each do |a|
# if a['AR']['LEASES']['LEASE']
# [a['AR']['LEASES']['LEASE']].flatten.each do |l|
# if l[lookup] && l[lookup] == @new_resource.name
# exists = true
# vm = l['VM'].to_i
# break
# end
# end
# end
# end
# fail "'#{name}' is already allocated to a VM (ID: #{vm})" if exists && vm > -1
# (exists && vm == -1)
lease_available?(ar_pool, lookup)
end

action :hold do
Expand Down
11 changes: 7 additions & 4 deletions lib/chef/provisioning/opennebula_driver/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ def transport_for(machine_spec, machine_options, _instance)
:user_known_hosts_file => '/dev/null',
:timeout => 10
}.merge(machine_options[:ssh_options] || {})
connection_timeout = machine_options[:connection_timeout] || 300
username = get_ssh_user(machine_spec, machine_options)
conf = machine_options[:ssh_config] || config
options = {}
Expand All @@ -531,12 +532,14 @@ def transport_for(machine_spec, machine_options, _instance)
transport = Chef::Provisioning::Transport::SSH.new(machine_spec.reference['ip'], username, ssh_options, options, conf)

# wait up to 5 min to establish SSH connection
val = 300 / ssh_options[:timeout].to_i
val.times do
connect_sleep = 3
start = Time.now
loop do
break if transport.available?
Chef::Log.debug("Waiting for SSH server ...")
fail "Failed to establish SSH connection to '#{machine_spec.name}'" if Time.now > start + connection_timeout.to_i
Chef::Log.info("Waiting for SSH server ...")
sleep connect_sleep
end
fail "Failed to establish SSH connection to '#{machine_spec.name}'" unless transport.available?
transport
end

Expand Down
2 changes: 1 addition & 1 deletion lib/chef/provisioning/opennebula_driver/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module Provisioning
# Extending module.
#
module OpenNebulaDriver
VERSION = '0.4.0'
VERSION = '0.4.2'
end
end
end

0 comments on commit b4d3a5a

Please sign in to comment.