cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1435
Views
0
Helpful
5
Replies
Highlighted
Beginner

VCO UCS Plugin - Get Service Profile - spList

Get Service Profile produces an spList array of type UCSM:ServiceProfile how do I use this output as an input to something like Disassociate Service Profile for a single element in the array.

Ideal:

1. Get service profile of 2 blades

2. Pipe ESX Hostname into a "Enter Maint. Mode" workflow in vCenter

3. Pipe service profile names from step 1 into a disassociate service profile workflow.

4. Associate new service profiles

5. etc.

I cant simply get the Service profile from the array into an input for the next element in the WF.

How do I convert the array spList to an input?

Everyone's tags (3)
5 REPLIES 5
Enthusiast

Re: VCO UCS Plugin - Get Service Profile - spList

I'm not exactly sure of the specifics of your environment, so the logic could change, but there are a number of ways to get to the information.

$svcProfile = Get-UcsServiceProfile will return all service profiles in your environment.  If you only have two, you could reference the individual results as $svcProfile[0].Name and $svcProfile[1].Name to get the name of each service profile.  If you need to perform more testing to determine the specific names you want, such as selecting  specific rack, you could put it into a loop:

Foreach ($sp in $svcProfile) { ...}  where the content within the {} can reference the individual values of $sp.Name for service profile name and $sp.PnDn for rack unit and so on.

To see all the elements you can reference you can issue the first cmdlet above and then issue $svcProfile[0] to display the elements in the first table item.

Beginner

Re: VCO UCS Plugin - Get Service Profile - spList

Thanks, that seems to work in .ps1 or powertools but I can’t seem to translate that to Javascript or the built in VCO workflows.

Do you know how to call the $svcProfile[0].Name from the spList array that is created from the “Get Service Profile” workflow that produces the spList UCSM:Service Profile array?

I can get the “get service profile” workflow to just populate the 2 service profiles I need in the array. I just don’t know how to get that info out of the array for the next workflow as an input.

Daniel Edwards

Practice Manager – Cloud Solutions, MCITP, VCP, DCUCI

T: 201-426-9351 | C: 201-566-6883 | F: 201-931-0101

Daniel.Edwards@cdillc.com<mailto:daniel.edwards@cdillc.com> | www.cdillc.com<http://www.cdillc.com/>

Beginner

Re: VCO UCS Plugin - Get Service Profile - spList

Hi Daniel,

There are two ways in which you can do this task.

  1. Use Foreach element in your workflow.
  2. Write your own javascript in scriptable task.

Before going forward, let me explain how many kind variables VCO have.

Variables in workflow:-

  • Input Variables:- These variables take inputs from the user.
  • Output Variables:- These variables carry values/data outside of the workflow.
  • Attributes/Local Variables:- These variables have no visibility outside workflow, and can be used to store values/data temporarily within a workflow for inter task/action communication.

Variables in actions:-

  • Input Variables:- These are not workflow inputs. These inputs are requested by action/task, and can be mapped to Input Variables of workflow or Attributes of workflow.
  • Output Variables:- These are not workflow outputs. These outputs are produced by action/task, and can be mapped to Output Variables of workflow or Attributes of Workflow.

Now let me explain how you will be using arrays in workflows.

Here the issue is that one task produces an array of service profile, but the other task accepts only single service profile.

I will show steps to user Foreach element. I think that will be the best solution for your case.

Step 1. Create a new workflow, and drag-drop "Get Service Profile" workflow. You can use getServiceProfile action as well. Store spList in a local variable.

wf1.png

Step 2. Drag-drop Foreach element, a pop-up will ask for the workflow on which you want to run this Foreach element. Select the desired workflow.

wf2.png

Step 3. Inputs of the Foreach element will be the same as the selected workflow, but they will have the option of looping around. Select spList from the drop down and click promote.

wf3.png

That's it. Your workflow is ready. Foreach element will take elements from spList and pass it on to selected workflow one by one.

Please let me know if you face any issue in this.

Best Regards,

Sumit Tyagi

Beginner

Re: VCO UCS Plugin - Get Service Profile - spList

If you want to use scriptable task, then you can simply drag and drop scriptable task instead of Foreach element. You can create any number of inputs or outputs for scriptable task, that can be mapped to attributes/inputs/outputs of the workflow.

after that you can simple say:- attributeName = spList[0];

Now this attributeName can be used as input to the Disassociate Service Profile workflow.

Best Regards,

Sumit Tyagi

Beginner

Re: VCO UCS Plugin - Get Service Profile - spList

Amazing! Thank you. This is exactly what I needed explained to me. Big learning curve here. Ive been playing around and with this feedback I am confident it will work. Ill follow up with the exact layout and scripts when it works for other ls to reference in the future.

Sent from my iPhone

CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards
This widget could not be displayed.