Subscribe

WFA filter by cluster name

I have a workflow created that was cloned from the Create cDOT Cifs Share workflow.  My problem is the filter I created (used in the "Search for Cluster" command) which I would like to return only certain clusters based on a naming convention filter.  When I test the filter, it returns only the clusters matching the *prod* wildcard.  However, when I run it in the workflow, it keeps returning all the clusters.  Any help would be greatly appreciated.

 

Here is the SQL query:

SELECT
cluster.id,
cluster.admin_vserver_id,
cluster.name,
cluster.location,
cluster.primary_address,
cluster.uuid
FROM
cm_storage.cluster
WHERE
cluster.name LIKE '%prod%'
OR cluster.primary_address = '${cluster_name}'

Frequent Contributor

Re: WFA filter by cluster name

Hi,

 

Let me help you out.

Can you export the filter and send over the exported dar and a WFA backup.

Send it over to ag@netapp.com

 

 

 

 

Re: WFA filter by cluster name

[ Edited ]

Your query isn't right for the condition you are looking for.  I believe you want to look for either a cluster of a specific IP or if not found any Cluster that has name like 'prod'. This is an XOR kind of condition and can't be met with the query you have written. This query will always return the union of the 2 where clauses. I tested your query and it gives the same result both at filter and at workflow i.e. a list of clusters who match prod + cluster who match the given IP.

 

'or' operator in SQL doesn't behave like a normal proraming language 'or'. It will NOT return if the first condition is met without checking for the 2nd.

 

I think you can solve it by using 2 different filters:

 

1. To match prod

 

SELECT
cluster.id,
cluster.admin_vserver_id,
cluster.name,
cluster.location,
cluster.primary_address,
cluster.uuid
FROM
cm_storage.cluster
WHERE
cluster.name LIKE '%prod%'

 

2. To match the IP:

 

SELECT
cluster.id,
cluster.admin_vserver_id,
cluster.name,
cluster.location,
cluster.primary_address,
cluster.uuid
FROM
cm_storage.cluster
WHERE
cluster.primary_address = '${cluster_name}'

 

 

Now In your workflow have 2 No-Op commands; first to look for a cluster using Cluster IP i.e. filter-2 . Set option If cluster1 was not found: Disable this command.

Second no-op command to seach the cluster using filter-1 i.e. name like prod. Go to Advanced tab and set: Execute this command if Cluster2 was found AND the if the following expression is TRUE.

 

Give this in expression box: !(cluster1._found)

 

2nd no-op.png

 

Now you are done. Your workflow will either get the cluster with this given IP or will find one with name like prod, but not both.

 

 

 

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.