For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

jasm_146487's avatar
jasm_146487
Icon for Nimbostratus rankNimbostratus
Mar 30, 2015

Help with iApp creation

I was wondering if anyone had complete examples of how to create a basic iApp using powershell and iControl?

I have scoured the forums, blogs, posts, tech article and there's absolutely nothing apart from examples in Perl. Although looking at these example does help I'm having issues creating the scalar_vars for the f5.microsoft.iis template.

So in psuedo terms I'm doing the following :

$scalar_vars = @(0..10) this is the only way I can get a 'list' of named pairs. Hastable of hashes wont work

  for ($i=0; $i -lt 10; $i++){

        $scalar_vars[$i]=New-Object iControl.ManagementApplicationServiceScalarVar
        $scalar_vars[$i].name = $iApp.scalar_vars[$i].name     pool__addr
        $scalar_vars[$i].value = $iApp.scalar_vars[$i].value   10.10.10.10   

    }

At the end I get an array of objects using the iControl.ManagementApplicationServiceScalarVar object

$scalar_vars

name                                                     value                                                   
----                                                     -----                                                   
pool__addr                                               10.10.10.10                                           
pool__port                                               80                                                      
net__server_mode                                         lan                                                     
net__client_mode                                         lan                                                     
server_pools__create_new_pool                            test-HTTP                                               
optimizations__lan_or_wan                                LAN                                                     
server_pools__create_new_monitor                         Use Monitor...                                          
server_pools__reuse_monitor_name                         /Common/http                                       
server_pools__lb_method_choice                           round-robin

After creating the table_vars etc... I plug the values into

$(Get-F5.iControl).ManagementApplicationService.create("TestiAPP", "f5.microsoft.iis", $scalar_vars, $list_vars, $table_vars)

The error msg I get is

Exception: Common::OperationFailed
    primary_error_code   : 21954567 (0x014F0007)
    secondary_error_code : 0
    error_string         : script did not successfully complete: (can't read "::net__server_mode": no such 
variable
    while executing
"expr {( $::net__server_mode ne "tunnel" &&  [iapp::is ::pool__pool_to_use $::CREATE_NEW_ANSWER] ) ||  ( 
$::net__server_mode eq "tunnel" &&  [iapp::is ..."
    (procedure "v11_4_main" line 303)

It would seem from the error that either not all the named pairs are being read or $scalar_vars is being cut off part way down. Reordering the pairs simply throws up the same error with a different variable. I have narrowed down that it reads the first two pairs then 'bugs out'.

Can anyone either shed light on this or provide examples?

I'm running 11.5.1 HF5 if it helps.

Regards.

2 Replies

  • It would seem there is a bug with either the 11.5 code base or the f5.microsoft.iis template when reading in scalar values. Trying the same process using .Net SDK renders the same error results as above. If anyone can offer a workaround or solution it would be greatly received.