Task Name | In UCSD the VM credentials for a user can be auto generated. This examples uses root, but it could be any other user. The credentials are accessible by the end user via a pop up screen. This task will retrieve the auto generated password and make it available in a workflow for further processing (ssh / custom e-mail to user). |
Description | |
Prerequisites | Minimum UCSD version: 5.4.0.2 |
Category | Custom task |
Components |
|
User Inputs | |
User Output | |
Instructions for Regular Workflow Use:
Instructions for Regular Workflow Use:
- Download the attached .ZIP file below to your computer. *Remember the location of the saved file on your computer.
- Unzip the file on your computer. Should end up with a .WFD file.
- Log in to UCS Director as a user that has "system-admin" privileges.
- Navigate to "Policies-->Orchestration" and click on "Import".
- Click "Browse" and navigate to the location on your computer where the .WFD file resides. Choose the .WFD file and click "Open".
- Click "Upload" and then "OK" once the file upload is completed. Then click "Next".
- Click the "Select" button next to "Import Workflows". Click the "Check All" button to check all checkboxes and then the "Select" button.
- Click "Submit".
- A new folder should appear in "Policies-->Orchestration" that contains the imported workflow. You will now need to update the included tasks with information about the specific environment.
A thank you goes out to: Logesh Kandasamy and Shankar Varanasy
The catalog setting for the credentials (Template password):
The end user access:
The password auto generated password:
The workflow:
The workflow execution:
The custom task:
importPackage(com.cloupia.model.cIM);
importPackage(com.cloupia.service.cIM.inframgr);
//var vpw = VMUserData(input.vmId);
//var pwd1 = vpw.getCustomPassword();
var vpw = VMViewUtils.getVMUserData(input.vmId);
var pwd1 = vpw.getCustomPassword();
var pwd2 = vpw.getTemplatePassword();
var user1 = vpw.getCustomUser();
//
// comment out below lines in production code
//
logger.addWarning("Comment out below logger lines in production code");
logger.addInfo("Password 1 for the VM "+input.vmId+" is : "+pwd1);
logger.addInfo("Password 1 for the VM "+input.vmId+" is : "+pwd2);
logger.addInfo("User 1 for the VM "+input.vmId+" is : "+user1);
logger.addWarning("Comment out above logger lines in production code");
//
// comment above below lines in production code
//
output.vmPassword1 = pwd1;
output.vmPassword2 = pwd2;
output.User1 = user1;
The SQL from a SQL trace helping me trace down the library call:
SELECT 'com.cloupia.model.cIM.VMUserData' AS NUCLEUS_TYPE,`A0`.`ACTIVEVMAPPCOST`,`A0`.`APPCATEGORYID`,`A0`.`CATALOGID`,`A0`.`CHARGEFREQUENCY`,`A0`.`COMMENTS`,`A0`.`COSTMODELID`,`A0`.`CREDENTIALSHARE`,`A0`.`CUSTOMPASSWORD`,`A0`.`CUSTOMUSER`,`A0`.`DELETEVMTASKEXECOUNT`,`A0`.`DELETIONTIME`,`A0`.`DELIVEREDDELETEMSGCOUNT`,`A0`.`DELIVEREDLEASEMSGCOUNT`,`A0`.`GROUPID`,`A0`.`INACTIVEVMAPPCOST`,`A0`.`KEYNAME`,`A0`.`LEASEEXPTASKEXECOUNT`,`A0`.`OLDVDCID`,`A0`.`OS`,`A0`.`OTHERAPPS`,`A0`.`OTHEROS`,`A0`.`PROVISIONEDTIME`,`A0`.`RESOURCEUSERNAME`,`A0`.`SCHEDULEDTERMINATIONTIME`,`A0`.`SERVICEREQUESTID`,`A0`.`SLAPOLICYID`,`A0`.`TEMPLATEPASSWORD`,`A0`.`TEMPLATEUSER`,`A0`.`USERLABEL`,`A0`.`VMAPPCOSTCHARGEFREQUENCY`,`A0`.`VDCID`,`A0`.`VMID`,`A0`.`VMNAMEINCONTAINER`,`A0`.`VMROLEINCONTAINER`,`A0`.`VMUSERDATA_ID` FROM `VMUSERDATA` `A0` WHERE `A0`.`VMID` = 1945
In the custom task the DOC button can be activated and deliver the java documents:
The VM View Utils:
The get VM user data:
The options for the library call:
There is also an API call as an alternative:
The API call with VM id:
The API execution:
The password is jammed (possible way to un jam it):
> importPackage(com.cloupia.lib.util);
> var str = "SDlnbncwUXQ=“;
> var str2 = Base64Coder.decodeString(str);
> str2; H9gnw0Qt