Deploying Aria Automation? Fix a failed deployment with a day 2 operation and API call

Instant Auto-Removal of Failed Aria Automation Deployments

In a recent project, I was tasked with creating an instant auto-removal feature for failed Aria Automation deployments using a custom day 2 operation in the Aria Automation Deployment API. Specifically, we wanted to execute the deployment resource “delete” action every time a deployment fails, and use an Extensibility subscription to be automatically triggered if the status of the deployment is “FAILED” and the event type equals “CREATE_DEPLOYMENT”.

To achieve this, we used Aria Orchestrator to create a custom action. The actual implementation consisted of the following steps:

1. Create a new workflow for the Extensibility subscription, e.g. name it “Delete Deployment”.

2. Create a new input parameter named “inputProperties” with a type of “Properties”. This input parameter will be used to pass the deployment ID and other properties as needed.

3. Inside the workflow, create a scriptable task with the following JavaScript code:

“`javascript

var vraHostVcoEndpoint = getVraHostVcoEndpoint();

var requestBody = {

“actionId”: “Deployment.Delete”,

“inputProperties”: {

“deploymentId”: “

}

};

var request = new Request(vraHostVcoEndpoint + “/deployment/api/requests”, null, “POST”, requestBody);

request.setAsync(true);

request.send();

“`

In this code, we first determine the Aria Automation endpoint in the Orchestrator environment using the `getVraHostVcoEndpoint` action. Since we are in a lab environment, we use the default on-premises endpoint. Then, we create a `Request` object with the endpoint, HTTP method (`POST`), and request body. Finally, we set the asynchronous flag to `true` and send the request.

4. To trigger the workflow every time a Aria Automation deployment fails, we create an Extensibility subscription as follows:

“`json

{

“extensibilitySubscription”: {

“displayName”: “Delete Deployment”,

“description”: “Deletes a failed deployment”,

“eventTypes”: [“CREATE_DEPLOYMENT”],

“action”: {

“actionId”: “Delete Deployment”,

“inputProperties”: [“deploymentId”]

},

“filters”: [

{

“filterType”: “AND”,

“filters”: [

{

“filterType”: “EQUALS”,

“property”: “status”,

“value”: “FAILED”

},

{

“filterType”: “EQUALS”,

“property”: “eventType”,

“value”: “CREATE_DEPLOYMENT”

}

]

}

]

}

}

“`

In this subscription, we specify the display name, description, event types, and action. We also define filters to apply to the event, such as status equal to “FAILED” and event type equal to “CREATE_DEPLOYMENT”.

With these steps completed, every time a Aria Automation deployment fails, the custom workflow will be triggered automatically to execute the deployment resource “delete” action. To limit it to a given cloud template, we could use an additional “event.data.blueprintId” condition which specifies the corresponding Cloud template Id.

In conclusion, this feature allows for instant auto-removal of failed Aria Automation deployments using a custom day 2 operation in the Aria Automation Deployment API. By leveraging an Extensibility subscription and the `getVraHostVcoEndpoint` action, we can automatically trigger the workflow every time a deployment fails, and limit it to a given cloud template if necessary.

Leave a Reply