hi folks
i need to put some conditional logic in a workflow. hopefully someone can show me a better way than i have devised...
here are the rules
- i'm creating a new NFS export.
- the export will be at the qtree level.
- i have two types of volumes "shared" and "unshared"
- if the new export is requested to be >1000GB, i will put the qtree into a "shared" volume
- if there is no existing shared volume, or if the existing volumes have no spare capacity, i will create a new "shared" volume
- if the new export is >=1000GB, i will always create a new "unshared" volume
- any new volumes will be named incrementally (eg if vol_shared_001 exists, next volume is vol_shared_002)
here is my FindChart right now:
in a previous FindChart i set the prefix for the volume name as follows:
theVolPrefix => 'pwl_' + (( $Size >= defaultNewSharedVolSizeGB ) ? '_unshared' : '_shared') + snapLabel
this means i should get a prefix like: "pwl_unshared_nosnap_" or "pwl_shared_nosnap_" or suchlike
the giveTrueIfValuesMatch finder basically does this:
- accept two values (in this case theVolPrefix and 'pwl_' + '_shared' + snapLabel )
- pass to a custom filter which does the following query: select ip from storage.array where '${value1}' = '${value2}' ;
...in other words i'm using a bogus sql query to act as an "if" compare.
the two Defines in the workflow set the same variable (newVolume) and differ only in the volume name.
(the first is nextNamePadded(previousVolume.name) , the second is theVolPrefix + '001' )
ideally i would work the logic so that i just set a string variable (e.g. newVolumeName)
i'm starting to this i might be able to work around the need to have multiple Defines (which would help for maintenance), but i can't work out how avoid an "IF" conditional around the size of the volume.
any thoughts or comments?