2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Fix media urls

URLs do not come naturally out of the XCC.  Do some fixup to provide
symmetry in the pyghmi api for non-http remote media.

Change-Id: I0bf982eb64d39e90e4ef56d753fbc0a4d6fa562d
This commit is contained in:
Jarrod Johnson 2018-02-26 14:50:43 -05:00
parent 8c1f1c8387
commit 84963baacb

View File

@ -1011,7 +1011,14 @@ class XCCClient(IMMClient):
rt = self.wc.grab_json_response('/api/providers/rp_vm_remote_getdisk')
if 'items' in rt:
for mt in rt['items']:
yield media.Media(mt['filename'], mt['remotepath'])
url = mt['remotepath']
if url.startswith('//'):
url = 'smb:' + url
elif (not url.startswith('http://') and
not url.startswith('https://')):
url = url.replace(':', '')
url = 'nfs://' + url
yield media.Media(mt['filename'], url)
rt = self.wc.grab_json_response('/api/providers/rp_rdoc_imagelist')
if 'items' in rt:
for mt in rt['items']: