Clonagem de um Ambiente Usando um Script Groovy no Lado do Servidor

Você pode incluir comandos do EPM Automate em scripts Groovy no Lado do Servidor para clonar ambientes para fins de recuperação de desastre. Isso permite configurar uma recuperação de desastre sem uma base no local.

Se as senhas contiverem caracteres especiais, consulte Caracteres Especiais Além disso, certifique-se de substituir esses valores de parâmetros para adaptá-los a seus ambientes:

Table 4-1 Parâmetros a Serem Alterados

Parâmetro Descrição
senha A senha do Administrador do Serviço que está executando a operação de clonagem no ambiente de origem.
targetpassword A senha do Administrador do Serviço que está executando a operação de clonagem no ambiente de destino.
username O ID de usuário do Administrador do Serviço no ambiente de origem.
targetusername O ID de usuário do Administrador do Serviço no ambiente de destino. Esse usuário também deve ser atribuído à função de Administrador do Domínio de Identidade no ambiente de destino.
email_id O endereço de e-mail ao qual você planeja enviar informações sobre o processo de clonagem.

Script para Criptografia de Senha

EpmAutomate automate = getEpmAutomate()

//Encrypt the password of a Service Administrator in the source environment
EpmAutomateStatus encryptstatus1 = automate.execute('encrypt', 'password','encryptionKey','sourcePassword.epw')
if(encryptstatus1.getStatus() != 0)  throwVetoException(encryptstatus1.getOutput())
println(encryptstatus1.getOutput())

//Encrypt the password of a Service Administrator in the target environment
//This user must also have the Identity Domain Administrator 
//role in the target environment

EpmAutomateStatus encryptstatus2= automate.execute('encrypt', 'targetpassword',
'encryptionKey', 'targetPassword.epw')
if(encryptstatus2.getStatus() != 0) throwVetoException(encryptstatus2.getOutput())
println(encryptstatus2.getOutput())

Script para Clonagem do Ambiente

Este script usa os arquivos de senha criptografadas criado usando o script anterior.

EpmAutomate automate = getEpmAutomate()

//Log into the target environment
EpmAutomateStatus loginstatus = automate.execute('login', 'username','targetPassword.epw' , 'targeturl')
if(loginstatus.getStatus() != 0) throwVetoException(loginstatus.getOutput())
println(loginstatus.getOutput())

//Recreate the target environment
EpmAutomateStatus recreatestatus = automate.execute('recreate' , '-f' )
if(recreatestatus.getStatus() != 0) throwVetoException(recreatestatus.getOutput())
println(recreatestatus.getOutput())

//Copy Artifact Snapshot from the source environment 
//to the target environment
EpmAutomateStatus copystatus = automate.execute('copysnapshotfrominstance',
'Artifact Snapshot', 'sourceusername', 'sourcePassword.epw','source url')
if(copystatus.getStatus() != 0) throwVetoException(copystatus.getOutput())
println(copystatus.getOutput())

//import Artifact Snapshot into the target environment
EpmAutomateStatus importstatus = automate.execute('importsnapshot', 'Artifact Snapshot')
println(importstatus.getOutput())

//Send an email to a designated user with the status of the 
//snapshot import process
EpmAutomateStatus emailstatus = automate.execute('sendmail', 'email_id' ,'Status of DR' , 'BODY='+ importstatus.getOutput())
println(emailstatus.getOutput())

//Sign out of the target environment
EpmAutomateStatus logoutstatus = automate.execute('logout')
println(logoutstatus.getOutput())