On 05/09/17 17:41, Cédric Bosdonnat wrote: > Since python3 strings are already Unicode-capable, there have no > decode() function. Libguestfs content strings can be either python 2 > or 3 strings, only decode them to utf-8 for python2. > --- > src/virtBootstrap/utils.py | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py > index 1fb3625..f696471 100644 > --- a/src/virtBootstrap/utils.py > +++ b/src/virtBootstrap/utils.py > @@ -168,7 +168,9 @@ class BuildImage(object): > self.g.mount('/dev/sda', '/') > success = False > if self.g.is_file('/etc/shadow'): > - shadow_content = self.g.read_file('/etc/shadow').decode('utf-8') > + shadow_content = self.g.read_file('/etc/shadow') > + if hasattr(shadow_content, 'decode'): > + shadow_content = shadow_content.decode('utf-8') > shadow_content = shadow_content.split('\n') > if shadow_content: > # Note: 'shadow_content' is a list, pass-by-reference is used ACK _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list