Active IQ Unified Manager Discussions

RegEx Help with Exports

TABER_BRANDEN
2,894 Views

I don't know if this is possible in WFA but hoping it is and someone can help.

 

I have a workflow to add export-rules to a given export-policy. Currently you just provide it a comma seprated lists of hosts and it will create a rule for each one.

 

What I would like to do is validate this user input against the export rules that are already there so we aren't creating multiple rules with the same host.

 

I created a query(multiple) that will pull in the existing rules and show it in table form.

Is there anyway to do a regex to make sure the new hosts entered don't match the existing hosts?

 

Annotation 2019-06-06 101653.png 

 

2 REPLIES 2

mbeattie
2,668 Views

Hi,

 

That's an interesting use case, honestly i'm not sure if that's possible? Assuming your intention is to avoid duplicate IP's (clientmatch) in your export policy rules??? Perhaps one way to go about it would be to apply conditional logic to the command that adds the export rule (IE if the clientmatch is found within a list of existing clientmatches then disable the command). This way only clientmatches that dont exist in the export policy rules would be processed.

 

I haven't tested it yet but my an initial thought was to add a search command before you add the export policy rule using a variable named "clientmatch". If clientmatch is found based on the user input IP address then disable the command to add the export policy rule otherwise add it. EG:

 

 

SELECT
vserver.name AS 'policy.vserver.name',
cluster.primary_address AS 'policy.vserver.cluster.primary_address',
export_rule.clientmatch AS 'clientmatch',
export_rule.rule_index AS 'rule_index',
export_policy.name AS 'policy.name'
FROM
cm_storage.export_policy,
cm_storage.export_rule,
cm_storage.volume,
cm_storage.vserver,
cm_storage.cluster
WHERE
vserver.cluster_id = cluster.id
AND
volume.vserver_id = vserver.id
AND
export_policy.vserver_id = vserver.id
AND
volume.export_policy_id = export_policy.id
AND
export_rule.policy_id = export_policy.id
AND
export_rule.clientmatch = '${ClientMatch}'
AND
volume.name = '${VolumeName}'
AND
vserver.name = '${VserverName}'
AND (
cluster.primary_address = '${Cluster}' OR
cluster.name = '${Cluster}'
)

Please let me know if you think might meet your requirement?

 

/Matt

 

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

TABER_BRANDEN
2,611 Views

Thanks Matt. This sounds like it may work. I was afraid it would probably have to be after the user entry portion. I wanted to avoid having the workflow run at all if there were duplicates but it sounds like I probably won't be able to go that route.

 

I'll test out the method you provided soon and update back.

Public