DionRow
Enthusiast
Enthusiast

Custom Resource not deploying Error 500

I was trying to make a simple custom resource in vra8.1 that does nothing except run a workflow and continue (just learning).

I keep getting this error:

Failed to get request status: 500 Internal Server Error from POST http://tango-vro-gateway.prelude.svc.cluster.local:8080/vro/blueprint/blueprint-provider-request?ope... (InternalServerError)

I see the vro workflow run and complete but still get the error.  The workflow takes in one string var and returns a string

Am I misunderstanding this?

IdeaS?

-- dion VMware Systems Admin vExpert VMUG Leader Saskatoon
8 Replies
lnairn
VMware Employee
VMware Employee

Hi,

Can you post the custom resource config in vRA?

Did you see https://www.funkycloudmedina.com/2020/05/vra-8.1-custom-resource-error-http-500-when-creating-ad-use... ? In that case the issue was related to a variable input.

Regards,

Leandro.

0 Kudos
DionRow
Enthusiast
Enthusiast

formatVersion: 1

inputs:

  hostname:

    type: string

    title: sourceFQDN

  domain:

    type: string

    title: domain

    enum:

      - example.com

      - example2.com

    default: example.com

  puppetRole:

    type: string

    title: Puppet Role

  NorthSouthRules:

    type: array

    title: North South Firewall Fules

    description: North South Firewall Fules to add for this machine

    items:

      type: object

      properties:

        key:

          type: string

          title: sourceFQDN

        value:

          type: string

          title: Protocol

        value2:

          type: string

          title: Port

resources:

  Custom_DionsTest_1:

    type: Custom.DionsTest

    properties:

      thevar: '${input.hostname}.${input.domain}'

the custom resource screen:

pastedImage_1.png

and the DionsTestCustomWorkflow in VRO:

pastedImage_2.png

I see the data come into the workflow and appear in the logs but after 4-5 minutes or so of the deployment just hanging like its still waiting for the workflow to return it fails with the 500 error:

Failed to get request status: 500 Internal Server Error from POST http://tango-vro-gateway.prelude.svc.cluster.local:8080/vro/blueprint/blueprint-provider-request?ope... (InternalServerError)

pastedImage_6.png

-- dion VMware Systems Admin vExpert VMUG Leader Saskatoon
0 Kudos
DionRow
Enthusiast
Enthusiast

I found out that you need to pass back a more complex plugin type that is understood by vro and is part of the Inventory tab.  This would include things like VC:VirtualMachine or VC:Folder etc.  Once I set this as the type it was on to the next problem.

Apparently you can use Dynamic Types as well and send and return those as well which I ultimately am wanting but have yet to get this successfully working.

dion

-- dion VMware Systems Admin vExpert VMUG Leader Saskatoon
0 Kudos
YordiDeRijcke
Contributor
Contributor

Hello

I am facing the same issue. If i understand correctly you cannot use a "simple" type like a string, etc. as External Type in the custom resource, it has to be a "complex" type like VC:VirtualMachine, etc?

I've been looking into the Dynamic Types as well but I'm continuing to search for a simpler way for what I'm trying to do. The stupid part is that I don't need a complex type. A string as external object is all I need...

Have you gotten any success with the Dynamic Types?

Regards, Yordi

EDIT: I assume the issue lies within the output of the create workflow of the custom resource, this should be the same as the external type if I understand correctly.

Therefore you cannot use a "simple" type as output of the create workflow if what I'm stating above is correct.

0 Kudos
YordiDeRijcke
Contributor
Contributor

In my case, i only needed to keep a string as object. Because it is not possible to use "simple" objects as external type in custom resources, i created a Dynamic Type.

It is necesairry to create the "get <dynamic type name> by ID" workflow, in my case it creates a dynamic type filling the id and name with the string i actually care about. It basically converts a string into a Dynamic Type. This dynamic type can then be used in vRA/vRO.

0 Kudos
mmonkman
Enthusiast
Enthusiast

Hello.  Could you provide the steps involved to get this working please?  I can't seem to find the workflow get <dynamic type name> by ID.

I have a custom resource that takes vm hostname as a string to do some rest operations to an external host during machine provisioning.  The workflow that executes during machine destroy takes the hostname string.  This results in the Error 500 as discussed.

The workaround I've used converts the hostname string to vmObject which is the output from the machine provisioning workflow.  This successfully feeds in to the machine destroy workflow and the hostname is extracted (vmObject.name).  Works great but feels a bit heavy duty if using dynamic type is lighter and simpler.

Thanks.

0 Kudos
YordiDeRijcke
Contributor
Contributor

Hello, i created a DynamicType and checked the "create workflow stubs" checkbox. This creates the "get <DynamicType Name> by ID" workflow. You have to define this yourself because it's empty by default.

I added "resultObj = DynamicTypesManager.makeObject('<DynamicType Namespace>', 'DynamicType Name', id, id);".

This creates a DynamicType object only containing the id and name which are both set to the 'id' value. This id value is the virtual machine name in my case. In the destroy workflow, i then get the vm name using:
"vmName = InputObject.getProperty('name');"

Once i have the VM name i can then retrieve the machine from vSphere.

mmonkman
Enthusiast
Enthusiast

got it.  Thank you for providing the detail!

0 Kudos