11#!/usr/bin/env ruby
22
33# -------------------------------------------------------------------------- #
4- # Copyright 2002-2022 , OpenNebula Project, OpenNebula Systems #
4+ # Copyright 2002-2025 , OpenNebula Project, OpenNebula Systems #
55# #
66# Licensed under the Apache License, Version 2.0 (the "License"); you may #
77# not use this file except in compliance with the License. You may obtain #
2929module CloudClient
3030
3131 # OpenNebula version
32- VERSION = '6.6.1 '
32+ VERSION = '6.10.0 '
3333
3434 # #########################################################################
3535 # Default location for the authentication file
@@ -359,7 +359,8 @@ module Service
359359 'DEPLOYING_NETS' => 11 ,
360360 'UNDEPLOYING_NETS' => 12 ,
361361 'FAILED_DEPLOYING_NETS' => 13 ,
362- 'FAILED_UNDEPLOYING_NETS' => 14
362+ 'FAILED_UNDEPLOYING_NETS' => 14 ,
363+ 'HOLD' => 15
363364 }
364365
365366 STATE_STR = [
@@ -377,7 +378,8 @@ module Service
377378 'DEPLOYING_NETS' ,
378379 'UNDEPLOYING_NETS' ,
379380 'FAILED_DEPLOYING_NETS' ,
380- 'FAILED_UNDEPLOYING_NETS'
381+ 'FAILED_UNDEPLOYING_NETS' ,
382+ 'HOLD'
381383 ]
382384
383385 # Returns the string representation of the service state
@@ -448,6 +450,8 @@ def initialize(opts={})
448450 @user_agent = "OpenNebula #{ CloudClient ::VERSION } " <<
449451 "(#{ opts [ :user_agent ] ||"Ruby" } )"
450452
453+ @req_content_type = opts [ :req_content_type ] || "application/json"
454+
451455 @host = nil
452456 @port = nil
453457
@@ -505,6 +509,7 @@ def do_request(req)
505509 req [ 'User-Agent' ] = @user_agent
506510 req [ 'X-ONEGATE-TOKEN' ] = @token
507511 req [ 'X-ONEGATE-VMID' ] = @vmid
512+ req [ 'Content-Type' ] = @req_content_type
508513
509514 res = CloudClient ::http_start ( @uri , @timeout ) do |http |
510515 http . request ( req )
@@ -558,32 +563,26 @@ def self.print_key_value(key, value)
558563
559564 def self . help_str
560565 return <<-EOT
561- Available commands
562- $ onegate vm show [VMID] [--json]
563-
564- $ onegate vm update [VMID] --data KEY=VALUE\\ nKEY2=VALUE2
565-
566- $ onegate vm update [VMID] --erase KEY
567-
568- $ onegate vm ACTION VMID
569- $ onegate resume [VMID]
570- $ onegate stop [VMID]
571- $ onegate suspend [VMID]
572- $ onegate terminate [VMID] [--hard]
573- $ onegate reboot [VMID] [--hard]
574- $ onegate poweroff [VMID] [--hard]
575- $ onegate resched [VMID]
576- $ onegate unresched [VMID]
577- $ onegate hold [VMID]
578- $ onegate release [VMID]
579-
580- $ onegate service show [--json][--extended]
581-
582- $ onegate service scale --role ROLE --cardinality CARDINALITY
583-
584- $ onegate vrouter show [--json]
585-
586- $ onegate vnet show VNETID [--json][--extended]
566+ ## COMMANDS
567+
568+ * onegate vm show [VMID] [--json]
569+ * onegate vm update [VMID] --data KEY=VALUE\\ nKEY2=VALUE2
570+ * onegate vm update [VMID] --erase KEY
571+ * onegate vm ACTION VMID
572+ * onegate resume [VMID]
573+ * onegate stop [VMID]
574+ * onegate suspend [VMID]
575+ * onegate terminate [VMID] [--hard]
576+ * onegate reboot [VMID] [--hard]
577+ * onegate poweroff [VMID] [--hard]
578+ * onegate resched [VMID]
579+ * onegate unresched [VMID]
580+ * onegate hold [VMID]
581+ * onegate release [VMID]
582+ * onegate service show [--json][--extended]
583+ * onegate service scale --role ROLE --cardinality CARDINALITY
584+ * onegate vrouter show [--json]
585+ * onegate vnet show VNETID [--json][--extended]
587586EOT
588587 end
589588end
@@ -815,3 +814,4 @@ def self.help_str
815814 STDERR . puts OneGate . help_str
816815 exit -1
817816end
817+
0 commit comments