chore(xo-server-sdn-controller): use ?. to simplify tests (#4459)
This commit is contained in:
committed by
Julien Fontanet
parent
3890d4d9d1
commit
5dfb299e37
@@ -714,8 +714,7 @@ class SDNController extends EventEmitter {
|
||||
_setControllerNeeded(xapi) {
|
||||
const controller = find(xapi.objects.all, { $type: 'SDN_controller' })
|
||||
return !(
|
||||
controller !== undefined &&
|
||||
controller.protocol === PROTOCOL &&
|
||||
controller?.protocol === PROTOCOL &&
|
||||
controller.address === '' &&
|
||||
controller.port === 0
|
||||
)
|
||||
@@ -818,7 +817,7 @@ class SDNController extends EventEmitter {
|
||||
|
||||
for (const host of hosts) {
|
||||
const pif = find(host.$PIFs, { network: network.$ref })
|
||||
if (pif !== undefined && pif.currently_attached && host.$metrics.live) {
|
||||
if (pif?.currently_attached && host.$metrics.live) {
|
||||
newCenter = host
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class OvsdbClient {
|
||||
let opResult
|
||||
do {
|
||||
opResult = jsonObjects[0].result[i]
|
||||
if (opResult !== undefined && opResult.error !== undefined) {
|
||||
if (opResult?.error !== undefined) {
|
||||
error = opResult.error
|
||||
details = opResult.details
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user