[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH RFC] sysprep:add logging feature



Hi Rich,

What I felt at using virt-sysprep is that all things are done in silent and
there is no log what's done. Please consider to add logging feature what was done
at virt-sysprep. For example,

deleted /var/log/utmp
deleted /etc/.....
modified /etc/sysconfing/network...
...

What do you think?

Thanks,
Wanlong Gao

Signed-off-by: Wanlong Gao <gaowanlong cn fujitsu com>
---
 sysprep/sysprep_operation_cron_spool.ml        |    2 ++
 sysprep/sysprep_operation_dhcp_client_state.ml |    2 ++
 sysprep/sysprep_operation_dhcp_server_state.ml |    2 ++
 sysprep/sysprep_operation_hostname.ml          |    2 ++
 4 files changed, 8 insertions(+)

diff --git a/sysprep/sysprep_operation_cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml
index e67688b..cec18e0 100644
--- a/sysprep/sysprep_operation_cron_spool.ml
+++ b/sysprep/sysprep_operation_cron_spool.ml
@@ -16,12 +16,14 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
+open Printf
 open Sysprep_operation
 
 module G = Guestfs
 
 let cron_spool_perform g root =
   Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*");
+  eprintf "Deleted /var/spool/cron/*\n";
   []
 
 let cron_spool_op = {
diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml b/sysprep/sysprep_operation_dhcp_client_state.ml
index e3e87cb..18415c5 100644
--- a/sysprep/sysprep_operation_dhcp_client_state.ml
+++ b/sysprep/sysprep_operation_dhcp_client_state.ml
@@ -16,6 +16,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
+open Printf
 open Sysprep_operation
 
 module G = Guestfs
@@ -27,6 +28,7 @@ let dhcp_client_state_perform g root =
       fun glob -> Array.iter g#rm_rf (g#glob_expand glob)
     ) [ "/var/lib/dhclient/*"; "/var/lib/dhcp/*" (* RHEL 3 *) ]
   );
+  eprintf "Deleted /var/lib/dhclient/* /var/lib/dhcp/*\n";
   []
 
 let dhcp_client_state_op = {
diff --git a/sysprep/sysprep_operation_dhcp_server_state.ml b/sysprep/sysprep_operation_dhcp_server_state.ml
index c5251ce..87cb2ed 100644
--- a/sysprep/sysprep_operation_dhcp_server_state.ml
+++ b/sysprep/sysprep_operation_dhcp_server_state.ml
@@ -16,12 +16,14 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
+open Printf
 open Sysprep_operation
 
 module G = Guestfs
 
 let dhcp_server_state_perform g root =
   Array.iter g#rm_rf (g#glob_expand "/var/lib/dhcpd/*");
+  eprintf "Deleted /var/lib/dhcpd/*\n";
   []
 
 let dhcp_server_state_op = {
diff --git a/sysprep/sysprep_operation_hostname.ml b/sysprep/sysprep_operation_hostname.ml
index 1472a1c..6caf8d7 100644
--- a/sysprep/sysprep_operation_hostname.ml
+++ b/sysprep/sysprep_operation_hostname.ml
@@ -42,10 +42,12 @@ let hostname_perform g root =
       String.concat "\n" lines ^
       sprintf "\nHOSTNAME=%s\n" !hostname in
     g#write filename file;
+    eprintf "Modified HOSTNAME to %s\n" !hostname;
     [ `Created_files ]
 
   | "linux", ("debian"|"ubuntu") ->
     g#write "/etc/hostname" !hostname;
+    eprintf "Modified HOSTNAME to %s\n" !hostname;
     [ `Created_files ]
 
   | _ -> []
-- 
1.7.10.rc3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]