# M205PTCH.def: Collects Installed Patches Information # $Id: M205PTCH.def,v 1.5 2012/08/10 21:10:59 mschenke Exp $ # ARCS:$Header: /home/cvs/cvs/RDA_4/src/scripting/lib/modules/M205PTCH.def,v 1.5 2012/08/10 21:10:59 mschenke Exp $ # # Change History # 20120810 MSC Improve the collection. =head1 NAME M205PTCH - Collects Installed Patches Information =head1 DESCRIPTION This module collects information about installed patches. =cut use Mrc # Initialization var @COMMON_SECTIONS=('XPLR_all') var $VALIDATE = true keep $VALIDATE,@COMMON_SECTIONS section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run XPLRlib('patch') # ----------------------------------------------------------------------------- # XPLR_patch section # ----------------------------------------------------------------------------- section XPLR_patch # Validate the execution context if !${OS.solaris} return call log_run('Processing PTCH sections ...') =head2 Installed Patches Information Gathers information about the patches installed in different zones. =cut pretoc '2:Installed Patches' # Perform the collection loop $rec (get_zones(true)) {if defined($nam = $rec->[0]) {var ($ttl,$pre,$exe) = (concat('From Zone ',$nam),\ concat('zones/',$nam),\ concat('/usr/sbin/zlogin ',$nam)) call log_info(concat('patch: RUNNING: zone ',$nam),\ concat(' Inside PTCH collection, collecting from zone ',$nam,\ ' (can take time)')) } else var ($nam,$ttl,$pre,$exe) = ('global','From Global Zone') var $top = $rec->[1] # Determine what to collect var (@cmd,%tbl) = () if testFile('f',catFile($top,'/usr/bin/showrev')) {call push(@cmd,\ ['patch+pkg/showrev',\ '/usr/bin/showrev',undef,\ '---+ Machine and Software Revision'],\ ['patch+pkg/showrev-p',\ '/usr/bin/showrev','-p',\ '---+ Applied Patches']) var $cmd = join(' ',$exe,'/usr/bin/showrev -p') } else {call push(@cmd,\ ['patch+pkg/patchadd-p',\ '/usr/sbin/patchadd','-p',\ '---+ Applied Patches']) var $cmd = join(' ',$exe,'/usr/sbin/patchadd -p') } # Get the patch list loop $ptc (grepCommand($cmd,'^Patch\S*\s+(\S+)','1')) var $tbl{$ptc} = $ptc call push(@cmd,\ {cmd => 'HASH',\ nam => 'patch+pkg/patch-list',\ tbl => \%tbl,\ ttl => '---+ Patch List'}) # Add the directory listings if testFile('d',catFile($top,'/var/sadm/patch')) call push(@cmd,\ ['patch+pkg/patch_date',\ '/usr/bin/ls','-l /var/sadm/patch',\ '---+ Contents of /var/sadm/patch Directory'],\ ['patch+pkg/patch_listing',\ '/usr/bin/ls','-almtr /var/sadm/patch',\ '---+ Detailed Contents of /var/sadm/patch Directory',true]) # Produce the report report concat('ptch_z_',$nam) title '---+!! ',$ttl title $TOC call do_remote($pre,$exe,$top,@cmd) if isCreated(true) toc '3:[[',getFile(),'][rda_report][',$ttl,']]' } # Adjust the table of content unpretoc =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2012, 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