Merge pull request #46541 from gtmanfred/metadata

handle user-data for metadata grains
This commit is contained in:
Nicole Thomas 2018-03-15 13:21:30 -04:00 committed by GitHub
commit 0a68c22332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -48,9 +48,11 @@ def _search(prefix="latest/"):
Recursively look up all grains in the metadata server
'''
ret = {}
linedata = http.query(os.path.join(HOST, prefix))
linedata = http.query(os.path.join(HOST, prefix), headers=True)
if 'body' not in linedata:
return ret
if linedata['headers'].get('Content-Type', 'text/plain') == 'application/octet-stream':
return linedata['body']
for line in linedata['body'].split('\n'):
if line.endswith('/'):
ret[line[:-1]] = _search(prefix=os.path.join(prefix, line))