search for: do_run

Displaying 20 results from an estimated 35 matches for "do_run".

2016 Jun 13
1
[PATCH v2] sysprep: Add --network to enable the network (RHBZ#1345813).
...dex d4950a2..b96e40c 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -50,7 +50,7 @@ let run (g : Guestfs.guestfs) root (ops : ops) = warning (f_"log file %s: %s (ignored)") logfile (Printexc.to_string exn) in (* Useful wrapper for scripts. *) - let do_run ~display cmd = + let do_run ~display ?(warn_failed_no_network = false) cmd = if not guest_arch_compatible then error (f_"host cpu (%s) and guest arch (%s) are not compatible, so you cannot use command line options that involve running commands in the guest. Use --firstboot script...
2015 May 15
5
[PATCH 0/2] customize: Allow --selinux-relabel flag to work on cross-architecture builds.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1212807
2015 Jul 08
0
[PATCH 6/6] customize: add basic subscription-manager operations
...essage (f_"Scrubbing: %s") path; g#scrub_file path + | `SMAttach id -> + (match id with + | "auto" -> + message (f_"Attaching to compatible subscriptions"); + let cmd = "subscription-manager attach --auto" in + do_run ~display:cmd cmd + | id -> + let pool_id = sm_config_get_value ("attach-" ^ id) "pool" in + message (f_"Attaching to the pool %s") pool_id; + let cmd = sprintf "subscription-manager attach --pool=%s" pool_id in + do_run ~di...
2018 Nov 19
2
[PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
...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 +...
2015 Jul 17
0
[PATCH 2/2] customize: add basic subscription-manager operations
...crubbing: %s") path; g#scrub_file path + | `SMAttach pool -> + (match pool with + | Subscription_manager.PoolAuto -> + message (f_"Attaching to compatible subscriptions"); + let cmd = "subscription-manager attach --auto" in + do_run ~display:cmd cmd + | Subscription_manager.PoolId id -> + message (f_"Attaching to the pool %s") id; + let cmd = sprintf "subscription-manager attach --pool=%s" (quote id) in + do_run ~display:cmd cmd + ) + + | `SMRegister -> + message...
2015 Jul 17
4
[PATCH v2 0/2] basic subscription-manager support in virt-customize
Hi, this is the v2 of a series introducing basic support for registering/attaching/unregistering RHEL guests using subscription-manager, so it is possible to do for example: $ virt-customize -a rhel-guest.qcow2 \ --sm-credentials user:file:/path/to/password-file --sm-register \ --sm-attach file:/path/to/pool-file \ --install pkg1 --install pkg2 .. \ --sm-remove --sm-unregister
2015 May 15
0
[PATCH 2/2] customize: Allow --selinux-relabel flag to work on cross-architecture builds (RHBZ#1212807).
...ux relabelling"); - let cmd = sprintf " - if load_policy && fixfiles restore; then - rm -f /.autorelabel - else - touch /.autorelabel - echo '%s: SELinux relabelling failed, will relabel at boot instead.' - fi - " prog in - do_run ~display:"load_policy && fixfiles restore" cmd + if guest_arch_compatible then ( + let cmd = sprintf " + if load_policy && fixfiles restore; then + rm -f /.autorelabel + else + touch /.autorelabel + echo '%s: SELinu...
2016 May 03
1
[PATCH] customize: remove "core" from description of --update
...ze/customize_run.ml +++ b/customize/customize_run.ml @@ -320,7 +320,7 @@ exec >>%s 2>&1 g#touch path | `Update -> - message (f_"Updating core packages"); + message (f_"Updating packages"); let cmd = guest_update_command () in do_run ~display:cmd cmd diff --git a/generator/customize.ml b/generator/customize.ml index 55ee252..3d3f978 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -427,7 +427,7 @@ This command performs a L<touch(1)>-like operation on C<FILE>."; { op_name = "update&q...
2017 Jun 20
2
[PATCH v2 1/2] mllib: add new Common_utils.run_commands
...command ?(echo_cmd = true) args = - if echo_cmd then - debug "%s" (stringify_args args); +let rec run_commands ?(echo_cmd = true) cmds = + let res = Array.make (List.length cmds) 0 in + let pids = + mapi ( + fun i (args, stdout_chan, stderr_chan) -> + let run_res = do_run args ?stdout_chan ?stderr_chan in + match run_res with + | Either (pid, app, outfd, errfd) -> + Some (i, pid, app, outfd, errfd) + | Or code -> + res.(i) <- code; + None + ) cmds in + let pids = filter_map identity pids in + let pids = r...
2020 May 04
1
[common PATCH] mltools: add run_in_guest_command helper
Add an helper function to run a command in the guest, checking for the host/guest compatibility. This is mostly extracted from the internal do_run helper currently in the Customize_run module of virt-customize. --- mltools/tools_utils.ml | 50 +++++++++++++++++++++++++++++++++++++++++ mltools/tools_utils.mli | 10 +++++++++ 2 files changed, 60 insertions(+) diff --git a/mltools/tools_utils.ml b/mltools/tools_utils.ml index 1271802..d54ec58...
2015 May 15
3
[PATCH v2 0/2] customize: Allow --selinux-relabel flag to work on cross-architecture builds.
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1212807 Since v1: - Combine the virt-builder detection code into virt-customize. - Enables us to delete Architecture and Uname modules completely. Rich.
2023 Jun 29
1
[PATCH guestfs-tools] customize: Implement --chown option
...error (f_"--chown: could not parse numeric UID.GID from \ + %s") uid_gid in + + message (f_"Changing owner of %s to %d.%d") path uid gid; + g#chown uid gid path + | `Command cmd -> message (f_"Running: %s") cmd; do_run ~display:cmd cmd -- 2.41.0
2016 Jun 07
1
[PATCH] customize: Add --uninstall operation.
...55,11 @@ exec >>%s 2>&1 message (f_"Running touch: %s") path; g#touch path + | `UninstallPackages pkgs -> + message (f_"Uninstalling packages: %s") (String.concat " " pkgs); + let cmd = guest_uninstall_command pkgs in + do_run ~display:cmd cmd + | `Update -> message (f_"Updating packages"); let cmd = guest_update_command () in diff --git a/generator/customize.ml b/generator/customize.ml index 3d3f978..496077b 100644 --- a/generator/customize.ml +++ b/generator/customize.ml @@ -214,7 +214,7...
2023 Jun 29
1
[PATCH guestfs-tools] customize: Implement --chown option
...numeric UID.GID from \ > + %s") uid_gid in > + > + message (f_"Changing owner of %s to %d.%d") path uid gid; > + g#chown uid gid path > + > | `Command cmd -> > message (f_"Running: %s") cmd; > do_run ~display:cmd cmd I've not looked at the context beyond this patch; the patch does look good. Acked-by: Laszlo Ersek <lersek at redhat.com>
2018 Aug 17
8
[PATCH v3 4/4] v2v: Add --print-estimate option to print copy size
I rethought this again, as I think that it's a dangerous assumption to bake qemu-img measure output into our API. This patch series runs qemu-img measure behind the scenes, but then parses the output and sums it to a single number which we print. Doing that required a bit of reworking, moving the Jansson [JSON parser] bindings from virt-builder into the common directory and a couple of other
2014 Jan 24
2
[PATCH 0/2] Implement virt-builder --selinux-relabel option.
Do SELinux relabelling properly.
2015 May 15
0
[PATCH 1/2] customize: Give a clear error message if host_cpu not compatible with guest arch.
...t changes. XXX + *) + | _ -> false in + (* Based on the guest type, choose a log file location. *) let logfile = match g#inspect_get_type root with @@ -53,6 +66,10 @@ let run ~verbose ~quiet (g : Guestfs.guestfs) root (ops : ops) = (* Useful wrapper for scripts. *) let do_run ~display cmd = + if not guest_arch_compatible then + error (f_"host cpu (%s) and guest arch (%s) are not compatible, so you cannot use command line options that involve running commands in the guest. Use --firstboot scripts instead.") + Config.host_cpu guest_arch; +...
2018 Nov 20
0
Re: [PATCH] common/mltools: Add a debug statement when we try to run a non-existent program.
...+++++--- > 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 no...
2019 Jan 11
0
[PATCH 3/3] OCaml: use the new behaviour of Std_utils.which
...mdline.ml | 12 +----------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 3c7e1b846..24641369e 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -408,9 +408,7 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = fd in try - let app = - if Filename.is_relative app then which app - else (Unix.access app [Unix.X_OK]; app) in + let app = which app in let outfd = get_fd Unix.stdout stdout_fd in let errfd = get_fd Unix.stderr...
2019 Jan 16
0
[PATCH 1/5] mltools: split helper do_check_exitcode
.... --- common/mltools/tools_utils.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 24641369e..3b1554c5a 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -427,7 +427,9 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = and do_teardown app outfd errfd exitstat = Option.may Unix.close outfd; Option.may Unix.close errfd; - match exitstat with + do_check_exitcode app exitstat + +and do_check_exitcode app = function | Unix.WEXITED i -> i | Unix.WSI...