Displaying 20 results from an estimated 79 matches for "open_in".
2017 Nov 05
3
[PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
These safe wrappers around Pervasives.open_in and Pervasives.open_out
ensure that exceptions escaping cannot leave unclosed files.
---
common/mlstdutils/std_utils.ml | 39 ++++++++++++++++++++--------------
common/mlstdutils/std_utils.mli | 12 +++++++++++
common/mltools/tools_utils.ml | 39 +++++++++++++++++-----------------
dib/dib.ml...
2018 Dec 03
4
[supermin PATCH 0/2] Create a really empty base.tar.gz
See patch #2 for more explanation.
Pino Toscano (2):
prepare: keep config_files available for longer
prepare: create a really empty base.tar.gz with no config files
src/mode_prepare.ml | 87 +++++++++++++++++++++++++++------------------
1 file changed, 52 insertions(+), 35 deletions(-)
--
2.17.2
2018 Dec 03
3
[supermin PATCH] build: ignore empty files
...appliance = function
(* Depending on the file type, read or unpack the file. *)
let appliance =
match file_type with
+ | Uncompressed Empty | GZip Empty | XZ Empty ->
+ appliance
| Uncompressed ((Packages|Hostfiles|Excludefiles) as t) ->
let chan = open_in file in
let lines = input_all_lines chan in
@@ -294,7 +298,7 @@ and update_appliance appliance lines = function
String.sub path 1 (n-1)
) lines in
{ appliance with excludefiles = appliance.excludefiles @ lines }
- | Base_image -> assert false
+ | Base_image | Empty...
2018 Dec 03
0
[supermin PATCH 1/2] prepare: keep config_files available for longer
...ction
- | { ft_config = true; ft_path = path } -> Some path
- | { ft_config = false } -> None
- ) files
- ) packages in
- let config_files = List.flatten config_files in
-
- let config_files = List.filter (
- fun path ->
- try close_in (open_in (dir // path)); true
- with Sys_error _ -> false
- ) config_files in
+ let config_files =
+ List.map (
+ fun (_, files) ->
+ filter_map (
+ function
+ | { ft_config = true; ft_path = path } -> Some path
+ | { ft_config = false } -> No...
2015 Jul 17
0
[PATCH 1/2] mllib: add and use read_first_line_from_file
...ord = Password (String.concat ":" password); pw_locked = false }
@@ -71,12 +71,6 @@ and parse_selector_list orig_arg = function
| _ ->
error (f_"invalid password selector '%s'; see the man page") orig_arg
-and read_password_from_file filename =
- let chan = open_in filename in
- let password = input_line chan in
- close_in chan;
- password
-
(* Permissible characters in a salt. *)
let chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index 083c5d5..f9e8996 100...
2016 Apr 05
1
Re: [PATCH 3/7] customize: add support for pvvxsvc
...is path is fine, but let's split it into a separate patch.
> + let services = ["rhsrvany.exe"; "pvvxsvc.exe"] in
> + let srvany = (
> + try
> + List.find (
> + fun service -> (
> + try
> + let chan = open_in (virt_tools_data_dir // service) in
> + close_in chan;
> + true
> + with _ ->
> + false
> + )
> + ) services
> + with Not_found ->
> + error (f_"One of rhsrvany.exe or pvvxsvc.exe is miss...
2018 Dec 03
4
[supermin PATCH v2 0/3] Better handle no config files
This is a "merge" of two previous series:
https://www.redhat.com/archives/libguestfs/2018-December/msg00015.html
https://www.redhat.com/archives/libguestfs/2018-December/msg00020.html
The goal is to handle better situations like:
- empty file in the appliance directory
- no config files available in the packages to include in an appliance
Compared to the two series, the changes are:
-
2016 Sep 29
3
[PATCH 1/2] v2v: ova: fix checking of the manifest file
...tr.regexp "SHA1(\\(.*\\))=\\([0-9a-fA-F]+\\)\r?" in
+ let rex = Str.regexp "SHA1(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in
List.iter (
fun mf ->
+ debug "Processing manifest %s" mf;
let mf_folder = Filename.dirname mf in
let chan = open_in mf in
let rec loop () =
@@ -156,6 +157,11 @@ object
debug "sha1 of %s matches expected checksum %s" disk expected
| _::_ -> error (f_"cannot parse output of sha1sum command")
)
+ else
+ warning (f_"Unabl...
2016 May 12
0
[PATCH 05/11] customize: add support for pvvxsvc
...ools" in
- (* rhsrvany.exe must exist.
+ (* either rhsrvany.exe or pvvxsvc.exe must exist.
*
* (Check also that it's not a dangling symlink but a real file).
*)
- let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in
- (try
- let chan = open_in rhsrvany_exe in
- close_in chan
- with
- Sys_error msg ->
- error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s"...
2016 May 18
0
[PATCH v2 05/11] customize: add support for pvvxsvc
...ools" in
- (* rhsrvany.exe must exist.
+ (* Either rhsrvany.exe or pvvxsvc.exe must exist.
*
* (Check also that it's not a dangling symlink but a real file).
*)
- let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in
- (try
- let chan = open_in rhsrvany_exe in
- close_in chan
- with
- Sys_error msg ->
- error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s"...
2016 May 12
24
[PATCH 00/11] Getting it work with SLES / openSUSE
Hi there!
I know it's been a while since I posted my first version of some patches.
But here I have rebased them on top of Roman's work and added a few other ones.
Cédric Bosdonnat (11):
v2v: also search for windows virtio drivers in symlinks
Update packagelist for SLES
customize: fix windows firstboot script
customize: change windows firstboot path
customize: add support for
2015 Feb 10
1
[PATCH] php: add a simple bindtests test
...uot;Call failed: \" . guestfs_last_error ($g) . \"\\n\");\n";
+ pr " exit;\n";
+ pr "}\n";
+ );
+
+ pr "echo (\"EOF\\n\");\n";
+ pr "?>\n";
+ pr "--EXPECT--\n";
+
+ let dump filename =
+ let chan = open_in filename in
+ let rec loop () =
+ let line = input_line chan in
+ (match string_split ":" line with
+ | ("obool"|"oint"|"oint64"|"ostring"|"ostringlist") as x :: _ ->
+ pr "%s: unset\n" x
+ | _ -&...
2016 May 12
0
[PATCH 07/11] v2v: add support for SUSE VMDP drivers
...This is optional. *)
- let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
- let rhev_apt_exe =
+ (* Check if either RHEV-APT or VMDP exists. This is optional. *)
+ let tools = ["rhev-apt.exe"; "vmdp.exe"] in
+ let installer =
try
- let chan = open_in rhev_apt_exe in
- close_in chan;
- Some rhev_apt_exe
- with
- Sys_error msg ->
- warning (f_"'%s' is missing. Unable to install RHEV-APT (RHEV guest agent). Original error: %s")
- rhev_apt_exe msg;
- None in
+ let tool = List.find...
2016 May 18
0
[PATCH v2 07/11] v2v: add support for SUSE VMDP drivers
...*)
- let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
- let rhev_apt_exe =
+ (* Check if either RHEV-APT or VMDP exists. This is optional. *)
+ let tools = [`RhevApt, "rhev-apt.exe"; `VmdpExe, "vmdp.exe"] in
+ let installer =
try
- let chan = open_in rhev_apt_exe in
- close_in chan;
- Some rhev_apt_exe
- with
- Sys_error msg ->
- warning (f_"'%s' is missing. Unable to install RHEV-APT (RHEV guest agent). Original error: %s")
- rhev_apt_exe msg;
- None in
+ let t, tool = List.f...
2016 Oct 05
4
[PATCH v2 0/2] Improve OVA manifest parsing
This series fixes and enhances parsing of the OVA manifest file.
The changes are:
- Added mandatory space to the regexp
- Process all lines in the file, not just one
- Warn on improperly formated lines
- Support SHA256 hashes
v1 -> v2: rebased on to master to make use of the Checksums module
Tomáš Golembiovský (2):
v2v: ova: fix checking of the manifest file
v2v: ova: support SHA256
2016 Apr 05
0
[PATCH 3/7] customize: add support for pvvxsvc
...ools" in
- (* rhsrvany.exe must exist.
+ (* either rhsrvany.exe or pvvxsvc.exe must exist.
*
* (Check also that it's not a dangling symlink but a real file).
*)
- let rhsrvany_exe = virt_tools_data_dir // "rhsrvany.exe" in
- (try
- let chan = open_in rhsrvany_exe in
- close_in chan
- with
- Sys_error msg ->
- error (f_"'%s' is missing. This file is required in order to install Windows firstboot scripts. You can get it by building rhsrvany (https://github.com/rwmjones/rhsrvany). Original error: %s"...
2016 Apr 05
0
[PATCH 7/7] v2v: add support for SUSE VMDP drivers
...This is optional. *)
- let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
- let rhev_apt_exe =
+ (* Check if either RHEV-APT or VMDP exists. This is optional. *)
+ let tools = ["rhev-apt.exe"; "vmdp.exe"] in
+ let installer =
try
- let chan = open_in rhev_apt_exe in
- close_in chan;
- Some rhev_apt_exe
- with
- Sys_error msg ->
- warning (f_"'%s' is missing. Unable to install RHEV-APT (RHEV guest agent). Original error: %s")
- rhev_apt_exe msg;
- None in
+ let tool = List.find...
2016 May 18
21
[PATCH v2 00/11] Getting it work with SLES / openSUSE
Hi all,
v2 includes all comments from Pino and Richard. I also removed the
mkdir /run/lvm in the init since it only failed in one case and couldn't
reproduce it anymore.
Cédric Bosdonnat (11):
v2v: also search for windows virtio drivers in symlinks
Update packagelist for SLES and openSUSE
customize: fix windows firstboot script
customize: change windows firstboot path
customize:
2016 Sep 29
0
Re: [PATCH 1/2] v2v: ova: fix checking of the manifest file
...=\\([0-9a-fA-F]+\\)\r?" in
> + let rex = Str.regexp "SHA1(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in
> List.iter (
> fun mf ->
> + debug "Processing manifest %s" mf;
> let mf_folder = Filename.dirname mf in
> let chan = open_in mf in
> let rec loop () =
> @@ -156,6 +157,11 @@ object
> debug "sha1 of %s matches expected checksum %s" disk expected
> | _::_ -> error (f_"cannot parse output of sha1sum command")
> )
> + else
>...
2016 Oct 05
0
[PATCH v2 1/2] v2v: ova: fix checking of the manifest file
...tr.regexp "SHA1(\\(.*\\))=\\([0-9a-fA-F]+\\)\r?" in
+ let rex = Str.regexp "SHA1(\\(.*\\))= \\([0-9a-fA-F]+\\)\r?" in
List.iter (
fun mf ->
+ debug "Processing manifest %s" mf;
let mf_folder = Filename.dirname mf in
let chan = open_in mf in
let rec loop () =
@@ -149,6 +150,11 @@ object
error (f_"checksum of disk %s does not match manifest %s (actual sha1(%s) = %s, expected sha1 (%s) = %s)")
disk mf disk actual disk expected;
)
+ else
+ warning (f_&...