Richard W.M. Jones
2018-Nov-19 19:09 UTC
[Libguestfs] [PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
Previously: $ virt-v2v -v -x -i disk fedora-28.img -o openstack -oo server-id=foo virt-v2v: libguestfs 1.39.11fedora=29,release=1.fc29,libvirt (x86_64) libvirt version: 4.5.0 virt-v2v: error: openstack: precheck failed, there may be a problem with authentication, see earlier error messages rm -rf '/var/tmp/null.dTxRFN' Notice there is no "earlier error message". After this commit the error changes to: openstack: executable not found virt-v2v: error: openstack: precheck failed, there may be a problem with authentication, see earlier error messages --- common/mltools/tools_utils.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index ad08d05eb..298d89b4d 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -420,9 +420,11 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args Either (pid, app, stdout_fd, stderr_fd) with | Executable_not_found _ -> - Or 127 - | Unix.Unix_error (errcode, _, _) when errcode = Unix.ENOENT -> - Or 127 + debug "%s: executable not found" app; + Or 127 + | Unix.Unix_error (errcode, fn, _) when errcode = Unix.ENOENT -> + debug "%s: %s: executable not found" app fn; + Or 127 and do_teardown app outfd errfd exitstat Option.may Unix.close outfd; -- 2.19.0.rc0
Pino Toscano
2018-Nov-20 09:06 UTC
Re: [Libguestfs] [PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
On Monday, 19 November 2018 20:09:34 CET Richard W.M. Jones wrote:> Previously: > > $ virt-v2v -v -x -i disk fedora-28.img -o openstack -oo server-id=foo > virt-v2v: libguestfs 1.39.11fedora=29,release=1.fc29,libvirt (x86_64) > libvirt version: 4.5.0 > virt-v2v: error: openstack: precheck failed, there may be a problem with > authentication, see earlier error messages > rm -rf '/var/tmp/null.dTxRFN' > > Notice there is no "earlier error message". > > After this commit the error changes to: > > openstack: executable not found > virt-v2v: error: openstack: precheck failed, there may be a problem with > authentication, see earlier error messages > --- > common/mltools/tools_utils.ml | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml > index ad08d05eb..298d89b4d 100644 > --- a/common/mltools/tools_utils.ml > +++ b/common/mltools/tools_utils.ml > @@ -420,9 +420,11 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args > Either (pid, app, stdout_fd, stderr_fd) > with > | Executable_not_found _ -> > - Or 127 > - | Unix.Unix_error (errcode, _, _) when errcode = Unix.ENOENT -> > - Or 127 > + debug "%s: executable not found" app; > + Or 127 > + | Unix.Unix_error (errcode, fn, _) when errcode = Unix.ENOENT -> > + debug "%s: %s: executable not found" app fn; > + Or 127This is OK. Though, in the specific case of output_openstack#precheck I'd still check for the existance of the "openstack" executable first, just like what Python_script.error_unless_python_interpreter_found does. This way there is a better error message to cover the case described in the commit message, even in case -v is not passed. -- Pino Toscano
Richard W.M. Jones
2018-Nov-20 09:08 UTC
Re: [Libguestfs] [PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
On Tue, Nov 20, 2018 at 10:06:53AM +0100, Pino Toscano wrote:> On Monday, 19 November 2018 20:09:34 CET Richard W.M. Jones wrote: > > Previously: > > > > $ virt-v2v -v -x -i disk fedora-28.img -o openstack -oo server-id=foo > > virt-v2v: libguestfs 1.39.11fedora=29,release=1.fc29,libvirt (x86_64) > > libvirt version: 4.5.0 > > virt-v2v: error: openstack: precheck failed, there may be a problem with > > authentication, see earlier error messages > > rm -rf '/var/tmp/null.dTxRFN' > > > > Notice there is no "earlier error message". > > > > After this commit the error changes to: > > > > openstack: executable not found > > virt-v2v: error: openstack: precheck failed, there may be a problem with > > authentication, see earlier error messages > > --- > > common/mltools/tools_utils.ml | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml > > index ad08d05eb..298d89b4d 100644 > > --- a/common/mltools/tools_utils.ml > > +++ b/common/mltools/tools_utils.ml > > @@ -420,9 +420,11 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args > > Either (pid, app, stdout_fd, stderr_fd) > > with > > | Executable_not_found _ -> > > - Or 127 > > - | Unix.Unix_error (errcode, _, _) when errcode = Unix.ENOENT -> > > - Or 127 > > + debug "%s: executable not found" app; > > + Or 127 > > + | Unix.Unix_error (errcode, fn, _) when errcode = Unix.ENOENT -> > > + debug "%s: %s: executable not found" app fn; > > + Or 127 > > This is OK. > > Though, in the specific case of output_openstack#precheck I'd still > check for the existance of the "openstack" executable first, just like > what Python_script.error_unless_python_interpreter_found does. This > way there is a better error message to cover the case described in the > commit message, even in case -v is not passed.Yup, I'll push this one and propose an extra patch for virt-v2v to check for the executable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Possibly Parallel Threads
- [PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
- [PATCH 1/5] mltools: split helper do_check_exitcode
- [PATCH 3/3] OCaml: use the new behaviour of Std_utils.which
- [PATCH] v2v: -o rhv-upload: Allow configure commands to set the Python version.
- [PATCH] mltools, options: support --allow-discards when decrypting LUKS devices