DeployJob - addOneTimeScheduleWithEMailNotificationAndWithApproval
DeployJob - addOneTimeScheduleWithEMailNotificationAndWithApproval
Description :
This command adds a one-time schedule to a Deploy Job with approval. If this Deploy Job already had a schedule, this command replaces the old schedule with the schedule you are adding now with approval. It will execute on schedule only if the approval request is approved or else it will expire after some time and closes the change ticket created through the approval system
Depending on the resulting status of the job run, this command can issue an email notification.
The argument jobKey provides a handle to the job being modified. To find the jobKey, use the getDBKeyByGroupAndName command.
The dateString argument defines a one-time schedule to be added. It must be in the format YYYY-MM-DD HH:MM:SS.
The argument recipient is the email receiver, and the statusType argument determines the statuses for which you want to issue a notification. The possible statuses each have a value as follows:
- Success=2
- Failure=4
- Cancel=8
For statusType, add the values representing the statuses for which you want to issue notifications. For example, if you want to issue notifications when the job status is Failure or Cancel, then statusType=12.
Return type : DBKey
Command Input :
Variable Name | Variable Type | Description |
---|---|---|
jobKey | com.bladelogic.om.infra.model.base.keys.SJobKey | Handle to the job. |
dateString | String | One-time schedule to be added. The date string must be in the format YYYY-MM-DD HH:MM:SS. |
recipient | String | Receiver of the email. |
statusType | Integer | Sum of all statuses for which you want to issue notification. For more detailed information, see the description above. |
approvalId | Integer | Approval ID to be attached to the job. |
Example
The following example shows how to add a schedule for a single Deploy Job run on the 1st of January 2005 day at 11:35 PM. An email will be generated on success, failure, or cancel.
Script
RECIPIENT="datacenteradmin@anundisclosedcompany.com"
NOTIFICATION_STATUS=14
DATE_STRING="2005-01-01 23:35:00"
JOB_KEY=`blcli DeployJob [getDBKeyByGroupAndName|DeployJob - getDBKeyByGroupAndName] /deploys deployconfig`
JOB_APPROVAL_ID=`blcli Job createApproval 2 2 "My change" 2 3 "" ""`
JOB_KEY=`blcli DeployJob [addOneTimeScheduleWithEMailNotificationAndWithApproval|DeployJob - addOneTimeScheduleWithEMailNotificationAndWithApproval] $JOB_KEY "$DATE_STRING" $RECIPIENT $NOTIFICATION_STATUS $JOB_APPROVAL_ID`