@@ -18,6 +18,7 @@ var dataFactory = function(identifier, dataName) {
1818 case 'ohai' :
1919 case 'dmi' :
2020 case 'smart' :
21+ case 'hardware' :
2122 return nodeApi . getNodeCatalogSourceById ( identifier , dataName ) ;
2223
2324 case 'chassis' :
@@ -211,27 +212,55 @@ var getSystem = controller(function(req, res) {
211212 var options = redfish . makeOptions ( req , res , identifier ) ;
212213 options . systemType = 'Physical' ;
213214
214- return Promise . props ( {
215- ohai : dataFactory ( identifier , 'ohai' ) ,
216- dmi : dataFactory ( identifier , 'dmi' ) ,
217- chassis : dataFactory ( identifier , 'chassis' ) ,
218- chassisData : dataFactory ( identifier , 'chassisData' ) ,
219- obm : waterline . nodes . getNodeById ( identifier )
220- . then ( function ( node ) {
221- return _ . map ( node . obms , function ( val , idx ) {
222- return node . id + '.' + idx ;
223- } ) ;
224- } )
225- . then ( function ( obms ) {
226- obms . push ( 'RackHD' ) ;
227- return obms ;
228- } )
229- } ) . then ( function ( data ) {
230- return redfish . render ( 'redfish.1.0.0.computersystem.1.0.0.json' ,
231- 'ComputerSystem.1.0.0.json#/definitions/ComputerSystem' ,
232- _ . merge ( options , data ) ) ;
233- } ) . catch ( function ( error ) {
234- return redfish . handleError ( error , res ) ;
215+ return waterline . nodes . getNodeById ( identifier )
216+ . then ( function ( node ) {
217+ if ( / ^ [ 0 - 9 | A - Z ] { 7 } $ / . test ( node . name ) ) {
218+ return Promise . props ( {
219+ hardware : dataFactory ( identifier , 'hardware' ) ,
220+ chassis : dataFactory ( identifier , 'chassis' ) ,
221+ chassisData : dataFactory ( identifier , 'chassisData' ) ,
222+ obm : Promise . resolve ( node )
223+ . then ( function ( node ) {
224+ return _ . map ( node . obms , function ( val , idx ) {
225+ return node . id + '.' + idx ;
226+ } ) ;
227+ } )
228+ . then ( function ( obms ) {
229+ obms . push ( 'RackHD' ) ;
230+ return obms ;
231+ } )
232+ } ) . then ( function ( data ) {
233+ return redfish . render ( 'wsman.1.0.0.computersystem.1.0.0.json' ,
234+ 'ComputerSystem.1.0.0.json#/definitions/ComputerSystem' ,
235+ _ . merge ( options , data ) ) ;
236+ } ) . catch ( function ( error ) {
237+ return redfish . handleError ( error , res ) ;
238+ } ) ;
239+ } else {
240+
241+ return Promise . props ( {
242+ ohai : dataFactory ( identifier , 'ohai' ) ,
243+ dmi : dataFactory ( identifier , 'dmi' ) ,
244+ chassis : dataFactory ( identifier , 'chassis' ) ,
245+ chassisData : dataFactory ( identifier , 'chassisData' ) ,
246+ obm : Promise . resolve ( node )
247+ . then ( function ( node ) {
248+ return _ . map ( node . obms , function ( val , idx ) {
249+ return node . id + '.' + idx ;
250+ } ) ;
251+ } )
252+ . then ( function ( obms ) {
253+ obms . push ( 'RackHD' ) ;
254+ return obms ;
255+ } )
256+ } ) . then ( function ( data ) {
257+ return redfish . render ( 'redfish.1.0.0.computersystem.1.0.0.json' ,
258+ 'ComputerSystem.1.0.0.json#/definitions/ComputerSystem' ,
259+ _ . merge ( options , data ) ) ;
260+ } ) . catch ( function ( error ) {
261+ return redfish . handleError ( error , res ) ;
262+ } ) ;
263+ }
235264 } ) ;
236265} ) ;
237266
0 commit comments