Make node template description safer for new clusters

- Addresses #3387
This commit is contained in:
Richard Cox 2021-07-09 14:54:11 +01:00
parent db6146dc3c
commit 84cf91c89f
1 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@ const CONFIG_KEYS = [
size: { key: 'instanceType' }, size: { key: 'instanceType' },
location: { location: {
getDisplayProperty(that) { getDisplayProperty(that) {
return `${ that.providerConfig.region }${ that.providerConfig.zone }`; return `${ that.providerConfig?.region }${ that.providerConfig?.zone }`;
} }
} }
}, },
@ -15,7 +15,7 @@ const CONFIG_KEYS = [
size: { key: 'instanceType' }, size: { key: 'instanceType' },
location: { location: {
getDisplayProperty(that) { getDisplayProperty(that) {
return `${ that.providerConfig.region }${ that.providerConfig.zone }`; return `${ that.providerConfig?.region }${ that.providerConfig?.zone }`;
} }
} }
}, },
@ -63,9 +63,9 @@ const CONFIG_KEYS = [
driver: 'vmwarevsphere', driver: 'vmwarevsphere',
size: { size: {
getDisplayProperty(that) { getDisplayProperty(that) {
const size = formatSi(that.providerConfig.memorySize * 1048576, 1024, 'iB'); const size = formatSi(that.providerConfig?.memorySize * 1048576, 1024, 'iB');
return `${ size }, ${ that.providerConfig.cpuCount } Core`; return `${ size }, ${ that.providerConfig?.cpuCount } Core`;
} }
}, },
location: { key: null } location: { key: null }
@ -101,7 +101,7 @@ export default {
if (config.location.getDisplayProperty) { if (config.location.getDisplayProperty) {
return config.location.getDisplayProperty(this); return config.location.getDisplayProperty(this);
} }
const value = this.providerConfig[config.location.key]; const value = this.providerConfig?.[config.location.key];
if (value) { if (value) {
return value; return value;
@ -120,7 +120,7 @@ export default {
if (config.size.getDisplayProperty) { if (config.size.getDisplayProperty) {
return config.size.getDisplayProperty(this); return config.size.getDisplayProperty(this);
} }
const value = this.providerConfig[config.size.key]; const value = this.providerConfig?.[config.size.key];
if (value) { if (value) {
return value; return value;