1313module  CloudClient 
1414
1515    # OpenNebula version 
16-     VERSION  =  '5.9 .80' 
16+     VERSION  =  '5.11 .80' 
1717
1818    # ######################################################################### 
1919    # Default location for the authentication file 
@@ -299,9 +299,12 @@ def self.state_to_str(id, lcm_id)
299299            return  state_str 
300300        end 
301301
302-         def  self . print ( json_hash ) 
302+         def  self . print ( json_hash ,   extended   =   false ) 
303303            OneGate . print_header ( "VM "  + json_hash [ "VM" ] [ "ID" ] ) 
304304            OneGate . print_key_value ( "NAME" ,  json_hash [ "VM" ] [ "NAME" ] ) 
305+ 
306+             return  unless  extended 
307+ 
305308            OneGate . print_key_value ( 
306309                "STATE" , 
307310                self . state_to_str ( 
@@ -352,7 +355,7 @@ def self.state_str(state_number)
352355            return  STATE_STR [ state_number . to_i ] 
353356        end 
354357
355-         def  self . print ( json_hash ) 
358+         def  self . print ( json_hash ,   extended   =   false ) 
356359            OneGate . print_header ( "SERVICE "  + json_hash [ "SERVICE" ] [ "id" ] ) 
357360            OneGate . print_key_value ( "NAME" ,  json_hash [ "SERVICE" ] [ "name" ] ) 
358361            OneGate . print_key_value ( "STATE" ,  Service . state_str ( json_hash [ "SERVICE" ] [ 'state' ] ) ) 
@@ -364,7 +367,7 @@ def self.print(json_hash)
364367
365368                if  role [ "nodes" ] 
366369                    role [ "nodes" ] . each {  |node |
367-                         OneGate ::VirtualMachine . print ( node [ "vm_info" ] ) 
370+                         OneGate ::VirtualMachine . print ( node [ "vm_info" ] ,   extended ) 
368371                    } 
369372                end 
370373
@@ -394,8 +397,9 @@ def initialize(opts={})
394397            end 
395398        end 
396399
397-         def  get ( path ) 
400+         def  get ( path ,   extra   =   nil ) 
398401            req  =  Net ::HTTP ::Proxy ( @host ,  @port ) ::Get . new ( path ) 
402+             req . body  =  extra  if  extra 
399403
400404            do_request ( req ) 
401405        end 
@@ -496,7 +500,7 @@ def self.help_str
496500Available commands 
497501    $ onegate vm show [VMID] [--json] 
498502
499-     $ onegate vm update [VMID] --data KEY=VALUE[ \\ nKEY2=VALUE2]  
503+     $ onegate vm update [VMID] --data KEY=VALUE\\ nKEY2=VALUE2 
500504
501505    $ onegate vm update [VMID] --erase KEY 
502506
@@ -512,7 +516,7 @@ def self.help_str
512516        $ onegate hold [VMID] 
513517        $ onegate release [VMID] 
514518
515-     $ onegate service show [--json] 
519+     $ onegate service show [--json][--extended]  
516520
517521    $ onegate service scale --role ROLE --cardinality CARDINALITY 
518522EOT 
@@ -545,6 +549,10 @@ def self.help_str
545549    options [ :json ]  =  json 
546550  end 
547551
552+   opts . on ( "" ,  "--extended" ,  "Print resource extended information" )  do  |ext |
553+     options [ :extended ]  =  ext 
554+   end 
555+ 
548556  opts . on ( "-f" ,  "--hard" ,  "Hard option for power off operations" )  do  |hard |
549557    options [ :hard ]  =  hard 
550558  end 
@@ -640,13 +648,24 @@ def self.help_str
640648when  "service" 
641649    case  ARGV [ 1 ] 
642650    when  "show" 
643-         response  =  client . get ( "/service" ) 
651+         if  options [ :extended ] 
652+             extra              =  { } 
653+             extra [ 'extended' ]  =  true 
654+ 
655+             extra  =  URI . encode_www_form ( extra ) 
656+         end 
657+ 
658+         response   =  client . get ( "/service" ,  extra ) 
644659        json_hash  =  OneGate . parse_json ( response ) 
645660        #pp json_hash 
646661        if  options [ :json ] 
647662            puts  JSON . pretty_generate ( json_hash ) 
648663        else 
649-             OneGate ::Service . print ( json_hash ) 
664+             if  options [ :extended ] 
665+                 OneGate ::Service . print ( json_hash ,  true ) 
666+             else 
667+                 OneGate ::Service . print ( json_hash ) 
668+             end 
650669        end 
651670    when  "scale" 
652671        response  =  client . put ( 
0 commit comments