# DCocm.cfg: Set up the Configuration Manager Interface # $Id: DCocm.cfg,v 1.11 2014/06/24 10:30:43 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/DCocm.cfg,v 1.11 2014/06/24 10:30:43 RDA Exp $ # # Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. # # Change history # 20140617 KRA Improve instance target detection. ############################################################################### # Collect the Oracle Configuration Manager setup information ############################################################################### #------------------------------------------------------------------------------ # Module definition #------------------------------------------------------------------------------ col=${B_IN_USE} dsc='Set up the Configuration Manager Interface' fam=Cygwin,Unix,Windows frk=true lim=0 pre=RDA:DCbegin var=not_used # Flow:chk_ocm_kit,in_use,not_used,W_INSTANCES exe=sdcl { "var ${STA.RDA.OCM.T_RUN} = undef "if !${DFT.B_NO_OCM} "{keep $cfg,@cfg,@set,%ofm " " # Determine the OCM collection requests " var ($cfg,$ins,$run,@var) = (0,false,false) " loop $tgt (${COL.TARGET/i}->grep('^S_CCR_RUN$','rw')) " {next !compare('eq',$tgt->get_first('S_CCR_RUN'),'done') " var $run = true " if compare('eq',$tgt->get_first('W_CLASS','OI')) " break $ins = true " } " " # Determine the OCM requests " loop $tgt (${COL.TARGET/i}->grep('^S_CCR_SETUP$','rw')) " {next !compare('eq',$tgt->get_first('S_CCR_SETUP'),'pending') " var $typ = $tgt->get_first('W_CLASS') " if compare('eq',$typ,'OH') " {if isOwner($tgt->get_first('D_ORACLE_HOME')) " call push(@set,$tgt) " } " elsif compare('eq',$typ,'MH') " {next !isOwner($tgt->get_first('D_CCR_HOME')) " var $oid = $tgt->get_oid " var $ofm{$oid,'dr'} = $tgt->get_first('D_MW_HOME') " var $ofm{$oid,'mh'} = $tgt " incr $cfg " } " } " " loop $tgt (${COL.TARGET/i}->grep('^S_CCR_CONFIG$','rw')) " {next !compare('eq',$tgt->get_first('S_CCR_CONFIG'),'pending') " var $typ = $tgt->get_first('W_CLASS') " if compare('eq',$typ,'OI') " {next !isOwner($tgt->get_first('D_ORACLE_INSTANCE')) " if ?$top = $tgt->get_prime('I_MW_HOME') " {var $oid = $top->get_oid " var $ofm{$oid,'dr'} = $top->get_first('D_MW_HOME') " call push($ofm{$oid,'oi'},$tgt) " } " else " call push(@cfg,$tgt) " incr $cfg " } " } " " # Determine next settings " var @var = cond($ins,list('in_use','W_INSTANCES'),\ " $run,list('in_use'),\ " list('not_used')) " if @set " call push(@var,'chk_ocm_kit') " elsif $cfg " call push(@var,'chk_java_home') " var @{AUX.var} = @var "} " "# Define the validation macros "macro chk_jdk "{var ($dir,$nam) = @arg " " require testDir('d',catDir($dir,'jre')),\ " lastDir()," does not correspond to a Java Development Kit.\n " " var ${AUX.nam} = $nam " return true "} } #------------------------------------------------------------------------------ # Setting definitions #------------------------------------------------------------------------------ [not_used] typ=B dft=false dsc='Is Oracle Configuration Manager in use?' nam=B_IN_USE [in_use] typ=B dft=true dsc='Is Oracle Configuration Manager in use?' nam=B_IN_USE var=F_DISTRIBUTION [F_DISTRIBUTION] typ=T dsc="OCM Distribution kit" opt=1 [W_INSTANCES] typ=M bef="Multiplying the OCM collections is increasing the total collection time\n\ Indicate which OCM collection at instance home level RDA should trigger:" dft='S' dsc='Instance home collection mode' err='Use 1, 2, or 3 only' itm=(1=>'All known instances homes',\ 2=>'Selected instance homes',\ 3=>'No instance homes') inp='Enter the digit corresponding to your choice' rsp={1=>'A',2=>'S',3=>'N'} val=F #------------------------------------------------------------------------------ # OCM installation prerequisite checks #------------------------------------------------------------------------------ [chk_ocm_kit] typ=B dft=false nam=- var=true:chk_java_home:\ log_info exe=sdcl { "if !match($plt = getOsName(),'(aix|cygwin|hpux|linux|solaris|MSWin(32|64))') " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " concat('OCM-09001: The platform ',$plt,' is not supported') "if ${OS.aix} "{var ($ver) = command('oslevel') " if match($ver,'^[1-4]+') " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " concat('OCM-09001: The platform AIX(',$ver,') is not supported') "} "if !?testDir('d',$top = getGroupDir('D_RDA','ccr')) " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " 'OCM-09002: The Oracle Configuration Manager software is not available' "if !?testFile('fr',${F_DISTRIBUTION}) "{var ($cnt,$plt) = (0,nvl({'aix', 'AIX',\ " 'cygwin', 'Windows',\ " 'hpux', 'HP-UX',\ " 'linux', 'Linux',\ " 'solaris','SunOS',\ " 'MSWin32','Windows'}->{$plt},$plt)) " loop $pth (grepDir($top,concat('^ccr-Production\-\d+(\.\d+){2,}\-',$plt,\ " '(\-.*)?\.zip$'),'ip')) " {next !?testFile('r',$pth) " if $cnt " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " 'OCM-9008: Multiple OCM distribution kits are present' " incr $cnt " } " if !$cnt " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " 'OCM-09002: The Oracle Configuration Manager software is not available' "} "if ${CUR.B_NO_DIALOG} " return ${STA.RDA.OCM.T_RUN:'OCM installation requirement check result'} = \ " 'OCM-09006: Automated setup' "var ${AUX.dft} = true } [chk_java_home] typ=B dsc='Is a JDK specified by JAVA_HOME, or ORACLE home, or Middleware home?' nam=- var=true:check_install,check_config:\ ask_ocm_java exe=sdcl { "var $dft = false "if ?nvl(testDir('d',catDir(${ENV.JAVA_HOME},'jre')),\ " testDir('d',catDir(${SET.RDA.BEGIN.D_ORACLE_HOME},'jdk'))) " var $dft = true "else "{var @dir = () " if ?testDir('d',${SET.RDA.BEGIN.D_ORACLE_PARENT}) " call push(@dir,last) " loop $key (keys(%ofm)) " {if ?testDir('d',$ofm{$key}->{'dr'}) " call push(@dir,last) " } " loop $dir (@dir) " {if findDir($dir,'^(jdk\d+|jrockit)','fp') " break $dft = true " elsif findDir($dir,'^wlserver_\d+','fp') " {if ?testFile('f',$fil = catFile(last,'common','bin',${AS.CMD:'commEnv'})) " {if match($fil,'\.cmd$',true) " {if grepFile($fil,'^\s*set\s+JAVA_HOME\s*=\s*([\042\047]).*?\1','fi') " break $dft = true " } " elsif grepFile($fil,'^\s*JAVA_HOME\s*=\s*([\042\047]).*?\1','fi') " break $dft = true " } " } " } "} "var ${AUX.dft} = $dft } [ask_ocm_java] typ=B dft=true dsc='Specify alternate JAVA_HOME' inp='RDA did not find a Java Development kit either in the Oracle home \ directory or through the JAVA_HOME environment variable. Do you want to \ specify an alternate location (Y/N)?' nam=- var=true:get_ocm_java:\ no_java,log_info [get_ocm_java] typ=D dsc='Alternate Java home' err='Warning: The specified directory does not -yet- exist' inp='Enter the location of a Java Development Kit' nam=- ref=chk_jdk(last,'D_JAVA_HOME') val=W var=exists:check_install,check_config:\ no_java,log_info #------------------------------------------------------------------------------ # Oracle Configuration Manager installation settings #------------------------------------------------------------------------------ [check_install] typ=B dft=scalar(@set) dsc='Are there pending OCM installations?' nam=- var=B_INSTALL [B_INSTALL] typ=B dft=true dsc='Has Oracle Configuration Manager installation been proposed?' var=loop_install [loop_install] typ=L dft=@set dsc='Treat all pending installation requests' nam=-i_tgt var=loop:get_install_def,get_install_mode [get_install_def] typ=T dft=concat('COL/',${i_tgt}->get_path) dsc='Get the definition path' nam=-t_def [get_install_mode] typ=M bef="Select the mode that you want to install Oracle Configuration Manager in \ ${T_TITLE}" cas=0 def=${CTX.t_def} dft=${CTX.W_DFT_MODE:'C'} dsc='Oracle Configuration Manager installation mode' err='Only a single letter corresponding to a menu item should be used' hlp="RDA benefits from Oracle Configuration Manager by improving its data \ collection. Oracle Configuration Manager (OCM) collects the configuration \ information and uploads it to the OCM Repository in connected mode. \ When OCM is configured in disconnected mode, it adds the OCM payload to \ the RDA report packages in future RDA runs.\n " itm={C=>'Connected Mode',D=>'Disconnected Mode',N=>'Do not install OCM'} inp='Enter the letter corresponding to your choice' nam=- mnu=('C','D') rsp={C=>'C',D=>'D',N=>'N'} val=F var=C:set_dft_mode_c,set_install_mode,chk_scripts,log_install,do_install:\ D:set_dft_mode_d,set_install_mode,chk_scripts,log_install,do_install:\ N:set_dft_mode_n,log_install nam=- exe=sdcl { "call ${CTX.i_tgt}->set_value('W_CCR_INSTALL') } [set_install_mode] typ=T def=${CTX.t_def} dft=${CTX.W_DFT_MODE} dsc='Oracle Configuration Manager installation mode' nam=W_CCR_INSTALL [chk_scripts] typ=D def=${CTX.t_def} dft=${D_ORACLE_HOME} dsc='Only install the scripts, when installed in ORACLE_HOME' nam=- var=exists:B_DB_SCRIPTS [B_DB_SCRIPTS] typ=B def=${CTX.t_def} dft=1 dsc='Need to install the database collection scripts ?' inp='Do you want to install OCM Database collection scripts (Y/N)?' var=true:T_SYSDBA_USER,B_APPS_SCRIPTS [T_SYSDBA_USER] typ=T def=${CTX.t_def} dft='sys' dsc='SYSDBA user' inp='Enter a SYSDBA user for installing the OCM Database collection scripts' [B_APPS_SCRIPTS] typ=B def=${CTX.t_def} dft=0 dsc='Is this an Oracle E-Business suite Database Oracle home?' inp="Is ${D_ORACLE_HOME} an Oracle E-Business Suite Database Oracle home (Y/N)?" var=true:T_APPS_USER [T_APPS_USER] typ=T def=${CTX.t_def} dft='APPS' dsc='Apps user name, used for configuring eBusiness data collection' inp='Enter the Apps Database user name' #------------------------------------------------------------------------------ # Oracle Configuration Manager configuration settings #------------------------------------------------------------------------------ [check_config] typ=B dft=$cfg dsc='Are there pending OCM configurations?' nam=- var=dsp_overview,B_SETUP [dsp_overview] typ=C dsc='Display an OCM overview' exe=sdcl { "var @txt = ('.P',\ " 'RDA benefits from Oracle Configuration Manager by improving its \ " data collection. Oracle Configuration Manager (OCM) collects \ " the configuration information and uploads it to the OCM \ " Repository in connected mode. When OCM is configured in \ " disconnected mode, it adds the OCM payload to the RDA report \ " packages in future RDA runs.',\ " '') "loop $oid (keys(%ofm)) "{var $rec = $ofm{$oid} " call push(@txt,'.N 1',\ " concat(".M 2 'Pending Configurations in ",$rec->{'dr'},":'")) " if exists($rec->{'mh'}) " {var $tgt = $rec->{'mh'} " call push(@txt,join('|',$tgt->get_oid,$tgt->get_first('T_TITLE'))) " } " loop $tgt (@{$rec->{'oi'}}) " call push(@txt,join('|',$tgt->get_oid,$tgt->get_first('T_TITLE'))) " call push(@txt,'') "} "if @cfg "{call push(@txt,'.N 1',\ " ".M 2 'Other Pending Configuration:'") " loop $tgt (@cfg) " call push(@txt,join('|',$tgt->get_oid,$tgt->get_first('T_TITLE'))) " call push(@txt,'') "} "call push(@txt,'.N 1',\ " '.P 0',\ " "Hit 'Return' to continue",\ " "\012") "var ${AUX.inp} = join("\012",@txt) } [B_SETUP] typ=B dft=true dsc='Do you want RDA to configure OCM?' inp='Do you want RDA to configure OCM now (Y/N)?' var=true:loop_middleware_homes,loop_config:\ setup_postponed,log_info [loop_middleware_homes] typ=L dft=keys(%ofm) dsc='Treat all pending Middleware configurations' nam=-t_key var=loop:check_middleware,loop_instances [check_middleware] typ=L dft=(nvl($ofm{${t_key},'mh'},list())) dsc='Treat the Middleware home' nam=-i_tgt var=loop:get_config_def,get_middleware_mode [loop_instances] typ=L dft=@{$ofm{${t_key},'oi'}} dsc='Treat all pending Oracle instance configurations' nam=-i_tgt var=loop:get_config_def,get_config_mode [loop_config] typ=L dft=@cfg dsc='Treat all other pending configurations' nam=-i_tgt var=loop:get_config_def,get_config_mode [get_config_def] typ=T dft=concat('COL/',${i_tgt}->get_path) dsc='Get the definition path' nam=-t_def [get_middleware_mode] typ=M bef="Oracle Configuration Manager is present in ${T_TITLE} but its setup is \ not complete.\n\ Select the mode that you want to use:" cas=0 def=${CTX.t_def} dft=${CTX.W_DFT_MODE:'C'} dsc='Oracle Configuration Manager configuration mode' err='Only a single letter corresponding to a menu item should be used' itm=(C=>'Connected Mode',\ D=>'Disconnected Mode',\ N=>'Do not setup OCM') inp='Enter the letter corresponding to your choice' nam=- rsp={C=>'C',D=>'D',N=>'N'} val=F var=C:set_dft_mode_c,set_middleware_mode,log_setup,do_config:\ D:set_dft_mode_d,set_middleware_mode,log_setup,do_config:\ N:set_dft_mode_n,log_setup exe=sdcl { "call ${CTX.i_tgt}->set_value('W_CCR_SETUP') } [set_middleware_mode] typ=T def=${CTX.t_def} dft=${CTX.W_DFT_MODE} dsc='Oracle Configuration Manager configuration mode' nam=W_CCR_SETUP [get_config_mode] typ=M bef="Select the mode that you want to configure the instance ${T_TITLE}:" cas=0 def=${CTX.t_def} dft=${CTX.W_DFT_MODE:'C'} dsc='Oracle Configuration Manager configuration mode' err='Only a single letter corresponding to a menu item should be used' itm=(C=>'Connected Mode',\ D=>'Disconnected Mode',\ N=>'Do not setup OCM') inp='Enter the letter corresponding to your choice' nam=- rsp={C=>'C',D=>'D',N=>'N'} val=F var=C:set_dft_mode_c,set_config_mode,log_config,do_config:\ D:set_dft_mode_d,set_config_mode,log_config,do_config:\ N:set_dft_mode_n,log_config exe=sdcl { "call ${CTX.i_tgt}->set_value('W_CCR_CONFIG') } [set_config_mode] typ=T def=${CTX.t_def} dft=${CTX.W_DFT_MODE} dsc='Oracle Configuration Manager configuration mode' nam=W_CCR_SETUP #------------------------------------------------------------------------------ # Default mode settings #------------------------------------------------------------------------------ [set_dft_mode_c] typ=T dft='C' dsc="Set 'C' as default mode" nam=-W_DFT_MODE [set_dft_mode_d] typ=T dft='D' dsc="Set 'D' as default mode" nam=-W_DFT_MODE [set_dft_mode_n] typ=T dft='N' dsc="Set 'N' as default mode" nam=-W_DFT_MODE #------------------------------------------------------------------------------ # Oracle Configuration Manager installation requirement check results #------------------------------------------------------------------------------ [no_java] typ=T def='COL/STATUS.RDA.OCM' dft='OCM-09004: Java Development Kit not found' dsc='OCM installation requirement check result' nam=T_RUN [setup_postponed] typ=T def='COL/STATUS.RDA.OCM' dft='OCM-09010: Oracle Configuration Manager setup postponed' dsc='OCM installation requirement check result' nam=T_RUN #------------------------------------------------------------------------------ # Oracle Configuration Manager log settings #------------------------------------------------------------------------------ [log_config] typ=E dft="OCM|config|${W_DFT_MODE}|${T_TITLE}|" dsc="Log the configuration details" nam=- [log_info] typ=E dft="OCM|setup|N|||${SET.RDA.OCM.T_RUN}" dsc='Log the installation details' nam=- [log_install] typ=E dft="OCM|setup|${W_DFT_MODE}|${B_DB_SCRIPTS}|${B_APPS_SCRIPTS}||${T_TITLE}" dsc='Log the installation details' nam=- [log_setup] typ=E dft="OCM|setup|${W_DFT_MODE}|0|0||${T_TITLE}" dsc='Log the setup details' nam=- #------------------------------------------------------------------------------ # Post requests #------------------------------------------------------------------------------ [do_config] typ=T dft='RDA:OCMinit' dsc='Configure OCM in a post package treatment' nam=T_POST_PACKAGE_INIT [do_install] typ=T dft='RDA:OCMsetup' dsc='Install OCM in a post package treatment' nam=T_POST_PACKAGE_SETUP