Active IQ Unified Manager Discussions

Truncating variable names

keitha

I want to leverage the volume name provided by the customer to build a qtree inside the volume. I can see how to concatenate one variable name into another but I can't think how to truncate one. For example say the user provides the $volume = MyNewVol_Prod

and want to create a Qtree called "MyNewVol_Qtree". That is, truncate part of the volume name to create the QTree name...

1 ACCEPTED SOLUTION

goodrum

There is an included function called splitByDelimeter.  This will give you the ability to parse the volume name and then return the part that you want.  In the example that you gave it would be: splitByDelimeter($VolumeName,"_",0)

Alternately, you could devise a VolumePrefix method and have that as a separate variable which would be combined with a type.  I use this method to ensure naming conventions are adhered to when provisioning for applications.  For example, if I am provisioning a data volume then the volumePrefix might be "goodrum_application" but the actual volume name is "goodrum_application_data" ($volumePrefix + "_data").  Using this method would allow you to create a Qtree named "goodrum_application_qtree" ($volumePrefix + "_qtree")

Jeremy Goodrum, NetApp

The Pirate

Twitter: @virtpirate

Blog: www.virtpirate.com

View solution in original post

2 REPLIES 2

goodrum

There is an included function called splitByDelimeter.  This will give you the ability to parse the volume name and then return the part that you want.  In the example that you gave it would be: splitByDelimeter($VolumeName,"_",0)

Alternately, you could devise a VolumePrefix method and have that as a separate variable which would be combined with a type.  I use this method to ensure naming conventions are adhered to when provisioning for applications.  For example, if I am provisioning a data volume then the volumePrefix might be "goodrum_application" but the actual volume name is "goodrum_application_data" ($volumePrefix + "_data").  Using this method would allow you to create a Qtree named "goodrum_application_qtree" ($volumePrefix + "_qtree")

Jeremy Goodrum, NetApp

The Pirate

Twitter: @virtpirate

Blog: www.virtpirate.com

View solution in original post

keitha

Awesome...Wow that was easy...

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.

NetApp Insights to Action
I2A Banner
Public