Bits, Bytes, & Radio Waves

A quiet journey through discovery and understanding.

Delete Failed Aria Suite Lifecycle Requests

Overview

If you’ve worked with VMware Aria Suite Lifecycle long enough, you’ve probably seen it: an ever-growing wall of Failed requests cluttering the UI. Cleaning up one or two through the API is easy enough, but when the list grows into the dozens (or hundreds), manual deletion stops being practical. At that point, it’s far easier—and faster—to switch to the command line and automate the cleanup through the API. You don’t strictly need to run this from the appliance, but I like making it self-contained because in many environments, the appliance is the only machine guaranteed to be available.


The Script

Simply review the script below and then copy and paste into a file on the appliance, if running from there. The script can be run from anywhere, but I just added it to root‘s home directory.

import base64
import requests
import urllib3
urllib3.disable_warnings()

base_url = "https://fully.qualified.domain.name"
username = "admin@local"
password = "changeMe!"

# Build Basic Auth header
auth_string = base64.b64encode(f"{username}:{password}".encode()).decode()
headers = {
    "Authorization": f"Basic {auth_string}",
    "Accept": "application/json"
}

session = requests.Session()
session.verify = False
session.headers.update(headers)

# 1. Login
login_response = session.post(f"{base_url}/lcm/authzn/api/login")
login_response.raise_for_status()
print("Login:", login_response.text)

# 2. Get all requests
requests_response = session.get(f"{base_url}/lcm/request/api/requests")
requests_response.raise_for_status()
requests_list = requests_response.json()

print(f"Total requests: {len(requests_list)}")

# 3. Filter FAILED ones
failed_requests = [
    request
    for request in requests_list
    if request.get("state") == "FAILED"
]

if not failed_requests:
    print("No FAILED requests to delete.")
    exit()

print("FAILED requests:")
for request in failed_requests:
    print(f" - {request['vmid']}  {request['requestName']}")

# 4. Delete each FAILED request
for request in failed_requests:
    request_id = request["vmid"]
    print(f"Deleting {request_id}...")
    delete_response = session.delete(
        f"{base_url}/lcm/request/api/requests/{request_id}"
    )
    print(" ->", delete_response.status_code, delete_response.text)

This script logs in to the API, retrieves any Failed requests, and deletes them if they’re found. If no failed requests exist, the script simply reports that and exits.

Note: The misspelling in the login message comes from the appliance itself, not from the script.

Login: Login succeessfully
Total requests: 151
No FAILED requests to delete.

Leave a Reply

Your email address will not be published. Required fields are marked *