diff --git a/content/automate/ManageIQ/System/CommonMethods/StateMachineMethods.class/transformation_plan_vm_finished.yaml b/content/automate/ManageIQ/System/CommonMethods/StateMachineMethods.class/transformation_plan_vm_finished.yaml new file mode 100644 index 000000000..1b25d3956 --- /dev/null +++ b/content/automate/ManageIQ/System/CommonMethods/StateMachineMethods.class/transformation_plan_vm_finished.yaml @@ -0,0 +1,13 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: transformation_plan_vm_finished + inherits: + description: + fields: + - execute: + value: task_finished(object => 'service_template_transformation_plan_task', + message => 'VM Migrated Successfully' ) diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplancomplete.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplancomplete.yaml new file mode 100644 index 000000000..91d657737 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplancomplete.yaml @@ -0,0 +1,16 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanComplete + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email}" + - sendmail: + value: "#stop_email" diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverapproved.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverapproved.yaml new file mode 100644 index 000000000..ad78d6946 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverapproved.yaml @@ -0,0 +1,22 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestApproverApproved + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email}" + - subject: + value: Request ID ${/#miq_request.id} - Transformation Plan Request received + from ${/#miq_request.requester.email} was Approved. + - body: + value: 'Approver,

Transformation Plan Request received from ${/#miq_request.requester.email} + was Approved.

Approvers reason: ${/#miq_request.reason}

To view + this Request go to: http://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you,
${#signature}' diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverdenied.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverdenied.yaml new file mode 100644 index 000000000..2e48e6f72 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverdenied.yaml @@ -0,0 +1,22 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestApproverDenied + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email}" + - subject: + value: Request ID ${/#miq_request.id} - Transformation Plan Request from <${/#miq_request.requester.email}> + was Denied. + - body: + value: 'Approver,

A Transformation Plan Request received from ${/#miq_request.requester.email} + was Denied.

Approvers notes: ${/#miq_request.reason}

For more + information you can go to: http://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you
${#signature}' diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverpending.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverpending.yaml new file mode 100644 index 000000000..6e94b1da8 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestapproverpending.yaml @@ -0,0 +1,21 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestApproverPending + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email}" + - subject: + value: Request ID ${/#miq_request.id} - Transformation Plan Request from <${/#miq_request.requester.email}> + is Pending Approval. + - body: + value: 'Approver,

A Transformation Plan Request received from ${/#miq_request.requester.email} + is Pending.

For more information you can go to: http://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you
${#signature}' diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterapproved.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterapproved.yaml new file mode 100644 index 000000000..1d2ee5ea4 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterapproved.yaml @@ -0,0 +1,24 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestRequesterApproved + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email} + \ " + - subject: + value: Request ID ${/#miq_request.id} - Your Transformation Plan Request was + Approved, pending Quota Validation. + - body: + value: 'Hello,

Your Transformation Plan Request was Approved. If Service + provisioning is successful you will be notified via email when the Service + is available.

Approvers notes: ${/#miq_request.reason}

To view + this Request go to: https://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you,
${#signature}' diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterdenied.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterdenied.yaml new file mode 100644 index 000000000..8a36fc1a6 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterdenied.yaml @@ -0,0 +1,22 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestRequesterDenied + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email} " + - subject: + value: Request ID ${/#miq_request.id} - Your Transformation Plan Request was + Denied. + - body: + value: 'Hello,

Your Transformation Plan Request was Denied.

Approvers + notes: ${/#miq_request.reason}

For more information you can go to: + http://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you
${#signature}' diff --git a/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterpending.yaml b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterpending.yaml new file mode 100644 index 000000000..760a923e9 --- /dev/null +++ b/content/automate/ManageIQ/System/Notification/Email.class/transformationplanrequestrequesterpending.yaml @@ -0,0 +1,22 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: TransformationPlanRequestRequesterPending + inherits: + description: + fields: + - owner: + value: "${/#miq_request.requester}" + - to: + value: "${/#miq_request.get_option(:owner_email)} || ${/#miq_request.requester.email} " + - subject: + value: Request ID ${/#miq_request.id} - Your Transformation Plan Request is + Pending Approval. + - body: + value: 'Hello,

Please review your Transformation Plan Request and wait + for approval from an Administrator.

To view this Request go to: http://${/#miq_server.ipaddress}:3000/miq_request/show/${/#miq_request.id}

+ Thank you
${#signature}' diff --git a/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_approved.yaml b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_approved.yaml new file mode 100644 index 000000000..72d38728c --- /dev/null +++ b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_approved.yaml @@ -0,0 +1,14 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: ServiceTemplateTransformationPlanRequest_approved + inherits: + description: + fields: + - rel5: + value: "/System/Notification/Email/TransformationPlanRequestRequesterApproved " + - rel6: + value: "/System/Notification/Email/TransformationPlanRequestApproverApproved " diff --git a/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_created.yaml b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_created.yaml new file mode 100644 index 000000000..6f6961d65 --- /dev/null +++ b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_created.yaml @@ -0,0 +1,14 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: ServiceTemplateTransformationPlanRequest_created + inherits: + description: + fields: + - guard: + value: "${/#miq_request.process}" + - rel6: + value: "/Transformation/StateMachines/TransformationPlanRequestApproval/Default" diff --git a/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_denied.yaml b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_denied.yaml new file mode 100644 index 000000000..d7c1a00fa --- /dev/null +++ b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_denied.yaml @@ -0,0 +1,14 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: ServiceTemplateTransformationPlanRequest_denied + inherits: + description: + fields: + - rel5: + value: "/System/Notification/Email/TransformationPlanRequestRequesterDenied" + - rel6: + value: "/System/Notification/Email/TransformationPlanRequestApproverDenied" diff --git a/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_pending.yaml b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_pending.yaml new file mode 100644 index 000000000..14598141a --- /dev/null +++ b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_pending.yaml @@ -0,0 +1,14 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: ServiceTemplateTransformationPlanRequest_pending + inherits: + description: + fields: + - rel5: + value: "/System/Notification/Email/TransformationPlanRequestRequesterPending" + - rel6: + value: "/System/Notification/Email/TransformationPlanRequestApproverPending" diff --git a/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_starting.yaml b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_starting.yaml new file mode 100644 index 000000000..f13915ff3 --- /dev/null +++ b/content/automate/ManageIQ/System/Policy.class/servicetemplatetransformationplanrequest_starting.yaml @@ -0,0 +1,10 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: ServiceTemplateTransformationPlanRequest_starting + inherits: + description: + fields: [] diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__class__.yaml b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__class__.yaml new file mode 100644 index 000000000..967fbabca --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__class__.yaml @@ -0,0 +1,73 @@ +--- +object_type: class +version: 1.0 +object: + attributes: + description: + display_name: + name: TransformationPlanRequestApproval + type: + inherits: + visibility: + owner: + schema: + - field: + aetype: attribute + name: approval_type + display_name: + datatype: string + priority: 1 + owner: + default_value: auto + substitute: true + message: create + visibility: + collect: + scope: + description: + condition: + on_entry: + on_exit: + on_error: + max_retries: + max_time: + - field: + aetype: state + name: ValidateRequest + display_name: + datatype: string + priority: 2 + owner: + default_value: + substitute: true + message: create + visibility: + collect: + scope: + description: + condition: + on_entry: validate_request + on_exit: + on_error: pending_request + max_retries: '100' + max_time: + - field: + aetype: state + name: ApproveRequest + display_name: + datatype: string + priority: 3 + owner: + default_value: + substitute: true + message: create + visibility: + collect: + scope: + description: + condition: + on_entry: approve_request + on_exit: + on_error: pending_request + max_retries: '100' + max_time: diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.rb b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.rb new file mode 100644 index 000000000..313b0bf56 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.rb @@ -0,0 +1,14 @@ +# +# Description: This method is executed when the provisioning request is auto-approved +# + +# Auto-Approve request +$evm.log("info", "Checking for auto_approval") +approval_type = $evm.object['approval_type'].downcase +if approval_type == 'auto' + $evm.log("info", "AUTO-APPROVING") + $evm.root["miq_request"].approve("admin", "Auto-Approved") +else + $evm.log("info", "Not Auto-Approved") + exit MIQ_ABORT +end diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.yaml b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.yaml new file mode 100644 index 000000000..396f27a1d --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/approve_request.yaml @@ -0,0 +1,13 @@ +--- +object_type: method +version: 1.0 +object: + attributes: + name: approve_request + display_name: + description: + scope: instance + language: ruby + location: inline + options: {} + inputs: [] diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.rb b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.rb new file mode 100644 index 000000000..39216e759 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.rb @@ -0,0 +1,10 @@ +# +# Description: This method is executed when the provisioning request is NOT auto-approved +# + +# Get objects +msg = $evm.object['reason'] +$evm.log('info', msg.to_s) + +# Raise automation event: request_pending +$evm.root["miq_request"].pending diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.yaml b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.yaml new file mode 100644 index 000000000..443cf2034 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/pending_request.yaml @@ -0,0 +1,13 @@ +--- +object_type: method +version: 1.0 +object: + attributes: + name: pending_request + display_name: + description: + scope: instance + language: ruby + location: inline + options: {} + inputs: [] diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.rb b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.rb new file mode 100644 index 000000000..e1aa686d4 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.rb @@ -0,0 +1,5 @@ +# +# Description: Placeholder for service request validation +# +prov = $evm.root['miq_request'] +prov.source_vms.each { |vm| prov.approve_vm(vm) if prov.validate_vm(vm) } diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.yaml b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.yaml new file mode 100644 index 000000000..8658660a4 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/__methods__/validate_request.yaml @@ -0,0 +1,13 @@ +--- +object_type: method +version: 1.0 +object: + attributes: + name: validate_request + display_name: + description: + scope: instance + language: ruby + location: inline + options: {} + inputs: [] diff --git a/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/default.yaml b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/default.yaml new file mode 100644 index 000000000..684ad00c5 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/TransformationPlanRequestApproval.class/default.yaml @@ -0,0 +1,12 @@ +--- +object_type: instance +version: 1.0 +object: + attributes: + display_name: + name: Default + inherits: + description: + fields: + - approval_type: + value: auto diff --git a/content/automate/ManageIQ/Transformation/StateMachines/__namespace__.yaml b/content/automate/ManageIQ/Transformation/StateMachines/__namespace__.yaml new file mode 100644 index 000000000..5ce1866e7 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/StateMachines/__namespace__.yaml @@ -0,0 +1,10 @@ +--- +object_type: namespace +version: 1.0 +object: + attributes: + name: StateMachines + description: + display_name: + priority: + enabled: diff --git a/content/automate/ManageIQ/Transformation/TransformationHosts/StateMachines/__namespace__.yaml b/content/automate/ManageIQ/Transformation/TransformationHosts/StateMachines/__namespace__.yaml new file mode 100644 index 000000000..5ce1866e7 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/TransformationHosts/StateMachines/__namespace__.yaml @@ -0,0 +1,10 @@ +--- +object_type: namespace +version: 1.0 +object: + attributes: + name: StateMachines + description: + display_name: + priority: + enabled: diff --git a/content/automate/ManageIQ/Transformation/TransformationHosts/__namespace__.yaml b/content/automate/ManageIQ/Transformation/TransformationHosts/__namespace__.yaml new file mode 100644 index 000000000..2f851b84c --- /dev/null +++ b/content/automate/ManageIQ/Transformation/TransformationHosts/__namespace__.yaml @@ -0,0 +1,10 @@ +--- +object_type: namespace +version: 1.0 +object: + attributes: + name: TransformationHosts + description: + display_name: + priority: + enabled: diff --git a/content/automate/ManageIQ/Transformation/__namespace__.yaml b/content/automate/ManageIQ/Transformation/__namespace__.yaml new file mode 100644 index 000000000..7ca193b78 --- /dev/null +++ b/content/automate/ManageIQ/Transformation/__namespace__.yaml @@ -0,0 +1,10 @@ +--- +object_type: namespace +version: 1.0 +object: + attributes: + name: Transformation + description: + display_name: + priority: + enabled: