Utilisez le script de cette section pour créer une solution libre-service permettant d'ignorer les mises à jour de sorte que les environnements Oracle Enterprise Performance Management Cloud soient mis à jour chaque trimestre avec un cycle de test de six semaines. Dans ce cas, les environnements de production sont mis à jour six semaines après les environnements de test.
Par défaut, EPM Cloud applique une mise à jour mensuelle à vos environnements. Vous utilisez la commande skipUpdate pour ignorer l'application de mises à jour mensuelles à un environnement ou pour consulter les demandes de non-prise en compte de mise à jour en cours. Vous pouvez automatiser l'exécution manuelle des commandes skipUpdate
à l'aide des scripts inclus dans cette section. Ces scripts automatisent le processus de non-prise en compte de mise à jour de sorte que les mises à jour soient appliquées chaque trimestre avec un cycle de test de six semaines.
Note:
Exemple de scénario : le cycle de mise à jour de l'environnement de test est établi comme suit : premiers vendredis de février (mise à jour 24.02), de mai (mise à jour 24.05), d'août (mise à jour 24.08) et de novembre (mise à jour 24.11). L'environnement de production est mis à jour le troisième vendredi de mars (mise à jour 24.02) avec la version utilisée pour mettre à jour l'environnement de test le premier vendredi de février (mise à jour 24.02). Une mise à jour similaire de l'environnement de production est effectuée la troisième semaine de juin (mise à jour 24.05), de septembre (mise à jour 24.08) et de décembre (mise à jour 24.11). Dans ce scénario, l'environnement de production n'est pas mis à jour vers la mise à jour en cours mais vers celle actuellement exécutée dans l'environnement de test.
Exemple de script Windows
Créezskip_update.ps1
en copiant le script suivant. Stockez-le dans un répertoire local. Reportez-vous à la section Exécution du script pour plus d'informations sur l'exécution du script :
# Skip Update PowerShell script $inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw) $username="$($inputproperties.username)" $password="$($inputproperties.password)" $url="$($inputproperties.url)" $updateversions="$($inputproperties.updateversions)" $podtype="$($inputproperties.podtype)" $proxyserverusername="$($inputproperties.proxyserverusername)" $proxyserverpassword="$($inputproperties.proxyserverpassword)" $proxyserverdomain="$($inputproperties.proxyserverdomain)" echo "Starting skip_update.ps1 script." $monthsarr = ("01","02","03","04","05","06","07","08","09","10","11","12") $global:monthsarrfromcurrent = @() $global:yearsarrfromcurrent = @() $updateversionsarr = $updateversions.Split(",") $currentyear=Get-Date -Format yy $currentmonth=Get-Date -Format MM $nextyear=[int]$currentyear+1 function populateFromCurrentArrays() { $startposition = 0 for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${currentmonth} -eq $monthsarr[$i]) { if (${podtype} -eq "prod") { if (${updateversionsarr} -contains ${currentmonth}) { $startposition=$i-2 } else { $startposition=$i-1 } } else { if (${updateversionsarr} -contains ${currentmonth}) { $startposition=$i } else { $startposition=$i-1 } } break } } if (${startposition} -lt 0) { $startposition=$startposition+12 } for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${i} -ge ${startposition}) { $global:monthsarrfromcurrent += $monthsarr[$i] $global:yearsarrfromcurrent += $currentyear } } for ($i = 0; $i -le ($monthsarr.length - 1); $i++) { if (${i} -lt ${startposition}) { $global:monthsarrfromcurrent += $monthsarr[$i] $global:yearsarrfromcurrent += $nextyear } } } function skipUpdateAdd($yearnumber, $monthnumber) { echo "Running: epmautomate.bat skipUpdate add version=${yearnumber}.${monthnumber} comment=`"adding skipUpdate`"" epmautomate skipUpdate add version=${yearnumber}.${monthnumber} comment="adding skipUpdate" } function processSkipUpdates() { $addcount = 0 $countlimit = 0 if (${podtype} -eq "prod") { $countlimit = 3 } else { $countlimit = 2 } if ((${proxyserverusername} -eq "") -And (${proxyserverpassword} -eq "") -And (${proxyserverdomain} -eq "")) { echo "Running: epmautomate.bat login ${username} ${password} ${url}" epmautomate login ${username} ${password} ${url} } else { echo "Running: epmautomate.bat login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" epmautomate login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain} } echo "Running: epmautomate.bat skipUpdate remove" epmautomate skipUpdate remove for ($i = 0; $i -le ($global:monthsarrfromcurrent.length - 1); $i++) { $match = 1 if (${addcount} -eq ${countlimit}) { echo "Update calls are completed. No more will be attempted." break } for ($j = 0; $j -le ($updateversionsarr.length - 1); $j++) { if ((${currentmonth} -eq $updateversionsarr[$j]) -And (${addcount} -gt 0)) { $match = 1 break } if (($global:monthsarrfromcurrent[$i] -eq $updateversionsarr[$j]) -And (${addcount} -eq 0)){ $match = 0 break } } if (${match} -eq 1) { skipUpdateAdd $global:yearsarrfromcurrent[$i] $global:monthsarrfromcurrent[$i] $addcount += 1 } } echo "Running: epmautomate.bat skipUpdate list" epmautomate skipUpdate list echo "Running: epmautomate.bat logout" epmautomate logout } function compareUpdateMonths($thismonth, $nextmonth) { $nextmonthorig=${nextmonth} if (${nextmonth} -lt ${thismonth}) { $nextmonth+=12 } $monthdiff = $nextmonth - $thismonth if (${monthdiff} -gt 4) { echo "There are more than 3 versions skipped from version ${thismonth} to version ${nextmonthorig}. Please correct updateversions in input.properties so that there are not more than three versions skipped between each update version. Exiting." exit 1 } } function validateUpdateVersions() { for ($i = 0; $i -le ($updateversionsarr.length - 1); $i++) { $nextint = $i + 1 $thisupdatemonth = $updateversionsarr[$i] $thisupdatemonthint=[int]$thisupdatemonth $nextupdatemonth=$updateversionsarr[$nextint] $nextupdatemonthint=[int]$nextupdatemonth if (${nextupdatemonth} -eq "") { $nextupdatemonth=$updateversionsarr[0] $nextupdatemonthint=[int]$nextupdatemonth } compareUpdateMonths $thisupdatemonthint $nextupdatemonthint } } validateUpdateVersions populateFromCurrentArrays processSkipUpdates
Exemple de script Linux/UNIX
Créezskip_update.sh
en copiant le script suivant. Stockez-le dans un répertoire local. Reportez-vous à la section Exécution du script pour plus d'informations sur l'exécution du script :
#!/bin/sh . ./input.properties echo "Starting skip_update.sh script." export JAVA_HOME=${javahome} declare -a monthsarr=(01 02 03 04 05 06 07 08 09 10 11 12) declare -a monthsarrfromcurrent declare -a yearsarrfromcurrent updateversionsarr=( $(echo "${updateversions}" | sed 's/,/ /g') ) currentyear=$(date +%y) nextyear=$((currentyear+1)) currentmonth=$(date +%m) populateFromCurrentArrays() { local startposition=0 for i in ${!monthsarr[@]} do if [[ "${currentmonth}" == "${monthsarr[$i]}" ]] then if [[ "${podtype}" == "prod" ]] then if [[ ${updateversionsarr[@]} =~ ${currentmonth} ]] then startposition=$((i-2)) else startposition=$((i-1)) fi break else if [[ ${updateversionsarr[@]} =~ ${currentmonth} ]] then startposition=$i else startposition=$((i-1)) fi break fi fi done if [[ ${startposition} -lt 0 ]] then startposition=$((startposition+12)) fi for i in ${!monthsarr[@]} do if [[ ${i} -ge ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${currentyear}") fi done for i in ${!monthsarr[@]} do if [[ ${i} -lt ${startposition} ]] then monthsarrfromcurrent=("${monthsarrfromcurrent[@]}" "${monthsarr[$i]}") yearsarrfromcurrent=("${yearsarrfromcurrent[@]}" "${nextyear}") fi done } skipUpdateAdd() { local yearnumber="$1" local monthnumber="$2" echo "Running: ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment=\"adding skipUpdate\"" ${epmautomatescript} skipUpdate add version=${yearnumber}.${monthnumber} comment="adding skipUpdate" } processSkipUpdates() { local addcount=0 local countlimit=0 if [[ "${podtype}" == "prod" ]] then countlimit=3 else countlimit=2 fi if [[ "${proxyserverusername}" == "" ]] && [[ "${proxyserverpassword}" == "" ]] && [[ "${proxyserverdomain}" == "" ]] then echo "Running: ${epmautomatescript} login ${username} ${password} ${url}" ${epmautomatescript} login ${username} ${password} ${url} else echo "Running: ${epmautomatescript} login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" ${epmautomatescript} login ${username} ${password} ${url} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain} fi echo "Running: ${epmautomatescript} skipUpdate remove" ${epmautomatescript} skipUpdate remove for i in ${!monthsarrfromcurrent[@]} do local match=1 if [[ ${addcount} -eq ${countlimit} ]] then echo "Update add calls are completed. No more will be attempted." break fi for j in ${!updateversionsarr[@]} do if [[ "${currentmonth}" == "${updateversionsarr[$j]}" ]] && [[ ${addcount} -gt 0 ]] then match=1 break fi if [[ "${monthsarrfromcurrent[$i]}" == "${updateversionsarr[$j]}" ]] && [[ ${addcount} -eq 0 ]] then match=0 break fi done if [[ ${match} -eq 1 ]] then skipUpdateAdd ${yearsarrfromcurrent[$i]} "${monthsarrfromcurrent[$i]}" addcount=$((addcount+1)) fi done echo "Running: ${epmautomatescript} skipUpdate list" ${epmautomatescript} skipUpdate list echo "Running: ${epmautomatescript} logout" ${epmautomatescript} logout } compareUpdateMonths() { local thismonth=$1 local nextmonth=$2 local nextmonthorig=${nextmonth} if [[ ${nextmonth} -lt ${thismonth} ]] then nextmonth=$((nextmonth+12)) fi monthdiff=$((nextmonth-thismonth)) if [[ ${monthdiff} -gt 4 ]] then echo "There are more than 3 versions skipped from version ${thismonth} to version ${nextmonthorig}. Please correct updateversions in input.properties so that there are not more than three versions skipped between each update version. Exiting." exit 1 fi } validateUpdateVersions() { for i in ${!updateversionsarr[@]} do nextint=$((i+1)) thisupdatemonth="${updateversionsarr[$i]}" thisupdatemonthint=${thisupdatemonth#0} nextupdatemonth="${updateversionsarr[$nextint]}" nextupdatemonthint=${nextupdatemonth#0} if [[ ${nextupdatemonth} == "" ]] then nextupdatemonth="${updateversionsarr[0]}" nextupdatemonthint=${nextupdatemonth#0} fi compareUpdateMonths ${thisupdatemonthint} ${nextupdatemonthint} done } validateUpdateVersions populateFromCurrentArrays processSkipUpdates
Script Groovy côté serveur
Créez le script Groovyskip_update.groovy
en copiant le script suivant et en le mettant à jour. Reportez-vous à la section Exécution du script pour plus d'informations sur l'exécution du script :
Mettez à jour les variables suivantes du script Groovy :
username
: nom d'utilisateur d'un administrateur de service sur l'environnement dans lequel définir la cadence de mise à jour non mensuelle.password
: mot de passe de l'administrateur de service, ou nom et emplacement du fichier de mots de passe cryptés.url
: URL de l'environnement dans lequel vous souhaitez définir la cadence de mise à jour non mensuelle.updateversions
: liste des mises à jour EPM Cloud, séparées par des virgules, qui doivent être appliquées à l'environnement identifié à l'aide du paramètre url
. Par exemple, updateversions=02,05,08,11
.
Les versions doivent être indiquées avec deux chiffres. Ajoutez un zéro pour les mises à jour 01 à 09. Le script tente d'exécuter la commande skipUpdate pour les mises à jour non incluses dans la valeur du paramètre updateversions
. Par exemple, si vous indiquez updateversions=02,05,08,11
, le script tente de définir des indicateurs de non-prise en compte des mises à jour 01 (janvier), 03 (mars), 04 (avril), 06 (juin), 07 (juillet), 09 (septembre), 10 (octobre) et 12 (décembre). Dans ce cas, les mises à jour EPM Cloud 02 (février), 05 (mai), 08 (août) et 11 (novembre) sont appliquées à l'environnement.
podtype
: type d'environnement EPM Cloud. Les valeurs valides sont test
et prod
.proxyserverusername
: nom d'utilisateur qui permet d'authentifier une session sécurisée auprès du serveur proxy qui contrôle l'accès à Internet.proxyserverpassword
: mot de passe qui permet d'authentifier l'utilisateur auprès du serveur proxy.proxyserverdomain
: nom du domaine défini pour le serveur proxy.Note:
Si vous n'utilisez pas de serveur proxy, n'indiquez pas de valeur pour les paramètresproxyserverusername
, proxyserverpassword
et proxyserverdomain
.import java.text.SimpleDateFormat String username = 'service_administrator' String password = 'examplePWD' String url = 'example_EPM_URL' String updateversions = '01,04,07,10' String podtype = 'test' String proxyserverusername = '' String proxyserverpassword = '' String proxyserverdomain = '' def currentdate = new Date() def yf = new SimpleDateFormat("yy") def mf = new SimpleDateFormat("MM") String[] monthsarr = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"] List<String> monthsarrfromcurrent = new ArrayList<>() List<String> yearsarrfromcurrent = new ArrayList<>() String currentyear = yf.format(currentdate) String nextyear = (currentyear.toInteger() + 1).toString() String currentmonth = mf.format(currentdate) String[] updateVersionsStringArr = updateversions.split(','); def updateversionsarr = new int[updateVersionsStringArr.length]; for(int i = 0; i < updateVersionsStringArr.length; i++) { updateversionsarr[i] = Integer.parseInt(updateVersionsStringArr[i]); } def LogMessage(String message) { def date = new Date() def sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") println('[' + sdf.format(date) + '][GROOVY] ' + message); } def LogOperationStatus(EpmAutomateStatus opstatus) { def returncode = opstatus.getStatus() LogMessage(opstatus.getOutput()) LogMessage('return code: ' + returncode) } int CompareUpdateMonths(int thismonth, int nextmonth) { int nextmonthorig = nextmonth if (nextmonth < thismonth) { nextmonth = nextmonth + 12 } int monthdiff = nextmonth - thismonth if (monthdiff > 4) { LogMessage('There are more than 3 versions skipped from version ' + thismonth + ' to version ' + nextmonthorig + '. Please correct updateversions so that there are not more than three versions skipped between each update version. Exiting.') return 1 } return 0 } int ValidateUpdateMonths(int[] updateversionsarr) { for(int i = 0; i < updateversionsarr.length; i++) { int nextint = i + 1 String nextupdatemonth = "" int nextupdatemonthint = 0 String thisupdatemonth = updateversionsarr[i] int thisupdatemonthint = thisupdatemonth.toInteger() if (nextint < updateversionsarr.length) { nextupdatemonth = updateversionsarr[nextint] } else { nextupdatemonth = updateversionsarr[0] } nextupdatemonthint = nextupdatemonth.toInteger() int returncode = CompareUpdateMonths(thisupdatemonthint, nextupdatemonthint) if (returncode > 0) { return 1 } } return 0 } def SkipUpdateAdd(EpmAutomate automate, String yearnumber, String monthnumber) { String yeardotmonth = yearnumber + '.' + monthnumber LogMessage('Running: epmautomate skipUpdate add version=' + yeardotmonth + ' comment=\"adding skipUpdate\"') EpmAutomateStatus status = automate.execute('skipupdate','add','version=' + yeardotmonth,'comment=\"adding skipUpdate\"') LogOperationStatus(status) } LogMessage('Starting skip update processing') EpmAutomate automate = getEpmAutomate() // validate update months int returncode = ValidateUpdateMonths(updateversionsarr) if (returncode != 0) { return 1 } // populate arrays int startposition = 0 for(int i = 0; i < monthsarr.length; i++) { if (currentmonth == monthsarr[i]) { if (podtype.equals("prod")) { if (updateVersionsStringArr.contains(currentmonth)) { startposition = (i-2) } else { startposition = (i-1) } } else { if (updateVersionsStringArr.contains(currentmonth)) { startposition = i } else { startposition = (i-1) } } break } } if (startposition < 0) { startposition = startposition + 12 } for(int i = 0; i < monthsarr.length; i++) { if (i >= startposition) { monthsarrfromcurrent.add(monthsarr[i]) yearsarrfromcurrent.add(currentyear) } } for(int i = 0; i < monthsarr.length; i++) { if (i <= startposition) { monthsarrfromcurrent.add(monthsarr[i]) yearsarrfromcurrent.add(nextyear) } } // process skip updates LogMessage("Operation: encrypt " + password + " oracleKey password.epw") EpmAutomateStatus status = automate.execute('encrypt',password,"oracleKey","password.epw") LogOperationStatus(status) if ((proxyserverusername != null && proxyserverusername != '') && (proxyserverpassword != null && proxyserverpassword != '') && (proxyserverdomain != null && proxyserverdomain != '')) { LogMessage("Operation: login " + username + " password.epw " + url + " ProxyServerUserName=" + proxyserverusername + " ProxyServerPassword=" + proxyserverpassword + " ProxyServerDomain=" + proxyserverdomain) status = automate.execute('login',username,"password.epw",url,"ProxyServerUserName=" + proxyserverusername,"ProxyServerPassword=" + proxyserverpassword,"ProxyServerDomain=" + proxyserverdomain) LogOperationStatus(status) } else { LogMessage("Operation: login " + username + " password.epw " + url) status = automate.execute('login',username,"password.epw",url) LogOperationStatus(status) } LogMessage('Running: epmautomate skipUpdate remove') status = automate.execute('skipupdate','remove') LogOperationStatus(status) int addcount = 0 int countlimit = 0 if (podtype.equals("prod")) { countlimit = 3 } else { countlimit = 2 } for (int i = 0; i < monthsarrfromcurrent.size(); i++) { int match = 1 if (addcount == countlimit){ LogMessage('Update add calls are completed. No more will be attempted.') break } for(int j = 0; j < updateversionsarr.length; j++) { if ((Integer.parseInt(currentmonth) == updateversionsarr[j]) && (addcount > 0)) { match = 1 break } if ((Integer.parseInt(monthsarrfromcurrent.get(i)) == updateversionsarr[j]) && (addcount == 0)) { match = 0 break } } if (match == 1) { SkipUpdateAdd(automate, yearsarrfromcurrent.get(i), monthsarrfromcurrent.get(i)) addcount+=1 } } LogMessage('Running: epmautomate skipUpdate list') status = automate.execute('skipupdate','list') LogOperationStatus(status) println(status.getItemsList()) LogMessage('Running: epmautomate logout') status = automate.execute('logout') LogOperationStatus(status) LogMessage('Skip update processing completed')
Création du fichier input.properties pour exécuter des scripts skip_update
Windows et Linux/UNIX
skip_update.ps1
ou skip_update.sh
, créez le fichier input.properties
et mettez-le à jour avec les informations de votre environnement. Enregistrez le fichier dans un répertoire local. Le contenu de ce fichier varie en fonction du système d'exploitation.
Windows
username=exampleAdmin password=examplePassword.epw url=exampleURL updateversions=01,04,07,10 podtype=test
Linux/UNIX
javahome=JAVA_HOME epmautomatescript=EPM_AUTOMATE_LOCATION username=exampleAdmin password=examplePassword.epw url=exampleURL updatemonths=02,05,08,11
Table 3-14 Paramètres du fichier input.properties
Paramètre | Description |
---|---|
javahome |
Emplacement de JAVA_HOME . Pour Linux/UNIX uniquement. |
epmautomatescript |
Chemin absolu de l'exécutable EPM Automate (epmautomate.sh ). Pour Linux/UNIX uniquement. |
username |
Nom d'utilisateur d'un administrateur de service. |
password |
Mot de passe de l'administrateur de service, ou nom et emplacement du fichier de mots de passe cryptés. |
url |
URL de l'environnement dans lequel vous souhaitez définir la cadence de mise à jour non mensuelle. |
updateversions |
updateversions : liste des mises à jour EPM Cloud, séparées par des virgules, qui doivent être appliquées à l'environnement identifié à l'aide du paramètre url . Par exemple, updateversions=02,05,08,11 .
Les versions doivent être indiquées avec deux chiffres. Ajoutez un zéro pour les mises à jour 01 à 09. Le script tente d'exécuter la commande skipUpdate pour les mises à jour non incluses dans la valeur du paramètre |
podtype |
Type d'environnement EPM Cloud. Les valeurs valides sont test et prod . |
Exécution du script
skip_update.ps1
ou skip_update.sh
en copiant le script d'une section précédente.input.properties
et enregistrez-le dans le répertoire où se trouve le script skip_update
. Le contenu de ce fichier varie en fonction du système d'exploitation. Reportez-vous à la section Création du fichier input.properties pour exécuter des scripts skip_update Windows et Linux/UNIX.
Assurez-vous que vous disposez de privilèges d'écriture sur ce répertoire. Pour Windows, vous devrez peut-être démarrer PowerShell à l'aide de l'option Exécuter en tant qu'administrateur afin de pouvoir exécuter le script.
skip_update.ps1
../skip_update.sh
.skip_update.groovy
et mettez-le à jour comme nécessaire.