diff --git a/src/vmm_mad/remotes/ec2/ec2_driver.rb b/src/vmm_mad/remotes/ec2/ec2_driver.rb index 83fc098a41..b9f88e81a0 100755 --- a/src/vmm_mad/remotes/ec2/ec2_driver.rb +++ b/src/vmm_mad/remotes/ec2/ec2_driver.rb @@ -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)