diff options
Diffstat (limited to 'cloudinit/url_helper.py')
-rw-r--r-- | cloudinit/url_helper.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py index ce6b5444..a93847ce 100644 --- a/cloudinit/url_helper.py +++ b/cloudinit/url_helper.py @@ -211,10 +211,14 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1, manual_tries = 1 if retries: manual_tries = max(int(retries) + 1, 1) - if not headers: - headers = { - 'User-Agent': 'Cloud-Init/%s' % (version.version_string()), - } + + def_headers = { + 'User-Agent': 'Cloud-Init/%s' % (version.version_string()), + } + if headers: + def_headers.update(headers) + headers = def_headers + if not headers_cb: def _cb(url): return headers |