Remove version check for encoding
Virtualbmc is now Python 3 only, encoding for ET can be set to unicode only. Removing import sys from vbmc.py as it was used only for that check. Change-Id: I35ac19308337f9fb603efa5b8a3dc97aea234cbc
This commit is contained in:
parent
26b7ff6063
commit
3ef73c8d8f
@ -10,7 +10,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import libvirt
|
||||
@ -103,11 +102,7 @@ class VirtualBMC(bmc.Bmc):
|
||||
boot_element = ET.SubElement(os_element, 'boot')
|
||||
boot_element.set('dev', device)
|
||||
|
||||
# conn.defineXML can't take bytes but
|
||||
# in py3 ET.tostring returns bytes unless "unicode"
|
||||
# in py2 "unicode" is unknown so specify "utf8" instead
|
||||
enc = sys.version_info[0] < 3 and "utf8" or "unicode"
|
||||
conn.defineXML(ET.tostring(tree, encoding=enc))
|
||||
conn.defineXML(ET.tostring(tree, encoding="unicode"))
|
||||
except libvirt.libvirtError:
|
||||
LOG.error('Failed setting the boot device %(bootdev)s for '
|
||||
'domain %(domain)s', {'bootdev': device,
|
||||
|
Loading…
x
Reference in New Issue
Block a user