# DCocm.ctl:E900/090:Interacts with the Oracle Configuration Manager # $Id: DCocm.ctl,v 1.4 2013/11/26 09:58:48 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/DCocm.ctl,v 1.4 2013/11/26 09:58:48 RDA Exp $ # # Change History # 20131126 MSC Improve the documentation. =head1 NAME RDA:DCocm - Interacts with the Oracle Configuration Manager =head1 DESCRIPTION This module executes Oracle Configuration Manager to collect configuration data when possible. =cut use Message # Check if the collection must be done if ${DFT.B_NO_OCM} return macro skip_ocm {if ${W_FORCE} return false if !${CUR.O_REQUEST}->get_value('modules') return false if grep(last,'\b((RDA\.)?OCM|(RDA:)?DCocm)$') return false output E,status var $fil = getFile('.') close return isNewer($fil,1) } if skip_ocm() return # Initialization var @ERR var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' echo tput('bold'),'Processing RDA.OCM module ...',tput('off') # Load the common macros run RDA:OCMlib() # Create the reports var $toc = $[OUT]->add_report('e','index',0) title {$toc} '2:Oracle Configuration Manager' var $rps = $[OUT]->add_report('e','status',0) title {$rps} '---+!! Oracle Configuration Manager Status' title {$rps} $TOC var $rpc = $[OUT]->add_report('e','collect',0) title {$rpc} '---+!! Configuration Collection' title {$rpc} $TOC # Collect the configuration when possible var ($top,%ofm,%tgt) = (${COL.TARGET/i}) loop $tgt ($top->grep('^S_CCR_RUN$','rw')) {next compare('eq',$tgt->get_first('S_CCR_RUN'),'skip') var $oid = $tgt->get_oid var $typ = $tgt->get_first('W_CLASS') if compare('eq','typ','OI') {if $tgt->get_prime('I_MW_HOME') var $ofm{last->get_oid,'oi',$oid} = $tgt else var $tgt{$oid} = $tgt } elsif compare('eq','typ','MH') var $ofm{$oid,'mh'} = $tgt else var $tgt{$oid} = $tgt } # Save the environment variable var $env = setEnv('ORACLE_CONFIG_HOME') # Collect the Middleware configurations loop $ofm (keys(%ofm)) {# Collect the Middleware home configuration if exists($ofm{$ofm,'mh'}) {var $tgt = $ofm{$ofm,'mh'} var $ttl = $tgt->get_first('T_TITLE') if ?$cmd = get_ocm_home($tgt->get_first('D_CCR_HOME'),$ttl) {if ?$tgt->get_first('D_CCR_CONFIG') {var ($flg,$not) = get_ocm_mode($cfg = last,'livelink_config') if and($tgt->get_first('B_IPS'),\ match(${SET.RDA.OCM.T_ANNOTATION},'^\w+$')) {debug ' Inside OCM module, collecting the ',$ttl,' configuration \ (can take time)' call do_status($toc,$rps,$rpc,$cmd,$cfg,${SET.RDA.OCM.T_ANNOTATION}) } else {# Adapt the environment var ($bea,$wls) = get_wls_config($ORACLE_PARENT) var $bea = setEnv('BEA_HOME',$bea) var $wls = setEnv('WL_HOME', $wls) # Perform the collection debug ' Inside OCM module, collecting the ',$ttl,' configuration \ (can take time)' if do_collect($toc,$rps,$rpc,$cmd,$cfg,$not,$flg,$ttl) {debug ' Inside OCM module, transfering the OCM results' call transfer(catDir($cfg,'state','upload'),'ocmconfig.jar',\ ${OUT.E},concat(${CUR.W_PREFIX},concat('payload_',$ofm,'.jar')),\ true) } # Restore the environment call setEnv('BEA_HOME',$bea) call setEnv('WL_HOME', $wls) } var ${STA.RDA.OCM.T_RUN} = undef } else call push(@ERR,\ concat('OCM-09102: No OCM configuration found (',$oid,': ',$ttl,')')) } } # Collect the instance configurations var @tbl = keys($ofm{$ofm,'oi'}) var $typ = ${W_INSTANCES} if compare('eq',$typ,'A') var @tbl = keys($ofm{$ofm,'oi'}) elsif compare('eq',$typ,'S') {var %tbl = () loop $tgt (@{SET.RDA.BEGIN.I_INSTANCES}) {if exists($ofm{$ofm,'oi',$key = $tgt->get_oid}) var $tbl{$key} = 1 } var @tbl = keys(%tbl) } else var @tbl = () loop $oid (@tbl) {var $tgt = $ofm{$ofm,'oi',$oid} var $ttl = $tgt->get_first('T_TITLE') debug ' Inside OCM module, collecting the ',$ttl,' configuration \ (can take time)' var ($flg,$not) = \ get_ocm_mode($cfg = $tgt->get_first('D_CCR_HOME'),'livelink_config') call setEnv('ORACLE_CONFIG_HOME',$dir = $tgt->get_first('D_CCR_CONFIG')) next !grepFile(catFile($dir,'ccr','config','collector.properties'),\ '^ccr\.binHome=','f') var $cmd = catCommand(cond(or(isWindows(),isCygwin()),\ s(value(last),'^(\w+)\\:','$1:'),\ value(last)),'bin','emCCR') if do_collect($toc,$rps,$rpc,$cmd,$cfg,$not,$flg,$ttl) {debug ' Inside OCM module, transfering the OCM results' call transfer(catDir($cfg,'state','upload'),'ocmconfig.jar',\ ${OUT.E},concat(${CUR.W_PREFIX},concat('payload_',$oid,'.jar')),\ true) } var ${STA.RDA.OCM.T_RUN} = undef } } # Collect other configurations loop $oid (keys(%tgt)) {var $tgt = $tgt{$oid} if ?$cmd = get_ocm_home($tgt->get_first('D_CCR_HOME')) {var $ttl = $tgt->get_first('T_TITLE') if ?$tgt->get_first('D_CCR_CONFIG') {var ($flg,$not) = get_ocm_mode($cfg = last,'livelink_config') if and($tgt->get_first('B_IPS'),\ match(${SET.RDA.OCM.T_ANNOTATION},'^\w+$')) {debug ' Inside OCM module, collecting the ',$ttl,' configuration \ (can take time)' call do_status($toc,$rps,$rpc,$cmd,$cfg,${SET.RDA.OCM.T_ANNOTATION}) } else {debug ' Inside OCM module, collecting the ',$ttl,' configuration \ (can take time)' if do_collect($toc,$rps,$rpc,$cmd,$cfg,$not,$flg,$ttl) {debug ' Inside OCM module, transfering the OCM results' call transfer(catDir($cfg,'state','upload'),'ocmconfig.jar',\ ${OUT.E},concat(${CUR.W_PREFIX},concat('payload_',$oid,'.jar')),\ true) } } var ${STA.RDA.OCM.T_RUN} = undef } else call push(@ERR,\ concat('OCM-09102: No OCM configuration found (',$oid,': ',$ttl,')')) } } # Restore the environment call setEnv('ORACLE_CONFIG_HOME',$env) # Report the errors if @ERR var ${STA.RDA.OCM.T_RUN:'Execution error'} = join('%BR%',@ERR) # Render the reports if $rpc->is_created(true) call $rpc->render if $rps->is_created(true) call $rps->render =head1 SEE ALSO L =begin credits =over 10 =item RDA 4.20: Wes Root. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut