From 1d12505fa069bef886ee908a83920aa2afa44298 Mon Sep 17 00:00:00 2001
From: Dmitry Tantsur <dtantsur@protonmail.com>
Date: Mon, 11 Nov 2019 16:03:59 +0100
Subject: [PATCH] Do not try to read raw disk data as unicode

Fixes regression in commit 9f8fa2853af00045118ccd44180e7053e6d027af:
utils.execute returns unicode by default, but this data is binary.

Change-Id: I5b54c1f6cfac5fff672245c523b9fb647478edbd
---
 ironic_python_agent/extensions/image.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ironic_python_agent/extensions/image.py b/ironic_python_agent/extensions/image.py
index 61d20c76d..62e7380c8 100644
--- a/ironic_python_agent/extensions/image.py
+++ b/ironic_python_agent/extensions/image.py
@@ -149,7 +149,7 @@ def _is_bootloader_loaded(dev):
         if 'boot sector' in stdout:
             # Now lets check the signature
             ddout, dderr = utils.execute(
-                'dd', 'if=%s' % device, 'bs=218', 'count=1')
+                'dd', 'if=%s' % device, 'bs=218', 'count=1', binary=True)
             stdout, stderr = utils.execute('file', '-', process_input=ddout)
             # The bytes recovered by dd show as a "dos executable" when
             # examined with file. In other words, the bootloader is present.