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

Restore IMMv2 mount attempts

IMMv2 firmware changed two things:
-It now requires a referer to mount media
-Newer firmware moved from data?set to data/set

Change-Id: I4b5b88f993b87e4e769aad82cb161abfb72bfd18
This commit is contained in:
Jarrod Johnson 2018-06-13 15:05:39 -04:00
parent 8b25601a7a
commit 2b2f73788a

View File

@ -321,14 +321,19 @@ class IMMClient(object):
'RP_VmAllocateMountUrl({0},{1},1,,)'.format(
self.username, url): ''
})
result = self.wc.grab_json_response('/data?set', params)
result = self.wc.grab_json_response('/data?set', params,
referer=self.adp_referer)
if not result:
result = self.wc.grab_json_response('/data/set', params,
referer=self.adp_referer)
if result['return'] != 'Success':
raise Exception(result['reason'])
self.weblogout()
def detach_remote_media(self):
mnt = self.wc.grab_json_response(
'/designs/imm/dataproviders/imm_rp_images.php')
'/designs/imm/dataproviders/imm_rp_images.php',
referer=self.adp_referer)
removeurls = []
for item in mnt['items']:
if 'urls' in item:
@ -339,7 +344,11 @@ class IMMClient(object):
params = urllib.urlencode({
'RP_VmAllocateUnMountUrl({0},{1},0,)'.format(
self.username, url): ''})
result = self.wc.grab_json_response('/data?set', params)
result = self.wc.grab_json_response('/data?set', params,
referer=self.adp_referer)
if not result:
result = self.wc.grab_json_response('/data/set', params,
referer=self.adp_referer)
if result['return'] != 'Success':
raise Exception(result['reason'])
self.weblogout()