Loading appliances/VRouter/vrouter.rb +2 −1 Original line number Diff line number Diff line Loading @@ -53,8 +53,9 @@ class OneGate def vm_update(data, vmid = nil, erase: false, keep_alive: false) path = vmid.nil? ? '/vm' : "/vms/#{vmid}" type = erase ? 2 : 1 # 1 = update, 2 = delete_element -> https://github.com/OpenNebula/one-ee/blob/7299692415b6bdf9acb6e7789ec241e1b93adb59/src/onegate/onegate-server.rb#L589-L593 req = Net::HTTP::Put.new(path) req.body = erase ? URI.encode_www_form('type' => 2, 'data' => data) : data req.body = URI.encode_www_form('type' => type, 'data' => data) do_request req, keep_alive, expect_json: false end Loading appliances/scripts/net-99-report-ready +9 −22 Original line number Diff line number Diff line Loading @@ -21,28 +21,15 @@ if [[ -x '/etc/one-appliance/service' ]]; then fi fi ### if ! command -v onegate ; then echo "ERROR: No way to signal READY=YES (onegate binary not found)" >&2 exit 1 fi > /dev/null # this will not drop the error message which goes to stderr if which onegate >/dev/null 2>&1; then if onegate vm update --data READY=YES; then echo "Reported READY" exit fi fi if which curl >/dev/null 2>&1; then if curl -X PUT "$ONEGATE_ENDPOINT/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ -d READY=YES; then exit fi fi if which wget >/dev/null 2>&1; then if wget --method PUT "$ONEGATE_ENDPOINT/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --body-data READY=YES; then exit fi fi echo "ERROR: Failed to report READY" >&2 exit 1 context-linux/src/etc/one-context.d/net-99-report-ready +3 −33 Original line number Diff line number Diff line Loading @@ -32,43 +32,13 @@ fi ### if command -v curl ; then _command=curl elif command -v wget && ! wget --help 2>&1 | grep -q BusyBox; then _command=wget elif command -v onegate ; then _command=onegate else echo "ERROR: No way to signal READY=YES (no usable binary)" >&2 if ! command -v onegate ; then echo "ERROR: No way to signal READY=YES (onegate binary not found)" >&2 exit 1 fi > /dev/null # this will not drop the error message which goes to stderr report_ready() { case "$_command" in curl) curl -X "PUT" "${ONEGATE_ENDPOINT}/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --max-time 10 \ --insecure \ -d "READY=YES" ;; wget) wget --method=PUT "${ONEGATE_ENDPOINT}/vm" \ --body-data="READY=YES" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --timeout=10 \ --no-check-certificate ;; onegate) if command -v timeout >/dev/null; then timeout 10 onegate vm update --data "READY=YES" else onegate vm update --data "READY=YES" fi ;; esac } is_base64() { Loading context-linux/src/usr/bin/onegate.rb +29 −36 Original line number Diff line number Diff line #!/usr/bin/env ruby # -------------------------------------------------------------------------- # # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems # # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # Loading Loading @@ -29,7 +29,7 @@ require 'pp' module CloudClient # OpenNebula version VERSION = '6.6.1' VERSION = '6.10.0' # ######################################################################### # Default location for the authentication file Loading Loading @@ -359,7 +359,8 @@ module OneGate 'DEPLOYING_NETS' => 11, 'UNDEPLOYING_NETS' => 12, 'FAILED_DEPLOYING_NETS' => 13, 'FAILED_UNDEPLOYING_NETS' => 14 'FAILED_UNDEPLOYING_NETS' => 14, 'HOLD' => 15 } STATE_STR = [ Loading @@ -377,7 +378,8 @@ module OneGate 'DEPLOYING_NETS', 'UNDEPLOYING_NETS', 'FAILED_DEPLOYING_NETS', 'FAILED_UNDEPLOYING_NETS' 'FAILED_UNDEPLOYING_NETS', 'HOLD' ] # Returns the string representation of the service state Loading Loading @@ -558,32 +560,26 @@ module OneGate def self.help_str return <<-EOT Available commands $ onegate vm show [VMID] [--json] $ onegate vm update [VMID] --data KEY=VALUE\\nKEY2=VALUE2 $ onegate vm update [VMID] --erase KEY $ onegate vm ACTION VMID $ onegate resume [VMID] $ onegate stop [VMID] $ onegate suspend [VMID] $ onegate terminate [VMID] [--hard] $ onegate reboot [VMID] [--hard] $ onegate poweroff [VMID] [--hard] $ onegate resched [VMID] $ onegate unresched [VMID] $ onegate hold [VMID] $ onegate release [VMID] $ onegate service show [--json][--extended] $ onegate service scale --role ROLE --cardinality CARDINALITY $ onegate vrouter show [--json] $ onegate vnet show VNETID [--json][--extended] ## COMMANDS * onegate vm show [VMID] [--json] * onegate vm update [VMID] --data KEY=VALUE\\nKEY2=VALUE2 * onegate vm update [VMID] --erase KEY * onegate vm ACTION VMID * onegate resume [VMID] * onegate stop [VMID] * onegate suspend [VMID] * onegate terminate [VMID] [--hard] * onegate reboot [VMID] [--hard] * onegate poweroff [VMID] [--hard] * onegate resched [VMID] * onegate unresched [VMID] * onegate hold [VMID] * onegate release [VMID] * onegate service show [--json][--extended] * onegate service scale --role ROLE --cardinality CARDINALITY * onegate vrouter show [--json] * onegate vnet show VNETID [--json][--extended] EOT end end Loading @@ -595,6 +591,7 @@ options = {} OptionParser.new do |opts| opts.on("-d", "--data DATA", "Data to be included in the VM") do |data| options[:data] = data options[:type] = 1 end opts.on("-e", "--erase DATA", "Data to be removed from the VM") do |data| Loading Loading @@ -647,16 +644,12 @@ when "vm" OneGate::VirtualMachine.print(json_hash) end when "update" if !options[:data] && !options[:erase] if !options[:data] && !options[:type] STDERR.puts 'You have to provide the data as a param (--data, --erase)' exit -1 end if options[:type] data = URI.encode_www_form(options) else data = options[:data] end if ARGV[2] response = client.put("/vms/" + ARGV[2], data) Loading Loading
appliances/VRouter/vrouter.rb +2 −1 Original line number Diff line number Diff line Loading @@ -53,8 +53,9 @@ class OneGate def vm_update(data, vmid = nil, erase: false, keep_alive: false) path = vmid.nil? ? '/vm' : "/vms/#{vmid}" type = erase ? 2 : 1 # 1 = update, 2 = delete_element -> https://github.com/OpenNebula/one-ee/blob/7299692415b6bdf9acb6e7789ec241e1b93adb59/src/onegate/onegate-server.rb#L589-L593 req = Net::HTTP::Put.new(path) req.body = erase ? URI.encode_www_form('type' => 2, 'data' => data) : data req.body = URI.encode_www_form('type' => type, 'data' => data) do_request req, keep_alive, expect_json: false end Loading
appliances/scripts/net-99-report-ready +9 −22 Original line number Diff line number Diff line Loading @@ -21,28 +21,15 @@ if [[ -x '/etc/one-appliance/service' ]]; then fi fi ### if ! command -v onegate ; then echo "ERROR: No way to signal READY=YES (onegate binary not found)" >&2 exit 1 fi > /dev/null # this will not drop the error message which goes to stderr if which onegate >/dev/null 2>&1; then if onegate vm update --data READY=YES; then echo "Reported READY" exit fi fi if which curl >/dev/null 2>&1; then if curl -X PUT "$ONEGATE_ENDPOINT/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ -d READY=YES; then exit fi fi if which wget >/dev/null 2>&1; then if wget --method PUT "$ONEGATE_ENDPOINT/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --body-data READY=YES; then exit fi fi echo "ERROR: Failed to report READY" >&2 exit 1
context-linux/src/etc/one-context.d/net-99-report-ready +3 −33 Original line number Diff line number Diff line Loading @@ -32,43 +32,13 @@ fi ### if command -v curl ; then _command=curl elif command -v wget && ! wget --help 2>&1 | grep -q BusyBox; then _command=wget elif command -v onegate ; then _command=onegate else echo "ERROR: No way to signal READY=YES (no usable binary)" >&2 if ! command -v onegate ; then echo "ERROR: No way to signal READY=YES (onegate binary not found)" >&2 exit 1 fi > /dev/null # this will not drop the error message which goes to stderr report_ready() { case "$_command" in curl) curl -X "PUT" "${ONEGATE_ENDPOINT}/vm" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --max-time 10 \ --insecure \ -d "READY=YES" ;; wget) wget --method=PUT "${ONEGATE_ENDPOINT}/vm" \ --body-data="READY=YES" \ --header "X-ONEGATE-TOKEN: $TOKENTXT" \ --header "X-ONEGATE-VMID: $VMID" \ --timeout=10 \ --no-check-certificate ;; onegate) if command -v timeout >/dev/null; then timeout 10 onegate vm update --data "READY=YES" else onegate vm update --data "READY=YES" fi ;; esac } is_base64() { Loading
context-linux/src/usr/bin/onegate.rb +29 −36 Original line number Diff line number Diff line #!/usr/bin/env ruby # -------------------------------------------------------------------------- # # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems # # Copyright 2002-2025, OpenNebula Project, OpenNebula Systems # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # Loading Loading @@ -29,7 +29,7 @@ require 'pp' module CloudClient # OpenNebula version VERSION = '6.6.1' VERSION = '6.10.0' # ######################################################################### # Default location for the authentication file Loading Loading @@ -359,7 +359,8 @@ module OneGate 'DEPLOYING_NETS' => 11, 'UNDEPLOYING_NETS' => 12, 'FAILED_DEPLOYING_NETS' => 13, 'FAILED_UNDEPLOYING_NETS' => 14 'FAILED_UNDEPLOYING_NETS' => 14, 'HOLD' => 15 } STATE_STR = [ Loading @@ -377,7 +378,8 @@ module OneGate 'DEPLOYING_NETS', 'UNDEPLOYING_NETS', 'FAILED_DEPLOYING_NETS', 'FAILED_UNDEPLOYING_NETS' 'FAILED_UNDEPLOYING_NETS', 'HOLD' ] # Returns the string representation of the service state Loading Loading @@ -558,32 +560,26 @@ module OneGate def self.help_str return <<-EOT Available commands $ onegate vm show [VMID] [--json] $ onegate vm update [VMID] --data KEY=VALUE\\nKEY2=VALUE2 $ onegate vm update [VMID] --erase KEY $ onegate vm ACTION VMID $ onegate resume [VMID] $ onegate stop [VMID] $ onegate suspend [VMID] $ onegate terminate [VMID] [--hard] $ onegate reboot [VMID] [--hard] $ onegate poweroff [VMID] [--hard] $ onegate resched [VMID] $ onegate unresched [VMID] $ onegate hold [VMID] $ onegate release [VMID] $ onegate service show [--json][--extended] $ onegate service scale --role ROLE --cardinality CARDINALITY $ onegate vrouter show [--json] $ onegate vnet show VNETID [--json][--extended] ## COMMANDS * onegate vm show [VMID] [--json] * onegate vm update [VMID] --data KEY=VALUE\\nKEY2=VALUE2 * onegate vm update [VMID] --erase KEY * onegate vm ACTION VMID * onegate resume [VMID] * onegate stop [VMID] * onegate suspend [VMID] * onegate terminate [VMID] [--hard] * onegate reboot [VMID] [--hard] * onegate poweroff [VMID] [--hard] * onegate resched [VMID] * onegate unresched [VMID] * onegate hold [VMID] * onegate release [VMID] * onegate service show [--json][--extended] * onegate service scale --role ROLE --cardinality CARDINALITY * onegate vrouter show [--json] * onegate vnet show VNETID [--json][--extended] EOT end end Loading @@ -595,6 +591,7 @@ options = {} OptionParser.new do |opts| opts.on("-d", "--data DATA", "Data to be included in the VM") do |data| options[:data] = data options[:type] = 1 end opts.on("-e", "--erase DATA", "Data to be removed from the VM") do |data| Loading Loading @@ -647,16 +644,12 @@ when "vm" OneGate::VirtualMachine.print(json_hash) end when "update" if !options[:data] && !options[:erase] if !options[:data] && !options[:type] STDERR.puts 'You have to provide the data as a param (--data, --erase)' exit -1 end if options[:type] data = URI.encode_www_form(options) else data = options[:data] end if ARGV[2] response = client.put("/vms/" + ARGV[2], data) Loading