summaryrefslogtreecommitdiff
path: root/cloudinit/user_data.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2018-05-17 14:59:54 -0600
committerChad Smith <chad.smith@canonical.com>2018-05-17 14:59:54 -0600
commit30e730f7ca111487d243ba9f40c66df6d7a49953 (patch)
tree89092257336e04adff50668050f1353857058654 /cloudinit/user_data.py
parent2dab7046f88e540836498b363c90ad46302a7cc4 (diff)
downloadvyos-cloud-init-30e730f7ca111487d243ba9f40c66df6d7a49953.tar.gz
vyos-cloud-init-30e730f7ca111487d243ba9f40c66df6d7a49953.zip
read_file_or_url: move to url_helper, fix bug in its FileResponse.
The result of a read_file_or_url on a file and on a url would differ in behavior. str(UrlResponse) would return UrlResponse.contents.decode('utf-8') while str(FileResponse) would return str(FileResponse.contents) The difference being "b'foo'" versus "foo". As part of the general goal of cleaning util, move read_file_or_url into url_helper.
Diffstat (limited to 'cloudinit/user_data.py')
-rw-r--r--cloudinit/user_data.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/user_data.py b/cloudinit/user_data.py
index cc55daf8..8f6aba1e 100644
--- a/cloudinit/user_data.py
+++ b/cloudinit/user_data.py
@@ -19,7 +19,7 @@ import six
from cloudinit import handlers
from cloudinit import log as logging
-from cloudinit.url_helper import UrlError
+from cloudinit.url_helper import read_file_or_url, UrlError
from cloudinit import util
LOG = logging.getLogger(__name__)
@@ -224,8 +224,8 @@ class UserDataProcessor(object):
content = util.load_file(include_once_fn)
else:
try:
- resp = util.read_file_or_url(include_url,
- ssl_details=self.ssl_details)
+ resp = read_file_or_url(include_url,
+ ssl_details=self.ssl_details)
if include_once_on and resp.ok():
util.write_file(include_once_fn, resp.contents,
mode=0o600)