This comprehensive style guide establishes best practices and standards for writing JavaScript code in VMware vRealize Orchestrator versions up to 8.18.1. As vRO utilizes Mozilla Rhino 1.7R4 JavaScript engine and implements ECMAScript 5.1 with selected features from ES5.1+, this guide focuses exclusively on constructs supported in vRO 8.18.1, deliberately excluding ES6+ features available in vRO 9.0+ to maintain compatibility and consistency within enterprises running 8.x versions.
๐ฏ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TITLE | |
| Updating Various Certificates in Aria Automation Orchestrator | |
| ISSUE/INTRODUCTION | |
| Aria Automation Orchestrator utilizes several types of certificates for client communication, | |
| internal component communication (gRPC), and external integrations. | |
| If any of these certificates expire, it can cause critical issues. | |
| Since these certificates do not renew automatically, an expired certificate may lead to unexpected communication failures. | |
| ENVIRONMENT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* In VCF Automation 9.1 the Context Parameters - when used in vRO Actions in Custom forms | |
| are with 2 x "_" | |
| (and not 1 x "_" as mentioned in Aria Auto 8.18 Release Notes or KB as workaround). */ | |
| //Below references in case somebody needs it ๐: | |
| var projectId = System.getContext().getParameter("__projectId"); | |
| var orgId = System.getContext().getParameter("__orgId"); | |
| var requestedBy = System.getContext().getParameter("__requestedBy"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public SSLCertificateReportGenerator(arrUrl: string[]): void { | |
| let objDateToday: Date = new Date(); | |
| let intMillisecondsPerDay: number = 1000 * 60 * 60 * 24; | |
| let objRegExpCommonName: RegExp = /Common Name.*?:\s*(.*)/; | |
| let objRegExpValidity: RegExp = /Validity\s*:\s*\[From\s*:\s*(.*?)\s*To\s*:\s*(.*?)\]/; | |
| let objRegExpHTTPS: RegExp = /^https:\/\//i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <# | |
| .SYNOPSIS | |
| Monitors cloud-init provisioning progress on a remote VM over SSH. | |
| .DESCRIPTION | |
| 1. Polls TCP port 22 until SSH is reachable (up to -PortTimeoutSecs). | |
| 2. Requires -StabilityCount consecutive successful SSH connections before | |
| proceeding, ensuring sshd is fully initialised. | |
| 3. Streams /var/log/cloud-init-output.log in near real-time. | |
| 4. Polls 'cloud-init status' every -PollIntervalSecs until done or error. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Inputs: vraFqdn (String), username (String), password (SecureString), csvFile (MimeAttachment) | |
| */ | |
| // --- 1. GET TOKEN (Using your proven logic) --- | |
| function getAuthToken() { | |
| var restHost = RESTHostManager.createHost("dynamicRequest"); | |
| var httpRestHost = RESTHostManager.createTransientHostFrom(restHost); | |
| httpRestHost.url = "https://" + vraFqdn; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Handler($context, $inputs) { | |
| $target = if ($inputs.target) { $inputs.target } else { "google.com" } | |
| Write-Host "Pinging $target" | |
| $result = ping -c 3 $target 2>&1 | |
| $output = $result -join "`n" | |
| Write-Host $output | |
| $reachable = $output -notmatch "Name or service not known|Temporary failure in name resolution|100% packet loss" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ogignal KB -> https://knowledge.broadcom.com/external/article/345946/analyzing-health-status-of-aria-automati.html | |
| vracli status;sleep 5;vracli service status;sleep 5;vracli disk-mgr;sleep 5;kubectl get pods -n prelude;sleep 5;vracli ntp status;sleep 5;kubectl get nodes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Disclaimer: | |
| ## - This is an generic script provided and can be customized as ## per your requirement. | |
| ## - This script is provided for educational purposes only , ## ## please use at your own risk | |
| ## Add-PSSnapin VMware.VimAutomation.Core | |
| ## connect-viserver 127.0.0.1 -User Administrator | |
| write-host "" | |
| $diskCount = 0 | |
| do { | |
| $diskCount = [int](read-host "How Many Shared Disks shall I create for you? [1-55]") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| Script to fetch content from Aria Automation REST API and push to Git repository | |
| Saves both JSON and extracted content in same directories | |
| Adds subscription support | |
| Handles self-signed certificates for both API and Git | |
| """ | |
| import requests | |
| import json |
NewerOlder