Good source https://gist.github.com/rxaviers/7360908
| ℹ️ | Some text. |
|---|
| This is a warning. |
|---|
| from os import getenv | |
| from azure.cosmos import CosmosClient, PartitionKey | |
| import uuid | |
| AZ_DB_ENDPOINT = getenv('AZ_DB_ENDPOINT') | |
| AZ_DB_PRIMARYKEY = getenv('AZ_DB_PRIMARYKEY') | |
| DATABASE_NAME = 'Tasks' | |
| CONTAINER_NAME = 'Items' | |
| AZ_DB_CLIENT = CosmosClient(AZ_DB_ENDPOINT, AZ_DB_PRIMARYKEY) |
| provider "vsphere" { | |
| user = var.vsphere_user | |
| password = var.vsphere_password | |
| vsphere_server = var.vsphere_server | |
| allow_unverified_ssl = true | |
| } | |
| data "vsphere_datacenter" "dc" { | |
| name = var.datacenter | |
| } |
| 2020/01/20 14:48:01 [INFO] Terraform version: 0.12.18 | |
| 2020/01/20 14:48:01 [INFO] Go runtime version: go1.12.13 | |
| 2020/01/20 14:48:01 [INFO] CLI args: []string{"C:\\Program Files\\Terraform\\terraform.exe", "apply", "-auto-approve"} | |
| 2020/01/20 14:48:01 [DEBUG] Attempting to open CLI config file: C:\Users\a.fisamkosk3\AppData\Roaming\terraform.rc | |
| 2020/01/20 14:48:01 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
| 2020/01/20 14:48:01 [INFO] CLI command args: []string{"apply", "-auto-approve"} | |
| 2020/01/20 14:48:01 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config | |
| 2020/01/20 14:48:01 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory | |
| 2020/01/20 14:48:01 [DEBUG] New state was assigned lineage "6d8caa9e-e384-7950-d2f5-228f87ae78f4" | |
| 2020/01/20 14:48:01 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend) |
Good source https://gist.github.com/rxaviers/7360908
| ℹ️ | Some text. |
|---|
| This is a warning. |
|---|
Open VS Code and install this extension and follow the instructions how to authenticate and pull application from ServiceNow
Policy Rule Action Script (sn_cmp_pol_action_script) & Resource Pool Filter (sn_cmp_rp_filter) are custom file types which you need to explicitly import in your application. This can be done by adding the file config to the application & configuring the file to enable import and sync.
| import xml.etree.ElementTree as ET | |
| def indent(elem, level=0): | |
| i = "\n" + level*" " | |
| if len(elem): | |
| if not elem.text or not elem.text.strip(): | |
| elem.text = i + " " | |
| if not elem.tail or not elem.tail.strip(): | |
| elem.tail = i |
| $username = 'username' | |
| $password = 'password' | |
| $vcenter = 'localhost' | |
| $authURL = "https://$vcenter/rest/com/vmware/cis/session" | |
| $apiBaseURL = "https://$vcenter/rest/vcenter" | |
| $vmAPIURL = $apiBaseURL + '/vm' | |
| $ct = 'application/json' | |
| $sec = ConvertTo-SecureString -AsPlainText $Password -Force | |
| $creds = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, $sec |
| function onLoad() { | |
| var generatePassword = new GlideAjax('x_fstfs_fj_cmp.TfSCMPClientUtils'); | |
| function setPassword (password) { | |
| g_form.setValue('AWS_Windows_UserPassword', password); | |
| } | |
| generatePassword.addParam('sysparm_name', 'generateRandomPassword'); | |
| generatePassword.getXMLAnswer(setPassword); | |
| } |
| /** | |
| * Generate string from ascii range | |
| * @param {any} ranges - ASCII code | |
| * @param {number} charsCount | |
| * @param {string[]} allCharsTotal | |
| * @return {string} | |
| */ | |
| function generateChars(ranges, charsCount, allCharsTotal) { | |
| var allChars = []; | |
| var i; |
Developing and debugging MID server script include scripts, especially to CMP/Cloud Provisioning and Governance,
can be a little tricky and slow since your native logging is done with the ms.log() function
and you can't see the logs from the ServiceNow instance,
but instead you need to grab the logs from MID server.
Another problem is the script/function execution and context management (login to cloud provider, etc.).
Let's say you need to develop new REST API based functions (day 2 action, like change CPU and memory of a VM) to VMware. How would you develop and test your code?