diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 765d6f86..b88ad8e3 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -1429,6 +1429,8 @@ class Command(object): self.wc.stdheaders['X-Auth-Token'] = self.xauthtoken if 'Authorization' in self.wc.stdheaders: del self.wc.stdheaders['Authorization'] + for res in self.oem.list_media(self, cache=False): + pass def detach_remote_media(self): try: @@ -1462,6 +1464,8 @@ class Command(object): method='PATCH') else: raise + for res in self.oem.list_media(self, cache=False): + pass def upload_media(self, filename, progress=None, data=None): """Upload a file to be hosted on the target BMC diff --git a/pyghmi/redfish/oem/generic.py b/pyghmi/redfish/oem/generic.py index 152dd9d9..a9eb89dc 100644 --- a/pyghmi/redfish/oem/generic.py +++ b/pyghmi/redfish/oem/generic.py @@ -672,13 +672,13 @@ class OEMHandler(object): except AttributeError: self.password = password - def list_media(self, fishclient): - bmcinfo = fishclient._do_web_request(fishclient._bmcurl) + def list_media(self, fishclient, cache=True): + bmcinfo = fishclient._do_web_request(fishclient._bmcurl, cache=cache) vmcoll = bmcinfo.get('VirtualMedia', {}).get('@odata.id', None) if vmcoll: - vmlist = fishclient._do_web_request(vmcoll) + vmlist = fishclient._do_web_request(vmcoll, cache=cache) vmurls = [x['@odata.id'] for x in vmlist.get('Members', [])] - for vminfo in fishclient._do_bulk_requests(vmurls): + for vminfo in fishclient._do_bulk_requests(vmurls, cache=cache): vminfo = vminfo[0] if vminfo.get('Image', None): imageurl = vminfo['Image'].replace( diff --git a/pyghmi/redfish/oem/lenovo/tsma.py b/pyghmi/redfish/oem/lenovo/tsma.py index b82dd1c5..18e54c70 100644 --- a/pyghmi/redfish/oem/lenovo/tsma.py +++ b/pyghmi/redfish/oem/lenovo/tsma.py @@ -799,7 +799,7 @@ class TsmHandler(generic.OEMHandler): raise exc.UnsupportedFunctionality( 'Remote media upload not supported on this system') - def list_media(self, fishclient=None): + def list_media(self, fishclient=None, cache=True): wc = self.wc rsp = wc.grab_json_response('/api/settings/media/general') cds = rsp['cd_remote_server_address'] diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index 03f04d83..4dcfd7a3 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -1151,7 +1151,7 @@ class OEMHandler(generic.OEMHandler): res = wc.grab_json_response_with_status(url, body, method=method) return res - def list_media(self, fishclient): + def list_media(self, fishclient, cache=True): rt = self.wc.grab_json_response('/api/providers/rp_vm_remote_getdisk') if 'items' in rt: for mt in rt['items']: