From: "Richard W.M. Jones" <rjones(a)redhat.com>
- Use 'op' instead of 'xxx_op' for operation table.
- Add a 'defaults' for the operation table and remove any default
values.
This is just code motion and there is no functional change.
(cherry picked from commit 4cdbae926bb336c8d0dea8e7b6e0dcc3fb219c2d)
---
sysprep/sysprep_operation.ml | 9 ++++++
sysprep/sysprep_operation.mli | 3 ++
sysprep/sysprep_operation_abrt_data.ml | 17 ++++++------
sysprep/sysprep_operation_bash_history.ml | 17 ++++++------
sysprep/sysprep_operation_blkid_tab.ml | 16 +++++------
sysprep/sysprep_operation_ca_certificates.ml | 16 +++++------
sysprep/sysprep_operation_crash_data.ml | 17 ++++++------
sysprep/sysprep_operation_cron_spool.ml | 16 +++++------
sysprep/sysprep_operation_dhcp_client_state.ml | 16 +++++------
sysprep/sysprep_operation_dhcp_server_state.ml | 16 +++++------
sysprep/sysprep_operation_dovecot_data.ml | 16 +++++------
sysprep/sysprep_operation_firstboot.ml | 32 +++++++++++-----------
sysprep/sysprep_operation_flag_reconfiguration.ml | 17 ++++++------
sysprep/sysprep_operation_hostname.ml | 24 ++++++++--------
sysprep/sysprep_operation_kerberos_data.ml | 16 +++++------
sysprep/sysprep_operation_logfiles.ml | 19 ++++++-------
sysprep/sysprep_operation_lvm_uuids.ml | 17 ++++++------
sysprep/sysprep_operation_machine_id.ml | 17 ++++++------
sysprep/sysprep_operation_mail_spool.ml | 16 +++++------
sysprep/sysprep_operation_net_hostname.ml | 17 ++++++------
sysprep/sysprep_operation_net_hwaddr.ml | 17 ++++++------
sysprep/sysprep_operation_pacct_log.ml | 17 ++++++------
sysprep/sysprep_operation_package_manager_cache.ml | 16 +++++------
sysprep/sysprep_operation_pam_data.ml | 16 +++++------
sysprep/sysprep_operation_puppet_data_log.ml | 16 +++++------
sysprep/sysprep_operation_random_seed.ml | 17 ++++++------
sysprep/sysprep_operation_rhn_systemid.ml | 16 +++++------
sysprep/sysprep_operation_samba_db_log.ml | 16 +++++------
sysprep/sysprep_operation_script.ml | 28 +++++++++----------
sysprep/sysprep_operation_smolt_uuid.ml | 16 +++++------
sysprep/sysprep_operation_ssh_hostkeys.ml | 17 ++++++------
sysprep/sysprep_operation_ssh_userdir.ml | 17 ++++++------
sysprep/sysprep_operation_sssd_db_log.ml | 16 +++++------
sysprep/sysprep_operation_udev_persistent_net.ml | 17 ++++++------
sysprep/sysprep_operation_user_account.ml | 17 ++++++------
sysprep/sysprep_operation_utmp.ml | 17 ++++++------
sysprep/sysprep_operation_yum_uuid.ml | 17 ++++++------
37 files changed, 296 insertions(+), 331 deletions(-)
diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
index 2adddba..64a6390 100644
--- a/sysprep/sysprep_operation.ml
+++ b/sysprep/sysprep_operation.ml
@@ -35,6 +35,15 @@ type operation = {
perform_on_filesystems : callback option;
perform_on_devices : callback option;
}
+let defaults = {
+ name = "";
+ enabled_by_default = false;
+ heading = "";
+ pod_description = None;
+ extra_args = [];
+ perform_on_filesystems = None;
+ perform_on_devices = None;
+}
let all_operations = ref []
let enabled_by_default_operations = ref []
diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli
index 87a0b9a..6b792cd 100644
--- a/sysprep/sysprep_operation.mli
+++ b/sysprep/sysprep_operation.mli
@@ -75,6 +75,9 @@ type operation = {
operation to work directly on block devices, LVs etc. *)
}
+val defaults : operation
+(** This is so operations can write [let op = { defaults with ... }]. *)
+
val register_operation : operation -> unit
(** Register an operation. *)
diff --git a/sysprep/sysprep_operation_abrt_data.ml
b/sysprep/sysprep_operation_abrt_data.ml
index c830bd4..d923fec 100644
--- a/sysprep/sysprep_operation_abrt_data.ml
+++ b/sysprep/sysprep_operation_abrt_data.ml
@@ -32,16 +32,15 @@ let abrt_data_perform g root =
)
else []
-let abrt_data_op = {
- name = "abrt-data";
- enabled_by_default = true;
- heading = s_"Remove the crash data generated by ABRT";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "abrt-data";
+ enabled_by_default = true;
+ heading = s_"Remove the crash data generated by ABRT";
+ pod_description = Some (s_"\
Remove the automatically generated ABRT crash data in
C</var/spool/abrt/>.");
- extra_args = [];
- perform_on_filesystems = Some abrt_data_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some abrt_data_perform;
}
-let () = register_operation abrt_data_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_bash_history.ml
b/sysprep/sysprep_operation_bash_history.ml
index 6e1bd3f..56da23e 100644
--- a/sysprep/sysprep_operation_bash_history.ml
+++ b/sysprep/sysprep_operation_bash_history.ml
@@ -33,16 +33,15 @@ let bash_history_perform g root =
)
else []
-let bash_history_op = {
- name = "bash-history";
- enabled_by_default = true;
- heading = s_"Remove the bash history in the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "bash-history";
+ enabled_by_default = true;
+ heading = s_"Remove the bash history in the guest";
+ pod_description = Some (s_"\
Remove the bash history of user \"root\" and any other users
who have a C<.bash_history> file in their home directory.");
- extra_args = [];
- perform_on_filesystems = Some bash_history_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some bash_history_perform;
}
-let () = register_operation bash_history_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_blkid_tab.ml
b/sysprep/sysprep_operation_blkid_tab.ml
index c75c3f3..fe9d10f 100644
--- a/sysprep/sysprep_operation_blkid_tab.ml
+++ b/sysprep/sysprep_operation_blkid_tab.ml
@@ -43,14 +43,12 @@ let blkid_tab_perform g root =
)
else []
-let blkid_tab_op = {
- name = "blkid-tab";
- enabled_by_default = true;
- heading = s_"Remove blkid tab in the guest";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some blkid_tab_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "blkid-tab";
+ enabled_by_default = true;
+ heading = s_"Remove blkid tab in the guest";
+ perform_on_filesystems = Some blkid_tab_perform;
}
-let () = register_operation blkid_tab_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_ca_certificates.ml
b/sysprep/sysprep_operation_ca_certificates.ml
index 9b0d396..86a9c54 100644
--- a/sysprep/sysprep_operation_ca_certificates.ml
+++ b/sysprep/sysprep_operation_ca_certificates.ml
@@ -47,14 +47,12 @@ let ca_certificates_perform g root =
)
else []
-let ca_certificates_op = {
- name = "ca-certificates";
- enabled_by_default = false;
- heading = s_"Remove CA certificates in the guest";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some ca_certificates_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "ca-certificates";
+ enabled_by_default = false;
+ heading = s_"Remove CA certificates in the guest";
+ perform_on_filesystems = Some ca_certificates_perform;
}
-let () = register_operation ca_certificates_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_crash_data.ml
b/sysprep/sysprep_operation_crash_data.ml
index 1746cac..edeb5e2 100644
--- a/sysprep/sysprep_operation_crash_data.ml
+++ b/sysprep/sysprep_operation_crash_data.ml
@@ -33,15 +33,14 @@ let crash_data_perform g root =
);
[]
-let crash_data_op = {
- name = "crash-data";
- enabled_by_default = true;
- heading = s_"Remove the crash data generated by kexec-tools";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "crash-data";
+ enabled_by_default = true;
+ heading = s_"Remove the crash data generated by kexec-tools";
+ pod_description = Some (s_"\
Remove the automatically generated kdump kernel crash data.");
- extra_args = [];
- perform_on_filesystems = Some crash_data_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some crash_data_perform;
}
-let () = register_operation crash_data_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_cron_spool.ml
b/sysprep/sysprep_operation_cron_spool.ml
index f61769d..1a036dd 100644
--- a/sysprep/sysprep_operation_cron_spool.ml
+++ b/sysprep/sysprep_operation_cron_spool.ml
@@ -33,14 +33,12 @@ let cron_spool_perform (g : Guestfs.guestfs) root =
Array.iter g#rm (g#glob_expand "/var/spool/at/spool/*");
[]
-let cron_spool_op = {
- name = "cron-spool";
- enabled_by_default = true;
- heading = s_"Remove user at-jobs and cron-jobs";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some cron_spool_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "cron-spool";
+ enabled_by_default = true;
+ heading = s_"Remove user at-jobs and cron-jobs";
+ perform_on_filesystems = Some cron_spool_perform;
}
-let () = register_operation cron_spool_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml
b/sysprep/sysprep_operation_dhcp_client_state.ml
index fcda3d5..69c506f 100644
--- a/sysprep/sysprep_operation_dhcp_client_state.ml
+++ b/sysprep/sysprep_operation_dhcp_client_state.ml
@@ -30,14 +30,12 @@ let dhcp_client_state_perform g root =
);
[]
-let dhcp_client_state_op = {
- name = "dhcp-client-state";
- enabled_by_default = true;
- heading = s_"Remove DHCP client leases";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some dhcp_client_state_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "dhcp-client-state";
+ enabled_by_default = true;
+ heading = s_"Remove DHCP client leases";
+ perform_on_filesystems = Some dhcp_client_state_perform;
}
-let () = register_operation dhcp_client_state_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_dhcp_server_state.ml
b/sysprep/sysprep_operation_dhcp_server_state.ml
index a713cbd..9ef2abf 100644
--- a/sysprep/sysprep_operation_dhcp_server_state.ml
+++ b/sysprep/sysprep_operation_dhcp_server_state.ml
@@ -25,14 +25,12 @@ let dhcp_server_state_perform g root =
Array.iter g#rm_rf (g#glob_expand "/var/lib/dhcpd/*");
[]
-let dhcp_server_state_op = {
- name = "dhcp-server-state";
- enabled_by_default = true;
- heading = s_"Remove DHCP server leases";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some dhcp_server_state_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "dhcp-server-state";
+ enabled_by_default = true;
+ heading = s_"Remove DHCP server leases";
+ perform_on_filesystems = Some dhcp_server_state_perform;
}
-let () = register_operation dhcp_server_state_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_dovecot_data.ml
b/sysprep/sysprep_operation_dovecot_data.ml
index 8a1fe49..c2004e8 100644
--- a/sysprep/sysprep_operation_dovecot_data.ml
+++ b/sysprep/sysprep_operation_dovecot_data.ml
@@ -32,14 +32,12 @@ let dovecot_data_perform g root =
)
else []
-let dovecot_data_op = {
- name = "dovecot-data";
- enabled_by_default = true;
- heading = s_"Remove Dovecot (mail server) data";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some dovecot_data_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "dovecot-data";
+ enabled_by_default = true;
+ heading = s_"Remove Dovecot (mail server) data";
+ perform_on_filesystems = Some dovecot_data_perform;
}
-let () = register_operation dovecot_data_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_firstboot.ml
b/sysprep/sysprep_operation_firstboot.ml
index 1e70c65..7c1c497 100644
--- a/sysprep/sysprep_operation_firstboot.ml
+++ b/sysprep/sysprep_operation_firstboot.ml
@@ -48,16 +48,17 @@ let firstboot_perform g root =
) !files;
[ `Created_files ]
-let firstboot_op = {
- name = "firstboot";
+let op = {
+ defaults with
+ name = "firstboot";
- (* enabled_by_default because we only do anything if the
- * --firstboot parameter is used.
- *)
- enabled_by_default = true;
+ (* enabled_by_default because we only do anything if the
+ * --firstboot parameter is used.
+ *)
+ enabled_by_default = true;
- heading = s_"Add scripts to run once at next boot";
- pod_description = Some (s_"\
+ heading = s_"Add scripts to run once at next boot";
+ pod_description = Some (s_"\
Supply one of more shell scripts (using the I<--firstboot> option).
These are run the first time the guest boots, and then are
@@ -71,16 +72,15 @@ C<~root/virt-sysprep-firstboot.log> (in the guest).
Currently this is only implemented for Linux guests using
either System V init, or systemd.");
- extra_args = [
- ("--firstboot", Arg.String (fun s -> files := s :: !files),
- s_"script" ^ " " ^ s_"run script once next time guest
boots"),
- s_"\
+ extra_args = [
+ ("--firstboot", Arg.String (fun s -> files := s :: !files),
+ s_"script" ^ " " ^ s_"run script once next time guest
boots"),
+ s_"\
Run script(s) once next time the guest boots. You can supply
the I<--firstboot> option as many times as needed."
- ];
+ ];
- perform_on_filesystems = Some firstboot_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some firstboot_perform;
}
-let () = register_operation firstboot_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_flag_reconfiguration.ml
b/sysprep/sysprep_operation_flag_reconfiguration.ml
index 761d5eb..25abfef 100644
--- a/sysprep/sysprep_operation_flag_reconfiguration.ml
+++ b/sysprep/sysprep_operation_flag_reconfiguration.ml
@@ -29,16 +29,15 @@ let flag_reconfiguration g root =
)
else []
-let flag_reconfiguration_op = {
- name = "flag-reconfiguration";
- enabled_by_default = false;
- heading = s_"Flag the system for reconfiguration";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "flag-reconfiguration";
+ enabled_by_default = false;
+ heading = s_"Flag the system for reconfiguration";
+ pod_description = Some (s_"\
Note that this may require user intervention when the
guest is booted.");
- extra_args = [];
- perform_on_filesystems = Some flag_reconfiguration;
- perform_on_devices = None;
+ perform_on_filesystems = Some flag_reconfiguration;
}
-let () = register_operation flag_reconfiguration_op;
+let () = register_operation op;
diff --git a/sysprep/sysprep_operation_hostname.ml
b/sysprep/sysprep_operation_hostname.ml
index e8767f3..ec199f5 100644
--- a/sysprep/sysprep_operation_hostname.ml
+++ b/sysprep/sysprep_operation_hostname.ml
@@ -84,23 +84,23 @@ let hostname_perform (g : Guestfs.guestfs) root =
| _ -> []
-let hostname_op = {
- name = "hostname";
- enabled_by_default = true;
- heading = s_"Change the hostname of the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "hostname";
+ enabled_by_default = true;
+ heading = s_"Change the hostname of the guest";
+ pod_description = Some (s_"\
This operation changes the hostname of the guest to the value
given in the I<--hostname> parameter.
If the I<--hostname> parameter is not given, then the hostname is changed
to C<localhost.localdomain>.");
- extra_args = [
- ("--hostname", Arg.Set_string hostname, s_"hostname" ^ "
" ^ s_"New hostname"),
- s_"\
+ extra_args = [
+ ("--hostname", Arg.Set_string hostname, s_"hostname" ^ "
" ^ s_"New hostname"),
+ s_"\
Change the hostname. If not given, defaults to C<localhost.localdomain>."
- ];
- perform_on_filesystems = Some hostname_perform;
- perform_on_devices = None;
+ ];
+ perform_on_filesystems = Some hostname_perform;
}
-let () = register_operation hostname_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_kerberos_data.ml
b/sysprep/sysprep_operation_kerberos_data.ml
index 1e120aa..0652719 100644
--- a/sysprep/sysprep_operation_kerberos_data.ml
+++ b/sysprep/sysprep_operation_kerberos_data.ml
@@ -40,14 +40,12 @@ let kerberos_data_perform g root =
)
else []
-let kerberos_data_op = {
- name = "kerberos-data";
- enabled_by_default = false;
- heading = s_"Remove Kerberos data in the guest";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some kerberos_data_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "kerberos-data";
+ enabled_by_default = false;
+ heading = s_"Remove Kerberos data in the guest";
+ perform_on_filesystems = Some kerberos_data_perform;
}
-let () = register_operation kerberos_data_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_logfiles.ml
b/sysprep/sysprep_operation_logfiles.ml
index 88b0977..842b855 100644
--- a/sysprep/sysprep_operation_logfiles.ml
+++ b/sysprep/sysprep_operation_logfiles.ml
@@ -90,18 +90,17 @@ let logfiles_perform g root =
);
[]
-let logfiles_op = {
- name = "logfiles";
- enabled_by_default = true;
- heading = s_"Remove many log files from the guest";
- pod_description = Some (
- sprintf (f_"\
+let op = {
+ defaults with
+ name = "logfiles";
+ enabled_by_default = true;
+ heading = s_"Remove many log files from the guest";
+ pod_description = Some (
+ sprintf (f_"\
On Linux the following files are removed:
%s") globs_as_pod);
- extra_args = [];
- perform_on_filesystems = Some logfiles_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some logfiles_perform;
}
-let () = register_operation logfiles_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_lvm_uuids.ml
b/sysprep/sysprep_operation_lvm_uuids.ml
index b116d66..7790d0b 100644
--- a/sysprep/sysprep_operation_lvm_uuids.ml
+++ b/sysprep/sysprep_operation_lvm_uuids.ml
@@ -38,16 +38,15 @@ let rec lvm_uuids_perform g root =
);
[]
-let lvm_uuids_op = {
- name = "lvm-uuids";
- enabled_by_default = true;
- heading = s_"Change LVM2 PV and VG UUIDs";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "lvm-uuids";
+ enabled_by_default = true;
+ heading = s_"Change LVM2 PV and VG UUIDs";
+ pod_description = Some (s_"\
On Linux guests that have LVM2 physical volumes (PVs) or volume groups (VGs),
new random UUIDs are generated and assigned to those PVs and VGs.");
- extra_args = [];
- perform_on_filesystems = None;
- perform_on_devices = Some lvm_uuids_perform;
+ perform_on_devices = Some lvm_uuids_perform;
}
-let () = register_operation lvm_uuids_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_machine_id.ml
b/sysprep/sysprep_operation_machine_id.ml
index c826da4..5eadea4 100644
--- a/sysprep/sysprep_operation_machine_id.ml
+++ b/sysprep/sysprep_operation_machine_id.ml
@@ -31,18 +31,17 @@ let machine_id_perform g root =
)
else []
-let machine_id_op = {
- name = "machine-id";
- enabled_by_default = true;
- heading = s_"Remove the local machine ID";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "machine-id";
+ enabled_by_default = true;
+ heading = s_"Remove the local machine ID";
+ pod_description = Some (s_"\
The machine ID is usually generated from a random source during system
installation and stays constant for all subsequent boots. Optionally,
for stateless systems it is generated during runtime at boot if it is
found to be empty.");
- extra_args = [];
- perform_on_filesystems = Some machine_id_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some machine_id_perform;
}
-let () = register_operation machine_id_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_mail_spool.ml
b/sysprep/sysprep_operation_mail_spool.ml
index 1b0cbe3..fa2b4e7 100644
--- a/sysprep/sysprep_operation_mail_spool.ml
+++ b/sysprep/sysprep_operation_mail_spool.ml
@@ -30,14 +30,12 @@ let mail_spool_perform g root =
];
[]
-let mail_spool_op = {
- name = "mail-spool";
- enabled_by_default = true;
- heading = s_"Remove email from the local mail spool directory";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some mail_spool_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "mail-spool";
+ enabled_by_default = true;
+ heading = s_"Remove email from the local mail spool directory";
+ perform_on_filesystems = Some mail_spool_perform;
}
-let () = register_operation mail_spool_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_net_hostname.ml
b/sysprep/sysprep_operation_net_hostname.ml
index 37fb78b..a540357 100644
--- a/sysprep/sysprep_operation_net_hostname.ml
+++ b/sysprep/sysprep_operation_net_hostname.ml
@@ -43,16 +43,15 @@ let net_hostname_perform g root =
| _ -> []
-let net_hostname_op = {
- name = "net-hostname";
- enabled_by_default = true;
- heading = s_"Remove HOSTNAME in network interface configuration";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "net-hostname";
+ enabled_by_default = true;
+ heading = s_"Remove HOSTNAME in network interface configuration";
+ pod_description = Some (s_"\
For Fedora and Red Hat Enterprise Linux,
this is removed from C<ifcfg-*> files.");
- extra_args = [];
- perform_on_filesystems = Some net_hostname_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some net_hostname_perform;
}
-let () = register_operation net_hostname_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_net_hwaddr.ml
b/sysprep/sysprep_operation_net_hwaddr.ml
index fe7fac0..6409767 100644
--- a/sysprep/sysprep_operation_net_hwaddr.ml
+++ b/sysprep/sysprep_operation_net_hwaddr.ml
@@ -43,16 +43,15 @@ let net_hwaddr_perform g root =
| _ -> []
-let net_hwaddr_op = {
- name = "net-hwaddr";
- enabled_by_default = true;
- heading = s_"Remove HWADDR (hard-coded MAC address) configuration";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "net-hwaddr";
+ enabled_by_default = true;
+ heading = s_"Remove HWADDR (hard-coded MAC address) configuration";
+ pod_description = Some (s_"\
For Fedora and Red Hat Enterprise Linux,
this is removed from C<ifcfg-*> files.");
- extra_args = [];
- perform_on_filesystems = Some net_hwaddr_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some net_hwaddr_perform;
}
-let () = register_operation net_hwaddr_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_pacct_log.ml
b/sysprep/sysprep_operation_pacct_log.ml
index f2d47c7..10dc25f 100644
--- a/sysprep/sysprep_operation_pacct_log.ml
+++ b/sysprep/sysprep_operation_pacct_log.ml
@@ -45,16 +45,15 @@ let pacct_log_perform g root =
| _ -> []
-let pacct_log_op = {
- name = "pacct-log";
- enabled_by_default = true;
- heading = s_"Remove the process accounting log files";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "pacct-log";
+ enabled_by_default = true;
+ heading = s_"Remove the process accounting log files";
+ pod_description = Some (s_"\
The system wide process accounting will store to the pacct
log files if the process accounting is on.");
- extra_args = [];
- perform_on_filesystems = Some pacct_log_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some pacct_log_perform;
}
-let () = register_operation pacct_log_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_package_manager_cache.ml
b/sysprep/sysprep_operation_package_manager_cache.ml
index 69c9245..70fed03 100644
--- a/sysprep/sysprep_operation_package_manager_cache.ml
+++ b/sysprep/sysprep_operation_package_manager_cache.ml
@@ -36,14 +36,12 @@ let package_manager_cache_perform g root =
| Some dirs -> Array.iter g#rm_rf dirs; []
| _ -> []
-let package_manager_cache_op = {
- name = "package-manager-cache";
- enabled_by_default = true;
- heading = s_"Remove package manager cache";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some package_manager_cache_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "package-manager-cache";
+ enabled_by_default = true;
+ heading = s_"Remove package manager cache";
+ perform_on_filesystems = Some package_manager_cache_perform;
}
-let () = register_operation package_manager_cache_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_pam_data.ml
b/sysprep/sysprep_operation_pam_data.ml
index 931890d..82c88f9 100644
--- a/sysprep/sysprep_operation_pam_data.ml
+++ b/sysprep/sysprep_operation_pam_data.ml
@@ -40,14 +40,12 @@ let pam_data_perform g root =
)
else []
-let pam_data_op = {
- name = "pam-data";
- enabled_by_default = true;
- heading = s_"Remove the PAM data in the guest";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some pam_data_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "pam-data";
+ enabled_by_default = true;
+ heading = s_"Remove the PAM data in the guest";
+ perform_on_filesystems = Some pam_data_perform;
}
-let () = register_operation pam_data_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_puppet_data_log.ml
b/sysprep/sysprep_operation_puppet_data_log.ml
index 7c4fd89..8094b83 100644
--- a/sysprep/sysprep_operation_puppet_data_log.ml
+++ b/sysprep/sysprep_operation_puppet_data_log.ml
@@ -40,14 +40,12 @@ let puppet_data_log_perform g root =
)
else []
-let puppet_data_log_op = {
- name = "puppet-data-log";
- enabled_by_default = true;
- heading = s_"Remove the data and log files of puppet";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some puppet_data_log_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "puppet-data-log";
+ enabled_by_default = true;
+ heading = s_"Remove the data and log files of puppet";
+ perform_on_filesystems = Some puppet_data_log_perform;
}
-let () = register_operation puppet_data_log_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_random_seed.ml
b/sysprep/sysprep_operation_random_seed.ml
index c3d0dc5..fdb7b11 100644
--- a/sysprep/sysprep_operation_random_seed.ml
+++ b/sysprep/sysprep_operation_random_seed.ml
@@ -45,18 +45,17 @@ let random_seed_perform (g : Guestfs.guestfs) root =
)
else []
-let random_seed_op = {
- name = "random-seed";
- enabled_by_default = true;
- heading = s_"Generate random seed for guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "random-seed";
+ enabled_by_default = true;
+ heading = s_"Generate random seed for guest";
+ pod_description = Some (s_"\
Write some random bytes from the host into the random seed file of the
guest.
See L</RANDOM SEED> below.");
- extra_args = [];
- perform_on_filesystems = Some random_seed_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some random_seed_perform;
}
-let () = register_operation random_seed_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_rhn_systemid.ml
b/sysprep/sysprep_operation_rhn_systemid.ml
index 99ab5e1..d3401b3 100644
--- a/sysprep/sysprep_operation_rhn_systemid.ml
+++ b/sysprep/sysprep_operation_rhn_systemid.ml
@@ -31,14 +31,12 @@ let rhn_systemid_perform g root =
[]
| _ -> []
-let rhn_systemid_op = {
- name = "rhn-systemid";
- enabled_by_default = true;
- heading = s_"Remove the RHN system ID";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some rhn_systemid_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "rhn-systemid";
+ enabled_by_default = true;
+ heading = s_"Remove the RHN system ID";
+ perform_on_filesystems = Some rhn_systemid_perform;
}
-let () = register_operation rhn_systemid_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_samba_db_log.ml
b/sysprep/sysprep_operation_samba_db_log.ml
index 2f6370a..8ed86ca 100644
--- a/sysprep/sysprep_operation_samba_db_log.ml
+++ b/sysprep/sysprep_operation_samba_db_log.ml
@@ -41,14 +41,12 @@ let samba_db_log_perform g root =
)
else []
-let samba_db_log_op = {
- name = "samba-db-log";
- enabled_by_default = true;
- heading = s_"Remove the database and log files of Samba";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some samba_db_log_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "samba-db-log";
+ enabled_by_default = true;
+ heading = s_"Remove the database and log files of Samba";
+ perform_on_filesystems = Some samba_db_log_perform;
}
-let () = register_operation samba_db_log_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index 7dbbf1c..08c8709 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -104,11 +104,12 @@ trap cleanup INT TERM QUIT EXIT ERR\n"
);
pid
-let script_op = {
- name = "script";
- enabled_by_default = true;
- heading = s_"Run arbitrary scripts against the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "script";
+ enabled_by_default = true;
+ heading = s_"Run arbitrary scripts against the guest";
+ pod_description = Some (s_"\
The C<script> module lets you run arbitrary shell scripts or programs
against the guest.
@@ -131,9 +132,9 @@ can choose a specific one by using the I<--scriptdir>
parameter.
B<Note:> This is different from I<--firstboot> scripts (which run
in the context of the guest when it is booting first time).
I<--script> scripts run on the host, not in the guest.");
- extra_args = [
- ("--scriptdir", Arg.String set_scriptdir, s_"dir" ^ " "
^ s_"Mount point on host"),
- s_"\
+ extra_args = [
+ ("--scriptdir", Arg.String set_scriptdir, s_"dir" ^ "
" ^ s_"Mount point on host"),
+ s_"\
The mount point (an empty directory on the host) used when
the C<script> operation is enabled and one or more scripts
are specified using I<--script> parameter(s).
@@ -142,17 +143,16 @@ B<Note:> C<scriptdir> B<must> be an absolute
path.
If I<--scriptdir> is not specified then a temporary mountpoint
will be created.";
- ("--script", Arg.String add_script, s_"script" ^ " " ^
s_"Script or program to run on guest"),
- s_"\
+ ("--script", Arg.String add_script, s_"script" ^ " "
^ s_"Script or program to run on guest"),
+ s_"\
Run the named C<script> (a shell script or program) against the
guest. The script can be any program on the host. The script's
current directory will be the guest's root directory.
B<Note:> If the script is not on the $PATH, then you must give
the full absolute path to the script.";
- ];
- perform_on_filesystems = Some script_perform;
- perform_on_devices = None;
+ ];
+ perform_on_filesystems = Some script_perform;
}
-let () = register_operation script_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_smolt_uuid.ml
b/sysprep/sysprep_operation_smolt_uuid.ml
index 295a260..bb560c4 100644
--- a/sysprep/sysprep_operation_smolt_uuid.ml
+++ b/sysprep/sysprep_operation_smolt_uuid.ml
@@ -35,14 +35,12 @@ let smolt_uuid_perform g root =
)
else []
-let smolt_uuid_op = {
- name = "smolt-uuid";
- enabled_by_default = true;
- heading = s_"Remove the Smolt hardware UUID";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some smolt_uuid_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "smolt-uuid";
+ enabled_by_default = true;
+ heading = s_"Remove the Smolt hardware UUID";
+ perform_on_filesystems = Some smolt_uuid_perform;
}
-let () = register_operation smolt_uuid_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_ssh_hostkeys.ml
b/sysprep/sysprep_operation_ssh_hostkeys.ml
index a382c19..6ed7deb 100644
--- a/sysprep/sysprep_operation_ssh_hostkeys.ml
+++ b/sysprep/sysprep_operation_ssh_hostkeys.ml
@@ -30,11 +30,12 @@ let ssh_hostkeys_perform g root =
)
else []
-let ssh_hostkeys_op = {
- name = "ssh-hostkeys";
- enabled_by_default = true;
- heading = s_"Remove the SSH host keys in the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "ssh-hostkeys";
+ enabled_by_default = true;
+ heading = s_"Remove the SSH host keys in the guest";
+ pod_description = Some (s_"\
The SSH host keys are regenerated (differently) next time the guest is
booted.
@@ -45,9 +46,7 @@ you a stark warning about the host key changing:
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!");
- extra_args = [];
- perform_on_filesystems = Some ssh_hostkeys_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some ssh_hostkeys_perform;
}
-let () = register_operation ssh_hostkeys_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_ssh_userdir.ml
b/sysprep/sysprep_operation_ssh_userdir.ml
index 280e365..54216f3 100644
--- a/sysprep/sysprep_operation_ssh_userdir.ml
+++ b/sysprep/sysprep_operation_ssh_userdir.ml
@@ -33,16 +33,15 @@ let ssh_userdir_perform g root =
)
else []
-let ssh_userdir_op = {
- name = "ssh-userdir";
- enabled_by_default = true;
- heading = s_"Remove \".ssh\" directories in the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "ssh-userdir";
+ enabled_by_default = true;
+ heading = s_"Remove \".ssh\" directories in the guest";
+ pod_description = Some (s_"\
Remove the C<.ssh> directory of user \"root\" and any other
users who have a C<.ssh> directory in their home directory.");
- extra_args = [];
- perform_on_filesystems = Some ssh_userdir_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some ssh_userdir_perform;
}
-let () = register_operation ssh_userdir_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_sssd_db_log.ml
b/sysprep/sysprep_operation_sssd_db_log.ml
index 0e3c518..70c0c44 100644
--- a/sysprep/sysprep_operation_sssd_db_log.ml
+++ b/sysprep/sysprep_operation_sssd_db_log.ml
@@ -39,14 +39,12 @@ let sssd_db_log_perform g root =
)
else []
-let sssd_db_log_op = {
- name = "sssd-db-log";
- enabled_by_default = true;
- heading = s_"Remove the database and log files of sssd";
- pod_description = None;
- extra_args = [];
- perform_on_filesystems = Some sssd_db_log_perform;
- perform_on_devices = None;
+let op = {
+ defaults with
+ name = "sssd-db-log";
+ enabled_by_default = true;
+ heading = s_"Remove the database and log files of sssd";
+ perform_on_filesystems = Some sssd_db_log_perform;
}
-let () = register_operation sssd_db_log_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_udev_persistent_net.ml
b/sysprep/sysprep_operation_udev_persistent_net.ml
index 652b9ab..235ef98 100644
--- a/sysprep/sysprep_operation_udev_persistent_net.ml
+++ b/sysprep/sysprep_operation_udev_persistent_net.ml
@@ -30,11 +30,12 @@ let udev_persistent_net_perform g root =
)
else []
-let udev_persistent_net_op = {
- name = "udev-persistent-net";
- enabled_by_default = true;
- heading = s_"Remove udev persistent net rules";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "udev-persistent-net";
+ enabled_by_default = true;
+ heading = s_"Remove udev persistent net rules";
+ pod_description = Some (s_"\
Remove udev persistent net rules which map the guest's existing MAC
address to a fixed ethernet device (eg. eth0).
@@ -42,9 +43,7 @@ After a guest is cloned, the MAC address usually changes. Since the
old MAC address occupies the old name (eg. eth0), this means the fresh
MAC address is assigned to a new name (eg. eth1) and this is usually
undesirable. Erasing the udev persistent net rules avoids this.");
- extra_args = [];
- perform_on_filesystems = Some udev_persistent_net_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some udev_persistent_net_perform;
}
-let () = register_operation udev_persistent_net_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_user_account.ml
b/sysprep/sysprep_operation_user_account.ml
index c97b9f4..0be7772 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
@@ -58,16 +58,15 @@ let user_account_perform g root =
)
else []
-let user_account_op = {
- name = "user-account";
- enabled_by_default = false;
- heading = s_"Remove the user accounts in the guest";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "user-account";
+ enabled_by_default = false;
+ heading = s_"Remove the user accounts in the guest";
+ pod_description = Some (s_"\
Remove all the user accounts and their home directories.
The \"root\" account is not removed.");
- extra_args = [];
- perform_on_filesystems = Some user_account_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some user_account_perform;
}
-let () = register_operation user_account_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_utmp.ml b/sysprep/sysprep_operation_utmp.ml
index 3e1cab5..be73e16 100644
--- a/sysprep/sysprep_operation_utmp.ml
+++ b/sysprep/sysprep_operation_utmp.ml
@@ -29,17 +29,16 @@ let utmp_perform g root =
);
[]
-let utmp_op = {
- name = "utmp";
- enabled_by_default = true;
- heading = s_"Remove the utmp file";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "utmp";
+ enabled_by_default = true;
+ heading = s_"Remove the utmp file";
+ pod_description = Some (s_"\
This file records who is currently logged in on a machine. In modern
Linux distros it is stored in a ramdisk and hence not part of the
virtual machine's disk, but it was stored on disk in older distros.");
- extra_args = [];
- perform_on_filesystems = Some utmp_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some utmp_perform;
}
-let () = register_operation utmp_op
+let () = register_operation op
diff --git a/sysprep/sysprep_operation_yum_uuid.ml
b/sysprep/sysprep_operation_yum_uuid.ml
index 8a864b1..8ffe664 100644
--- a/sysprep/sysprep_operation_yum_uuid.ml
+++ b/sysprep/sysprep_operation_yum_uuid.ml
@@ -29,16 +29,15 @@ let yum_uuid_perform g root =
)
else []
-let yum_uuid_op = {
- name = "yum-uuid";
- enabled_by_default = true;
- heading = s_"Remove the yum UUID";
- pod_description = Some (s_"\
+let op = {
+ defaults with
+ name = "yum-uuid";
+ enabled_by_default = true;
+ heading = s_"Remove the yum UUID";
+ pod_description = Some (s_"\
Yum creates a fresh UUID the next time it runs when it notices that the
original UUID has been erased.");
- extra_args = [];
- perform_on_filesystems = Some yum_uuid_perform;
- perform_on_devices = None;
+ perform_on_filesystems = Some yum_uuid_perform;
}
-let () = register_operation yum_uuid_op
+let () = register_operation op
--
1.8.3.1