Commit 6010d3c8 authored by Scott Moser's avatar Scott Moser

readurl: if headers are provided still provide base headers

we want cloud-init user agent to be present even if the user
provided some headers. In the event that they provided User-Agent,
this will respect their wishes.
parent 60a9ebab
......@@ -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:
headers = def_headers
if not headers_cb:
def _cb(url):
return headers
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment