1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

B #1554: Fix EC2 deployment failure with custom USERDATA (#1556)

(cherry picked from commit 59665e9f81132be4b3ee9fc64b3d4d81d20c0840)
This commit is contained in:
Vlastimil Holer 2017-12-01 11:28:51 +01:00 committed by Tino Vazquez
parent e58dc4c521
commit c4700778e8

View File

@ -321,22 +321,22 @@ class EC2Driver
if !ec2_value(ec2_info, 'USERDATA')
xml = OpenNebula::XMLElement.new
xml.initialize_xml(xml_text, 'VM')
end
if xml.has_elements?('TEMPLATE/CONTEXT')
# Since there is only 1 level ',' will not be added
context_str = xml.template_like_str('TEMPLATE/CONTEXT')
if xml.has_elements?('TEMPLATE/CONTEXT')
# Since there is only 1 level ',' will not be added
context_str = xml.template_like_str('TEMPLATE/CONTEXT')
if xml['TEMPLATE/CONTEXT/TOKEN'] == 'YES'
# TODO use OneGate library
token_str = generate_onegate_token(xml)
if token_str
context_str << "\nONEGATE_TOKEN=\"#{token_str}\""
if xml['TEMPLATE/CONTEXT/TOKEN'] == 'YES'
# TODO use OneGate library
token_str = generate_onegate_token(xml)
if token_str
context_str << "\nONEGATE_TOKEN=\"#{token_str}\""
end
end
end
userdata_key = EC2[:run][:args]["USERDATA"][:opt]
opts[userdata_key] = Base64.encode64(context_str)
userdata_key = EC2[:run][:args]["USERDATA"][:opt]
opts[userdata_key] = Base64.encode64(context_str)
end
end
instances = @ec2.create_instances(opts)