Active IQ Unified Manager Discussions

How to cause a WFA command to report failure and stop workflow execution?

korns
3,726 Views

I'm building a PowerShell command that uses dataontap get-naQuotaReport() cmdlet. Based on a number of factors there is no way to completely validate the volume and qtree names in advance so I need the command to be executed and to either work (if /vol/volume/qtree exists) or fail if they don't (i.e.; get-naquotareport returns nothing). I spent awhile trying to catch an error condition with try/catch but it doesn't seem to work and other discussions here indicate it won't work anyway. So the only way I find to determine failure is to look for the case where get-naQutaReport returns nothing (or the [string]$qrObject is ""). I can detect that condition properly and log it with Get-WFA-Logger but how do I make the command return an error status to WFA, go red and stop further workflow execution? I'm trying 'exit 1' which doesn't seem to do it and have no other ideas.

---- snippet ----

    $qtreePath = "/vol/" + $VolumeName + "/" + $QtreeName

#

# Determine Current DiskUsed & DiskLimit

#

    $qrObject = (Get-NaQuotaReport -Path $QtreePath)

    if([string]$qrObject -eq "")

    {

        Get-WFALogger -Error -message $("Get-NaQuotaReport cmdlet failed looking up " + $qtreePath)

        exit 1;

    }

    $curDiskUsed = [int]$qrObject.DiskUsed

    $curDiskLimit = [int]$qrObject.DiskLimit

1 ACCEPTED SOLUTION

karale
3,726 Views

Hi korns,

instead of exit, can you try

throw "something is wrong"

View solution in original post

2 REPLIES 2

karale
3,727 Views

Hi korns,

instead of exit, can you try

throw "something is wrong"

korns
3,726 Views

Thanks, that does it.

Public