If you missed the pre-registration for NetApp MS Azure AD B2C, the new login prompt will offer the option to register. Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

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

korns

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

Hi korns,

instead of exit, can you try

throw "something is wrong"

View solution in original post

2 REPLIES 2

karale

Hi korns,

instead of exit, can you try

throw "something is wrong"

View solution in original post

korns

Thanks, that does it.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

Public