Active IQ Unified Manager Discussions

how to make optional input parameters work? (create export)

pwl
NetApp Alumni
3,888 Views

hello again

i'm have a workflow for creating NFS exports.   i accept the following parameters:

  Size

  Read-only hosts  ($ROhosts  => comma separated list of IP addresses)

  Read-write hosts ($RWhosts  => comma separated list of IP addresses)

the intention is that the the list of RW hosts  and/or list of RO hosts  should be optional (as it is for the Create Export command)

it seems, however, that if i define the a new export  (in a findchart) and assign anything to its properties, the associated parameter gets "activated" in the call to the command.  if the property has no value (because nothing was provided for "read-only hosts", for example), the command fails :

    Missing an argument for parameter 'ROhosts'. Specify a parameter of type 'System.Array' and try again.

Here's what the Create Export execution plan looks like:

{Array=10.128.57.135, NoSuid=true, QtreeName=nfs_export_005, ROhosts=, RWhosts=, Roothosts=, Security=sys, VFilerName=pwl-vf02-ipn, VolumeName=odi_ipn_shared_001}

note that ROhosts, RWhosts & Roothosts are all shown, but have no values (because i didn't supply any values at input time)

how can i create an export object, and assign some values to ROhosts, etc if the user provided some, and none if the user didn't ?

1 ACCEPTED SOLUTION

pwl
NetApp Alumni
3,888 Views

So it turns around there are some caveats & workarounds.  Contact me directly if needed.

View solution in original post

3 REPLIES 3

hill
3,888 Views

Hi Peter,

We may need to get on the phone.  I did a couple of quick tests where I had a workflow that:

  • Created a volume (user inputs of volName and volSize)
  • Created an export (user inputs of RootHosts and RWHosts)

I hardcoed the array and aggregate just for the sake of time.  I tried previews for both when I supplied values for RootHosts and RWHosts, and where no values were provided... and the previews worked fine.  I did this test on both WFA 1.0 and 0.7.

That said... something relayed in the other discussion might help you.  What you should do is to provide this in the value for Roothosts and RWhosts:

          $Roothosts=="" ? " " :$Roothosts

          $RWhosts=="" ? " " :$RWhosts

Looking something like this:

What this should do for you is... look at the value of the User Input variable, and if evaluated to NULL, then use a Space, if the value of the User Input variable is not NULL, then use what was provided as the user input.

Again, I was not able to get the same behavior as you did, so if we need to talk, please shoot me an email with a time that might work for us.

Thanks,

Kevin

pwl
NetApp Alumni
3,888 Views

thanks kevin

i have been trying this. 

the preview/execution plan part works ok

on actual execution, however, when it comes to run the 'Create Export'  command, i get the following, if i set ROhosts to " ":

    'A positional parameter cannot be found that accepts argument 'System.Object[]'.

I've sent an AIM message with a URL where you can look at it for yourself.

pwl
NetApp Alumni
3,889 Views

So it turns around there are some caveats & workarounds.  Contact me directly if needed.

Public