Refactor std.email action in examples

Related to https://review.openstack.org/#/c/134488/

Change-Id: If4c1f9e86cefcce4a918175fb1eb146d8cd8d361
This commit is contained in:
Nikolay Mahotkin 2014-11-14 13:26:53 +03:00
parent 79e7215e7e
commit 5373066623
4 changed files with 55 additions and 64 deletions

View File

@ -149,34 +149,30 @@ Workflow:
sendResultEmail:
action: std.email
parameters:
params:
to: [$.admin_email]
subject: Workflow result
body: |
Workflow result of execution {$.__execution.id} is {$.result}
from_addr: $.from_email
to_addrs: [$.admin_email]
subject: Workflow result
body: |
Workflow result of execution {$.__execution.id} is {$.result}
-- Thanks, Mistral Team.
settings:
smtp_server: $.smtp_server
from: $.from_email
password: $.smtp_password
-- Thanks, Mistral Team.
smtp_server: $.smtp_server
smtp_password: $.smtp_password
on-finish: deleteVM
# In case of createVM error send e-mail with error message.
sendCreateVMError:
action: std.email
parameters:
params:
to: [$.admin_email]
subject: Workflow error
body: |
Failed to create a VM in execution {$.__execution.id}
from_addr: $.from_email
to_addrs: [$.admin_email]
subject: Workflow error
body: |
Failed to create a VM in execution {$.__execution.id}
-- Thanks, Mistral Team.
settings:
smtp_server: $.smtp_server
from: $.from_email
password: $.smtp_password
-- Thanks, Mistral Team.
smtp_server: $.smtp_server
smtp_password: $.smtp_password
on-finish: deleteVM
# Destroy the VM (request to Nova).

View File

@ -38,17 +38,18 @@ Workflow:
requires: [backup_service_data, backup_user_data]
action: std.email
parameters:
# Use password if smtpd requires TLS authentication (password: None).
params:
to: [mistral@example.com, boss@example.com]
subject: Backup complete
body: |
Congratulations, the backup is complete
from_addr: mistral@example.com
to_addrs: [mistral@example.com, boss@example.com]
subject: Backup complete
body: |
Congratulations, the backup is complete
-- Thanks, Mistral Team.
settings:
smtp_server: localhost:10025
from: mistral@example.com
-- Thanks, Mistral Team.
-- Thanks, Mistral Team.
smtp_server: localhost:10025
# Use password if smtpd requires TLS authentication (password: None).
smtp_password: null
execute_backup:
requires: [backup_user_data, backup_service_data, send_email]

View File

@ -87,17 +87,15 @@ workflows:
description: In case of createVM error send e-mail with error message.
action: std.email
input:
params:
to: [$.to_email]
subject: Workflow result
body: |
Workflow result of execution {$.__execution.id} is {$.result}
from_addr: $.from_email
to_addrs: [$.to_email]
subject: Workflow result
body: |
Workflow result of execution {$.__execution.id} is {$.result}
-- Thanks, Mistral Team.
settings:
smtp_server: $.smtp_server
from: $.from_email
password: $.smtp_password
-- Thanks, Mistral Team.
smtp_server: $.smtp_server
smtp_password: $.smtp_password
on-complete:
- delete_vm
@ -105,18 +103,16 @@ workflows:
description: In case of createVM error send e-mail with error message.
action: std.email
input:
params:
to: [$.to_email]
subject: Workflow error
body: |
Failed to create a VM in execution {$.__execution.id}
from_addr: $.from_email
to_addrs: [$.to_email]
subject: Workflow error
body: |
Failed to create a VM in execution {$.__execution.id}
-- Thanks, Mistral Team.
settings:
smtp_server: $.smtp_server
from: $.from_email
password: $.smtp_password
on-complete:
-- Thanks, Mistral Team.
smtp_server: $.smtp_server
smtp_password: $.smtp_password
on-complete:
- delete_vm
delete_vm:

View File

@ -18,21 +18,19 @@ actions:
base: std.email
base-input:
params:
to: [$.to_email]
subject: OpenStack tenant statistics
body: |
Statistics for tenant "{$.project_id}"
from_addr: $.from_email
to_addrs: [$.to_email]
subject: OpenStack tenant statistics
body: |
Statistics for tenant "{$.project_id}"
Number of virtual machines: {$.vm_count}
Number of active virtual machines: {$.active_vm_count}
Number of networks: {$.net_count}
Number of virtual machines: {$.vm_count}
Number of active virtual machines: {$.active_vm_count}
Number of networks: {$.net_count}
-- Sincerely, Mistral Team.
settings:
from: $.from_email
smtp_server: $.smtp_server
password: $.smtp_password
-- Sincerely, Mistral Team.
smtp_server: $.smtp_server
smtp_password: $.smtp_password
workflows:
tenant_statistics: