On Wednesday 04 May 2016 14:12:30 Richard W.M. Jones wrote: > For Windows, we now print: > > $ virt-customize -a ./test-data/phony-guests/windows.img --install MSSQL > [ 0.0] Examining the guest ... > [ 14.2] Setting a random seed > virt-customize: warning: random seed could not be set for this type of > guest > [ 14.2] Installing packages: MSSQL > virt-customize: error: '--install' failed because inspection could not > determine the package manager for this guest OS. > > If this guest OS is a common one with ordinary package management then this > may have been caused by a failure of libguestfs inspection. > > For OSes such as Windows that lack package management, this is not > possible. Try using one of the '--firstboot*' flags instead (described in > the manual). > --- > customize/customize_run.ml | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > > diff --git a/customize/customize_run.ml b/customize/customize_run.ml > index 83e70a6..c0e1e44 100644 > --- a/customize/customize_run.ml > +++ b/customize/customize_run.ml > @@ -94,7 +94,7 @@ exec >>%s 2>&1 > in > > (* http://distrowatch.com/dwres.php?resource=package-management *) > - let guest_install_command packages = > + let rec guest_install_command packages = > let quoted_args = String.concat " " (List.map quote packages) in > match g#inspect_get_package_management root with > | "apk" -> > @@ -116,10 +116,11 @@ exec >>%s 2>&1 > | "urpmi" -> sprintf "urpmi %s" quoted_args > | "yum" -> sprintf "yum -y install %s" quoted_args > | "zypper" -> sprintf "zypper -n in -l %s" quoted_args > + > | "unknown" -> > - error (f_"--install is not supported for this guest operating system") > + error_unknown_package_manager (s_"--install") > | pm -> > - error (f_"sorry, don't know how to use --install with the '%s' package > manager") pm > + error_unimplemented_package_manager (s_"--install") pm > > and guest_update_command () = > match g#inspect_get_package_management root with > @@ -142,10 +143,18 @@ exec >>%s 2>&1 > | "urpmi" -> "urpmi --auto-select" > | "yum" -> "yum -y update" > | "zypper" -> "zypper -n update -l" > + > | "unknown" -> > - error (f_"--update is not supported for this guest operating system") > + error_unknown_package_manager (s_"--update") > | pm -> > - error (f_"sorry, don't know how to use --update with the '%s' package > manager") pm > + error_unimplemented_package_manager (s_"--update") pm > + > + (* Windows has package_management == "unknown". *) > + and error_unknown_package_manager flag = > + error (f_"'%s' failed because inspection could not determine the package > manager for this guest OS.\n\nIf this guest OS is a common one with ordinary > package management then this may have been caused by a failure of libguestfs > inspection.\n\nFor OSes such as Windows that lack package management, this is > not possible. Try using one of the '--firstboot*' flags instead (described > in the manual).") flag
what about "cannot run '%s' because no package management has been detected for this guest OS.\n etc" > + > + and error_unimplemented_package_manager flag pm = > + error (f_"sorry, '%s' with the '%s' package manager has not been > implemented.\n\nIf this guest OS has ordinary package management then you > will need to add support to virt-customize.\n\nFor OSes lack package > management, this is not possible.\n\nYou can work around this by using one of > the '--run*' or '--firstboot*' options instead (described in the manual).") > flag pm I'd shorten this message: "sorry, '%s' with the '%s' package manager has not been implemented yet.\n\nYou can work around this by using one of the '--run*' or '--firstboot*' options instead (described in the manual)." rationale behind that: - telling users to add support for that is not exactly useful, and what will happen in such cases is that we get reports with that - if the OS lacks package management, then the result will be "unknown" and thus the other message will be shown - this would be shown in virt-builder, other than virt-customize (but that's just a minor point) -- Pino Toscano
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
