B #4494: adapt provision EC2 to new monitor (#4523)

This commit is contained in:
Alejandro Huertas Herrero authored and GitHub committed 2020-04-14 17:44:31 +02:00
1 parent a9b2683c96
commit 02e8a82b0c
5 files changed
+12 -5

No files matched your search

-1
View File
@@ -207,7 +207,6 @@ module OneProvision
Mode.new_cleanup(true)
create_resources(cfg, cid)
create_hosts(cfg, cid)
if skip != :all && @hosts && !@hosts.empty?
@@ -67,12 +67,14 @@ module OneProvision
if poll.key? 'GUEST_IP_ADDRESSES'
name = poll['GUEST_IP_ADDRESSES'].split(',')[0][1..-1] # TODO
elsif poll.key? 'AWS_PUBLIC_IP_ADDRESS'
name = poll['AWS_PUBLIC_IP_ADDRESS'][2..-3]
name = poll['AWS_PUBLIC_IP_ADDRESS']
else
Utils.fail('Failed to get provision name')
end
name
# rubocop:disable Style/StringLiterals
name.gsub("\"", '')
# rubocop:enable Style/StringLiterals
end
# Creates a new HOST in OpenNebula
+3
View File
@@ -242,6 +242,9 @@ module OneProvision
base.delete('playbook')
end
yaml['playbook'] = [yaml['playbook']]
yaml['playbook'].flatten!
# replace scalars or append array from child YAML
yaml.each do |key, value|
next if key == 'defaults'
+1 -1
View File
@@ -45,7 +45,7 @@ begin
xhost.initialize_xml(xml_text, 'HOST')
deploy_id = xhost["TEMPLATE/PROVISION/DEPLOY_ID"]
ec2_drv = EC2Driver.new(deploy_id ? xhost['NAME'] : xhost)
ec2_drv = EC2Driver.new(deploy_id ? xhost['NAME'] : xhost, xhost['ID'])
puts ec2_drv.deploy(nil, xhost, xml_text, deploy_id ? "" : "BOOT", deploy_id)
+4 -1
View File
@@ -36,14 +36,17 @@ $LOAD_PATH << RUBY_LIB_LOCATION
require 'ec2_driver'
require 'opennebula'
require 'base64'
deploy_id = ARGV[0]
host = ARGV[1]
id = ARGV[2]
begin
ec2_drv = EC2Driver.new(host, id)
ec2_drv.poll(id, deploy_id)
monitor = ec2_drv.poll(id, deploy_id).first
puts Base64.decode64(monitor[:monitor])
rescue Exception => e
OpenNebula.error_message(<<EOT)
Cannot poll info for EC2 host #{host} due to "#{e.message}"