Forum Discussion

Ross_79170's avatar
Ross_79170
Icon for Nimbostratus rankNimbostratus
Dec 28, 2011

System.VCMP.VCMPCompletionStatus structure

Hi Chaps

 

 

I hope you are all well.

 

 

I am doing some work using iControl on perl (SOAP::Lite) to create vCMP instances and am a bit stuck with accessing the data structure returned by System.VCMP.get_completion_status.

 

 

I can see it clearly using Data::Dumper, but cant seem to get the code right to be able to access the hash elements.

 

 

$VAR1 = [

 

bless( [

 

bless( {

 

'request_complete' => 'true',

 

'comment' => '',

 

'status' => 'VCMP_STATUS_RUNNING',

 

'requested_state' => 'VCMP_GUEST_STATE_DEPLOYED',

 

'slot_id' => 1

 

}, 'System::VCMP::VCMPCompletionStatus' )

 

], 'System::VCMP::VCMPCompletionStatus[]' )

 

];

 

 

Could anybody suggest an example?

 

 

Many thanks!

 

 

Ross

 

  • Mark_Worrell_98's avatar
    Mark_Worrell_98
    Historic F5 Account
    Here's a perl example that should get you going:

     

     

    @list = @{$soap_response->result};

     

     

    foreach $guest (0 .. $list) {

     

    $ref = $list[$guest];

     

    $n = @$ref - 1;

     

    printf(STDOUT "Guest: %s\n", $opt_n);

     

    foreach $slot (0 .. $n) {

     

    $foo = $list[$guest][$slot];

     

     

    $slot_id = $foo->{"slot_id"};

     

    $requested_state = $foo->{"requested_state"};

     

    $request_complete = $foo->{"request_complete"};

     

    $status = $foo->{"status"};

     

    $comment = $foo->{"comment"};

     

     

    printf(STDOUT "Slot ID: %s\n", $slot_id);

     

    printf(STDOUT "Requested State: %s\n", $requested_state);

     

    printf(STDOUT "Request Complete: %s\n", $request_complete);

     

    printf(STDOUT "Status: %s\n", $status);

     

    printf(STDOUT "Comment: %s\n", $comment);

     

    }

     

    }
  • Mark_Worrell_98's avatar
    Mark_Worrell_98
    Historic F5 Account
    Let's try that again and see if the system will preserve the indentation:

     

     

     

    @list = @{$soap_response->result};

     

     

    foreach $guest (0 .. $list) {

     

    $ref = $list[$guest];

     

    $n = @$ref - 1;

     

    printf(STDOUT "Guest: %s\n", $opt_n);

     

    foreach $slot (0 .. $n) {

     

    $foo = $list[$guest][$slot];

     

     

    $slot_id = $foo->{"slot_id"};

     

    $requested_state = $foo->{"requested_state"};

     

    $request_complete = $foo->{"request_complete"};

     

    $status = $foo->{"status"};

     

    $comment = $foo->{"comment"};

     

     

    printf(STDOUT "Slot ID: %s\n", $slot_id);

     

    printf(STDOUT "Requested State: %s\n", $requested_state);

     

    printf(STDOUT "Request Complete: %s\n", $request_complete);

     

    printf(STDOUT "Status: %s\n", $status);

     

    printf(STDOUT "Comment: %s\n", $comment);

     

    }

     

    }
  • Hi Mark,

     

     

    Try putting the code in [ code ] [/ code ] blocks (without the spaces).

     

     

    Aaron
  • Mark_Worrell_98's avatar
    Mark_Worrell_98
    Historic F5 Account
    Thanks! Let's see how this looks:

    
    @list = @{$soap_response->result}; 
    
    foreach $guest (0 .. $list) { 
    $ref = $list[$guest]; 
    $n = @$ref - 1; 
    printf(STDOUT "Guest: %s\n", $opt_n); 
    foreach $slot (0 .. $n) { 
    $foo = $list[$guest][$slot]; 
    
    $slot_id = $foo->{"slot_id"}; 
    $requested_state = $foo->{"requested_state"}; 
    $request_complete = $foo->{"request_complete"}; 
    $status = $foo->{"status"}; 
    $comment = $foo->{"comment"}; 
    
    printf(STDOUT "Slot ID: %s\n", $slot_id); 
    printf(STDOUT "Requested State: %s\n", $requested_state); 
    printf(STDOUT "Request Complete: %s\n", $request_complete); 
    printf(STDOUT "Status: %s\n", $status); 
    printf(STDOUT "Comment: %s\n", $comment); 
    } 
    }
    
  • Mark_Worrell_98's avatar
    Mark_Worrell_98
    Historic F5 Account
    One more shot with spaces...

    
    @list = @{$soap_response->result}; 
    
    foreach $guest (0 .. $list) { 
        $ref = $list[$guest]; 
        $n = @$ref - 1; 
        printf(STDOUT "Guest: %s\n", $opt_n); 
        foreach $slot (0 .. $n) { 
            $foo = $list[$guest][$slot]; 
    
            $slot_id = $foo->{"slot_id"}; 
            $requested_state = $foo->{"requested_state"}; 
            $request_complete = $foo->{"request_complete"}; 
            $status = $foo->{"status"}; 
            $comment = $foo->{"comment"}; 
    
            printf(STDOUT "Slot ID: %s\n", $slot_id); 
            printf(STDOUT "Requested State: %s\n", $requested_state); 
            printf(STDOUT "Request Complete: %s\n", $request_complete); 
            printf(STDOUT "Status: %s\n", $status); 
            printf(STDOUT "Comment: %s\n", $comment); 
        } 
    }
    
  • That's Perfect.

     

     

    Thank you very much - I wouldn't have gotten there on my own!

     

     

    Kind Regards

     

     

    Ross