On Wed, Jun 27, 2018 at 2:10 PM Richard W.M. Jones <rjones(a)redhat.com>
wrote:
On Wed, Jun 27, 2018 at 12:37:20PM +0300, Nir Soffer wrote:
> I tested the patch yesterday, and unix socket did not work - silently.
>
> After changing the code to:
>
> try:
> with builtin_open("/etc/vdsm/vdsm.id") as f:
> vdsm_id = f.readline().strip()
> except Exception as e:
> debug("cannot read host hardware id: %s" % e)
> return None
>
> Then I got this message:
>
> cannot read host hardware id: name 'builtin_open' is not defined
>
> We are paying the price of python :-)
Ah, that's a typo.
The Python 3 version is meant to use builtins.open.
However confusingly I was testing the Python 2 version which has
a RHEL-only patch that does:
-import builtins
+from __builtin__ import open as builtin_open
(
https://github.com/libguestfs/libguestfs/commit/e5826e63b53a0aadc8a8d5261...
)
Because I wasn't expecting the Python 3 version to work, I didn't
notice this error.
And yes you're right, Strong Typing FTW. It's why we use OCaml where
possible.
I will fix this. Were there any other problems?
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v