VMware Cloud Community
Sasidhar1234
Enthusiast
Enthusiast

Passing CSV input file type for XaaS catalog in vRA 8.x

Hi All,

 

I have a requirement to tag / de-tag list of VMs in vCenter. Created a CSV input file type with columns needed for tagging/detagging. However, the CSV file type is not a supported input file type in order to create XaaS catalog in vRA 8.7.

The workflow reads/interprets the CSV data each row, passes the searches for VM name in vCenter SDKs and uses "add VM tag"/"Remove VM tag" action elements.

Please suggest if there is any alternative I can choose instead of CSV file type in order to pass Tag values for list of VMs(more than 100).

Regards,

Sasidhar

Reply
0 Kudos
7 Replies
eoinbyrne
Expert
Expert

Hi

You could use a TextArea input which supports multi-line input. I'm guessing that your workflow uses a String.split(',') call to turn each CSV into an array so this would work

I can't recall what the input length limit for a TextArea is but it should be in order of Kb IIRC

Alternatively, the Datagrid might work but it depends on how you're handling ADD vs REMOVE tags (operations embedded in text? e.g.,

<VMNAME>,ADD:<Tagname 1>,REMOVE:<Tagname 2>

 

etc?

 

 

xian_
Expert
Expert

Since vRA 8.8 you can upload files up to 1MB via XaaS custom forms: vRA 8.8 Release Notes

Create a WF with input type MimeAttachment:

xian__0-1675370135169.png

In a scriptable task process the file contents. Here is a sample to print the rows one by one:

var rows = csv.content.split("\n");
for (i in rows) {
  System.log(i + ". " + rows[i]);
}

Add the WF to your XaaS content source.

Request the catalog item:

xian__1-1675370347511.png

WF logs:

xian__2-1675370407417.png

HTH

Sasidhar1234
Enthusiast
Enthusiast

Thanks for your inputs, am using the CSV input file as per below snippets. Each row is having VMname, Cluster, removal tags, addition tags and date details. Can I copy paste the same content of CSV into text area and change the inFile type from MimeAttachment to Text Area? Any additional changes are needed here..Thanks in advance..

Sasidhar1234_0-1675473661520.png

 

Sasidhar1234_1-1675474060437.png

 

 

 

Reply
0 Kudos
Sasidhar1234
Enthusiast
Enthusiast

Thanks for your reply. We have received the same response from VMware support to upgrade to 8.8, as of now, we do not have plans to upgrade, hence looking for alternative options to provide XaaS catalog access to users in vRA 8.7.  

Reply
0 Kudos
xian_
Expert
Expert

8.7 is end of support on 2023-03-22 so you should upgrade soon, anyway.

If you use a string input called csv, use this code:

var rows = csv.split("\n");

Sasidhar1234
Enthusiast
Enthusiast

Thanks again!!

Until we upgrade to 8.8, I need an alternative solution passing the row data instead of a CSV file. I would request you to provide the details of using the text area with a sample code on how to use multiple rows of data . 

Reply
0 Kudos
xian_
Expert
Expert

See in my previous reply.

Reply
0 Kudos