Richard W.M. Jones
2017-Feb-28 15:48 UTC
[Libguestfs] [PATCH] sysprep: Remove DHCP_HOSTNAME= from ifcfg-* files (RHBZ#1427529).
--- sysprep/sysprep_operation_net_hostname.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sysprep/sysprep_operation_net_hostname.ml b/sysprep/sysprep_operation_net_hostname.ml index 3824d42..7284d63 100644 --- a/sysprep/sysprep_operation_net_hostname.ml +++ b/sysprep/sysprep_operation_net_hostname.ml @@ -30,10 +30,12 @@ let net_hostname_perform (g : Guestfs.guestfs) root side_effects let filenames = g#glob_expand "/etc/sysconfig/network-scripts/ifcfg-*" in Array.iter ( fun filename -> - (* Replace HOSTNAME=... entry. *) + (* Remove HOSTNAME=... and DHCP_HOSTNAME=... entries. *) let lines = Array.to_list (g#read_lines filename) in let lines = List.filter ( - fun line -> not (String.is_prefix line "HOSTNAME=") + fun line -> + not (String.is_prefix line "HOSTNAME=") && + not (String.is_prefix line "DHCP_HOSTNAME=") ) lines in let file = String.concat "\n" lines ^ "\n" in g#write filename file; @@ -46,7 +48,7 @@ let op = { defaults with name = "net-hostname"; enabled_by_default = true; - heading = s_"Remove HOSTNAME in network interface configuration"; + heading = s_"Remove HOSTNAME and DHCP_HOSTNAME in network interface configuration"; pod_description = Some (s_"\ For Fedora and Red Hat Enterprise Linux, this is removed from C<ifcfg-*> files."); -- 2.9.3
Pino Toscano
2017-Feb-28 17:04 UTC
Re: [Libguestfs] [PATCH] sysprep: Remove DHCP_HOSTNAME= from ifcfg-* files (RHBZ#1427529).
On Tuesday, 28 February 2017 16:48:48 CET Richard W.M. Jones wrote:> --- > sysprep/sysprep_operation_net_hostname.ml | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-)LGTM. Thanks, -- Pino Toscano
Seemingly Similar Threads
- [PATCH] sysprep: remove hostname from ifcfg-*
- Re: [PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
- [PATCH 1/3] sysprep, get-kernel: explicit the Guestfs parameter
- [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
- DHCP_HOSTNAME in ifcfg-eth0