summaryrefslogtreecommitdiff
path: root/cloudinit/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/util.py')
-rw-r--r--cloudinit/util.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py
index b6065410..971c1c2d 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -23,6 +23,7 @@
import contextlib
import copy as obj_copy
import ctypes
+import email
import errno
import glob
import grp
@@ -2187,3 +2188,9 @@ def read_dmi_data(key):
LOG.warn("did not find either path %s or dmidecode command",
DMI_SYS_PATH)
return None
+
+
+def message_from_string(string):
+ if sys.version_info[:2] < (2, 7):
+ return email.message_from_file(six.StringIO(string))
+ return email.message_from_string(string)