Wanlong Gao
2012-Apr-27 06:18 UTC
[Libguestfs] [PATCH 1/2] sysprep: remove the logfiles configured by logrotate
Remove the logfiles configured by /etc/logrotate.d/*. Omit the logfile of "samba" and "sssd" which we removed them separately . Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- sysprep/sysprep_operation_logfiles.ml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sysprep/sysprep_operation_logfiles.ml b/sysprep/sysprep_operation_logfiles.ml index 2ad3726..cf72803 100644 --- a/sysprep/sysprep_operation_logfiles.ml +++ b/sysprep/sysprep_operation_logfiles.ml @@ -38,6 +38,27 @@ let globs = List.sort compare [ "/var/log/tallylog*"; "/var/log/wtmp*"; + (* logfiles configured by /etc/logrotate.d/* *) + "/var/log/BackupPC/LOG"; + "/var/log/ceph/*.log"; + "/var/log/chrony/*.log"; + "/var/log/cups/*_log"; + "/var/log/glusterfs/*glusterd.vol.log"; + "/var/log/glusterfs/glusterfs.log"; + "/var/log/httpd/*log"; + "/var/log/jetty/jetty-console.log"; + "/var/log/libvirt/libvirtd.log"; + "/var/log/libvirt/lxc/*.log"; + "/var/log/libvirt/qemu/*.log"; + "/var/log/libvirt/uml/*.log"; + "/var/named/data/named.run"; + "/var/log/ppp/connect-errors"; + "/var/account/pacct"; + "/var/log/setroubleshoot/*.log"; + "/var/log/squid/*.log"; + (* And the status file of logrotate *) + "/var/lib/logrotate.status"; + (* yum installation files *) "/root/install.log"; "/root/install.log.syslog"; -- 1.7.10
Wanlong Gao
2012-Apr-27 06:18 UTC
[Libguestfs] [PATCH 2/2] sysprep: Remove the data of dovecot
Remove the data of dovecot. Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> --- sysprep/Makefile.am | 2 ++ sysprep/sysprep_operation_dovecot_data.ml | 43 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 sysprep/sysprep_operation_dovecot_data.ml diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index e2b4806..2424071 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -37,6 +37,7 @@ SOURCES = \ sysprep_operation_cron_spool.ml \ sysprep_operation_dhcp_client_state.ml \ sysprep_operation_dhcp_server_state.ml \ + sysprep_operation_dovecot_data.ml \ sysprep_operation_flag_reconfiguration.ml \ sysprep_operation_hostname.ml \ sysprep_operation_logfiles.ml \ @@ -67,6 +68,7 @@ OBJECTS = \ sysprep_operation_cron_spool.cmx \ sysprep_operation_dhcp_client_state.cmx \ sysprep_operation_dhcp_server_state.cmx \ + sysprep_operation_dovecot_data.cmx \ sysprep_operation_flag_reconfiguration.cmx \ sysprep_operation_hostname.cmx \ sysprep_operation_logfiles.cmx \ diff --git a/sysprep/sysprep_operation_dovecot_data.ml b/sysprep/sysprep_operation_dovecot_data.ml new file mode 100644 index 0000000..bf01ef4 --- /dev/null +++ b/sysprep/sysprep_operation_dovecot_data.ml @@ -0,0 +1,43 @@ +(* virt-sysprep + * Copyright (C) 2012 FUJITSU LIMITED + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation + +module G = Guestfs + +let dovecot_data_perform g root + let typ = g#inspect_get_type root in + if typ <> "windows" then ( + let files = g#glob_expand "/var/lib/dovecot/*" in + Array.iter ( + fun file -> try g#rm file with G.Error _ -> () + ) files; + [] + ) + else [] + +let dovecot_data_op = { + name = "dovecot-data"; + enabled_by_default = true; + heading = "Remove the data of dovecot"; + pod_description = None; + extra_args = []; + perform = dovecot_data_perform; +} + +let () = register_operation dovecot_data_op -- 1.7.10
Richard W.M. Jones
2012-Apr-27 07:38 UTC
[Libguestfs] [PATCH 1/2] sysprep: remove the logfiles configured by logrotate
On Fri, Apr 27, 2012 at 02:18:52PM +0800, Wanlong Gao wrote:> Remove the logfiles configured by /etc/logrotate.d/*. > Omit the logfile of "samba" and "sssd" which we removed > them separately . > > Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com> > --- > sysprep/sysprep_operation_logfiles.ml | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/sysprep/sysprep_operation_logfiles.ml b/sysprep/sysprep_operation_logfiles.ml > index 2ad3726..cf72803 100644 > --- a/sysprep/sysprep_operation_logfiles.ml > +++ b/sysprep/sysprep_operation_logfiles.ml > @@ -38,6 +38,27 @@ let globs = List.sort compare [ > "/var/log/tallylog*"; > "/var/log/wtmp*"; > > + (* logfiles configured by /etc/logrotate.d/* *) > + "/var/log/BackupPC/LOG"; > + "/var/log/ceph/*.log"; > + "/var/log/chrony/*.log"; > + "/var/log/cups/*_log"; > + "/var/log/glusterfs/*glusterd.vol.log"; > + "/var/log/glusterfs/glusterfs.log"; > + "/var/log/httpd/*log"; > + "/var/log/jetty/jetty-console.log"; > + "/var/log/libvirt/libvirtd.log"; > + "/var/log/libvirt/lxc/*.log"; > + "/var/log/libvirt/qemu/*.log"; > + "/var/log/libvirt/uml/*.log"; > + "/var/named/data/named.run"; > + "/var/log/ppp/connect-errors"; > + "/var/account/pacct"; > + "/var/log/setroubleshoot/*.log"; > + "/var/log/squid/*.log"; > + (* And the status file of logrotate *) > + "/var/lib/logrotate.status"; > + > (* yum installation files *) > "/root/install.log"; > "/root/install.log.syslog";ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top
Possibly Parallel Threads
- [PATCH] sysprep: remove kerberos data in the guest
- [PATCH 1/2] sysprep: Update comments.
- [PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
- [PATCH] sysprep: flag the system for reconfiguration
- [PATCH] sysprep: remove the process accounting log files