search for: read_first_line_from_fil

Displaying 20 results from an estimated 50 matches for "read_first_line_from_fil".

2015 Jul 17
0
[PATCH 1/2] mllib: add and use read_first_line_from_file
...e/password.ml @@ -60,7 +60,7 @@ and parse_selector_list orig_arg = function let pw = parse_selector_list orig_arg rest in { pw with pw_locked = true } | [ "file"; filename ] -> - { pw_password = Password (read_password_from_file filename); + { pw_password = Password (read_first_line_from_file filename); pw_locked = false } | "password" :: password -> { pw_password = Password (String.concat ":" password); pw_locked = false } @@ -71,12 +71,6 @@ and parse_selector_list orig_arg = function | _ -> error (f_"invalid password selector '...
2020 Aug 17
1
[v2v PATCH] libvirt: read password file outside libvirt auth callback
...1 deletion(-) diff --git a/v2v/libvirt_utils.ml b/v2v/libvirt_utils.ml index 4d0b8639..1a24b049 100644 --- a/v2v/libvirt_utils.ml +++ b/v2v/libvirt_utils.ml @@ -24,8 +24,8 @@ open Common_gettext.Gettext module. *) let auth_for_password_file ?password_file () = + let password = Option.map read_first_line_from_file password_file in let auth_fn creds = - let password = Option.map read_first_line_from_file password_file in List.map ( function | { Libvirt.Connect.typ = Libvirt.Connect.CredentialPassphrase } -> password -- 2.26.2
2017 Oct 17
1
[PATCH] daemon: simplify usage of Chroot.f
...se_file) then ( - eprintf "%s: not a regular file or too large\n" release_file; + fun file -> + if not (is_small_file file) then ( + eprintf "%s: not a regular file or too large\n" file; "" ) else - read_first_line_from_file release_file - ) () in + read_first_line_from_file file + ) release_file in if product_name = "" then false else ( @@ -530,7 +530,7 @@ and check_hostname_from_file filename = let name = sprintf "check_hostname_from_file: %s" filename in Chroot.cr...
2015 Jul 17
4
[PATCH v2 0/2] basic subscription-manager support in virt-customize
...h/to/pool-file \ --install pkg1 --install pkg2 .. \ --sm-remove --sm-unregister The same operations are doable also using --run-command, but this allows to not put passwords/pools on command lines, and in general encapsulate them for better control. Pino Toscano (2): mllib: add and use read_first_line_from_file customize: add basic subscription-manager operations builder/Makefile.am | 1 + builder/virt-builder.pod | 47 ++++++++++++++++++ customize/Makefile.am | 2 + customize/customize_run.ml | 34 +++++++++++++ customize/password.ml | 8...
2019 Nov 26
0
[PATCH common v2 2/3] options: Allow multiple --key parameters.
...: %s (%d)"), + partitions[i], guestfs_last_error (g), + guestfs_last_errno (g)); + + opened: need_rescan = 1; } } diff --git a/options/keys.c b/options/keys.c index 74b5497..782bdb6 100644 --- a/options/keys.c +++ b/options/keys.c @@ -121,15 +121,32 @@ read_first_line_from_file (const char *filename) return ret; } -char * -get_key (struct key_store *ks, const char *device) +/* Return the key(s) matching this particular device from the + * keystore. There may be multiple. If none are read from the + * keystore, ask the user. + */ +char ** +get_keys (struct key_sto...
2019 Nov 12
0
[PATCH 2/2] options: Allow multiple --key parameters and default keys.
...: %s (%d)"), + partitions[i], guestfs_last_error (g), + guestfs_last_errno (g)); + + opened: need_rescan = 1; } } diff --git a/options/keys.c b/options/keys.c index f783066..817508b 100644 --- a/options/keys.c +++ b/options/keys.c @@ -121,17 +121,35 @@ read_first_line_from_file (const char *filename) return ret; } -char * -get_key (struct key_store *ks, const char *device) +/* Return the key(s) matching this particular device from the + * keystore. There may be multiple. If none are read from the + * keystore, ask the user. + */ +char ** +get_keys (struct key_sto...
2019 Nov 12
4
[PATCH 1/2] options: Fixes and enhancements to --key parsing.
The first patch fixes a rather serious bug, the second patch allows multiple --key parameters and default parameters. There is a third patch to libguestfs which adds a test, coming up. I did not yet review and fix the documentation. I think we need to centralize it in one place because at the moment the same documentation for --key is copy/pasted all over the tools. Rich.
2015 Aug 31
0
[PATCH 2/2] mllib: set --debug-gc as common option
...g of libguestfs calls"; + "--debug-gc", Arg.Unit set_debug_gc, " " ^ s_"Debug GC and memory allocations (internal)"; ] @ argspec in let argspec = let cmp (arg1, _, _) (arg2, _, _) = compare_command_line_args arg1 arg2 in @@ -778,7 +782,3 @@ let read_first_line_from_file filename = let line = input_line chan in close_in chan; line - -(** Install an exit hook to check gc consistency for --debug-gc *) -let set_debug_gc () = - at_exit (fun () -> Gc.compact()) diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index 5d93b53..79032bc 100644 --- a...
2016 Mar 03
1
[PATCH] mllib: factor out mounting of guest root
...uot;%s (ignored)") msg - ) mps; + inspect_mount_root_ro g root; let files = let typ = g#inspect_get_type root in diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index 6bf99cd..de83dd7 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -833,3 +833,21 @@ let read_first_line_from_file filename = let is_regular_file path = (* NB: follows symlinks. *) try (Unix.stat path).Unix.st_kind = Unix.S_REG with Unix.Unix_error _ -> false + +let inspect_mount_root g ?mount_opts_fn root = + let mps = g#inspect_get_mountpoints root in + let cmp (a,_) (b,_) = + compare (String....
2019 Nov 26
6
[PATCH options v2 0/3] options: Allow multiple and default --key parameters.
v1: https://www.redhat.com/archives/libguestfs/2019-November/msg00036.html
2015 Aug 28
1
[PATCH] handle --debug-gc universally via at_exit hook
...- g#close (); - - if debug_gc then - Gc.compact () + g#close () (* Finished. *) let () = run_main_and_handle_errors main diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index ca6d470..99d2098 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -759,3 +759,7 @@ let read_first_line_from_file filename = let line = input_line chan in close_in chan; line + +(** Install an exit hook to check gc consistency for --debug-gc *) +let set_debug_gc () = + at_exit (fun () -> Gc.compact()) diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli index ac232af..9d1ee6a 100644 --- a...
2018 Jun 05
4
[PATCH 0/3] v2v: Various refactorings.
Use -ip instead of --password-file, and various refactorings. It strikes me that we should probably deprecate and eventually remove virt-v2v-copy-to-local. With the introduction of the new SSH and VDDK transports, and with RHEL 5 Xen becoming more irrelevant, it's no longer needed. Rich.
2019 Nov 29
0
[common PATCH 2/2] options: allow a UUID as identifier for --key
...libguestfs device name of the LUKS -device. +the inspection. C<ID> can be either the libguestfs device name, or +the UUID of the LUKS device. =over 4 diff --git a/options/keys.c b/options/keys.c index 7c391ac..798315c 100644 --- a/options/keys.c +++ b/options/keys.c @@ -126,7 +126,7 @@ read_first_line_from_file (const char *filename) * keystore, ask the user. */ char ** -get_keys (struct key_store *ks, const char *device) +get_keys (struct key_store *ks, const char *device, const char *uuid) { size_t i, j, len; char **r; @@ -148,7 +148,7 @@ get_keys (struct key_store *ks, const char *device)...
2015 Jul 17
0
[PATCH 2/2] customize: add basic subscription-manager operations
...tring_nsplit ":" arg) + +and parse_credentials_selector_list orig_arg = function + | [ username; "password"; password ] -> + { sm_username = username; sm_password = password } + | [ username; "file"; filename ] -> + { sm_username = username; sm_password = read_first_line_from_file filename } + | _ -> + error (f_"invalid sm-credentials selector '%s'; see the man page") orig_arg + +let rec parse_pool_selector arg = + parse_pool_selector_list arg (string_nsplit ":" arg) + +and parse_pool_selector_list orig_arg = function + | [ "auto&qu...
2018 Dec 04
2
[PATCH FOR DISCUSSION ONLY 0/2] v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
This patch is just for discussion. There are still a couple of issues that I'm trying to fix. One is that all of the test guests I have, even ones with static IPs, have multiple interfaces, some using DHCP, so the conditions for adding the Powershell script don't kick in. This makes testing very awkward. However a bigger issue is that I think the premise is wrong. In some registries
2018 Dec 11
2
[PATCH v2 2/2] v2v: Copy static IP address information over for Windows guests (RHBZ#1626503).
v1 was here with much discussion: https://www.redhat.com/archives/libguestfs/2018-December/msg00048.html v2: - Fix the case where there are multiple interfaces. Note this does not preserve order correctly (see patch for comment on why that is a hard problem). - Preserve name servers. This patch is still for discussion only. I'd like to see what might be done to get this upstream
2019 Nov 29
8
[PATCH 0/1] Allow UUIDs for --key identifiers.
This combined patch series enables to decrypt LUKS devices on inspection by allowing the UUID of the LUKS device with the --key syntax. I opted for reusing the option instead of adding another one, as I think that device names and UUIDs are different enough that can be properly distinguished. A test for this (patch #4) can be applied only when the patches for common are applied, and the
2015 Aug 31
2
[PATCH 1/2] mllib: add and use set_standard_options
Introduce a new common helper to add the common options for libguestfs tools (short/long options, version, verbose, trace), and sort them. All the OCaml-based tools had these options already, so there are no functional changes in the interface they provide. The only difference is that now the options are always sorted, while some tools didn't had them like that previously: because of this, a
2019 Apr 08
0
[PATCH v4 3/7] v2v: switch to ocaml-libvirt
...but with - non-broken authentication handling. *) +(* This module provides helper methods on top of the Libvirt + module. *) -external dumpxml : ?password:string -> ?conn:string -> string -> string = "v2v_dumpxml" -let dumpxml ?password_file = - let password = Option.map read_first_line_from_file password_file in - dumpxml ?password +let auth_for_password_file ?password_file () = + let auth_fn creds = + let password = Option.map read_first_line_from_file password_file in + List.map ( + function + | { Libvirt.Connect.typ = Libvirt.Connect.CredentialPassphrase } -> passw...
2017 Nov 05
3
[PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
...string buf (Bytes.to_string b) 0 r; + loop () + ) + in loop () - ) - in - loop (); - close_in chan; + ); Buffer.contents buf (* Compare two version strings intelligently. *) @@ -824,10 +833,10 @@ let last_part_of str sep = with Not_found -> None let read_first_line_from_file filename = - let chan = open_in filename in - let line = try input_line chan with End_of_file -> "" in - close_in chan; - line + with_open_in filename ( + fun chan -> + try input_line chan with End_of_file -> "" + ) let is_regular_file path = (* NB: fo...