Replace fixed paths with response from API
Currently, the Redfish request used fixed URIs, modify the code to use
the BMC and System paths got from response of API calls.
For CertificateStore, since it was using the URL for constant variable
assignment, changed the constant CERTIFICATE_TYPES to method call.
Change-Id: I330b7272083e3e6993aae5705aae170b8e9a4659
Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
diff --git a/src/store/modules/Logs/DumpsStore.js b/src/store/modules/Logs/DumpsStore.js
index 328e316..9391e57 100644
--- a/src/store/modules/Logs/DumpsStore.js
+++ b/src/store/modules/Logs/DumpsStore.js
@@ -24,9 +24,7 @@
actions: {
async getBmcDumpEntries() {
return api
- .get('/redfish/v1/')
- .then((response) => api.get(response.data.Managers['@odata.id']))
- .then((response) => api.get(`${response.data['@odata.id']}/bmc`))
+ .get(`${await this.dispatch('global/getBmcPath')}`)
.then((response) => api.get(response.data.LogServices['@odata.id']))
.then((response) => api.get(`${response.data['@odata.id']}/Dump`))
.then((response) => api.get(response.data.Entries['@odata.id']))
@@ -34,9 +32,7 @@
},
async getSystemDumpEntries() {
return api
- .get('/redfish/v1/')
- .then((response) => api.get(response.data.Systems['@odata.id']))
- .then((response) => api.get(`${response.data['@odata.id']}/system`))
+ .get(`${await this.dispatch('global/getSystemPath')}`)
.then((response) => api.get(response.data.LogServices['@odata.id']))
.then((response) => api.get(`${response.data['@odata.id']}/Dump`))
.then((response) => api.get(response.data.Entries['@odata.id']))
@@ -56,7 +52,7 @@
async createBmcDump() {
return await api
.post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
+ `${await this.dispatch('global/getBmcPath')}/LogServices/Dump/Actions/LogService.CollectDiagnosticData`,
{
DiagnosticDataType: 'Manager',
OEMDiagnosticDataType: '',
@@ -70,7 +66,7 @@
async createSystemDump() {
return await api
.post(
- '/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData',
+ `${await this.dispatch('global/getSystemPath')}/LogServices/Dump/Actions/LogService.CollectDiagnosticData`,
{
DiagnosticDataType: 'OEM',
OEMDiagnosticDataType: 'System',
@@ -123,7 +119,7 @@
const totalDumpCount = state.allDumps.length;
return await api
.post(
- '/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog',
+ `${await this.dispatch('global/getBmcPath')}/LogServices/Dump/Actions/LogService.ClearLog`,
)
.then(() => {
commit('setAllDumps', []);