Skip to content

Commit

Permalink
fix: Config asset errors when starting Butler without any New Relic a…
Browse files Browse the repository at this point in the history
…ccounts specified

Fixes #598
  • Loading branch information
Göran Sander committed Dec 2, 2022
1 parent 1d29e3f commit 178b908
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/lib/assert/assert_config_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ const configFileNewRelicAssert = async (config, configQRS, logger) => {
'Butler.incidentTool.newRelic.reloadTaskFailure.destination.event.sendToAccount.byCustomProperty.customPropertyName'
)}' does not have any values associated with it. New Relic monitoring may not work as a result of this.`
);
} else if (config.get('Butler.thirdPartyToolsCredentials.newRelic') === null) {
// New Relic account specified as destination for events, but no account(s) specified in config file or on command line
logger.warn(
`ASSERT CONFIG NEW RELIC: New Relic is set as a destination for alert events, but no New Relic account(s) specified on either command line or in config file. Aborting,`
);
process.exit(1);
} else {
// Test each custom property choice value for existence in Butler config file
const availableNewRelicAccounts = config.get('Butler.thirdPartyToolsCredentials.newRelic');
Expand Down Expand Up @@ -144,6 +150,12 @@ const configFileNewRelicAssert = async (config, configQRS, logger) => {
'Butler.incidentTool.newRelic.reloadTaskFailure.destination.log.sendToAccount.byCustomProperty.customPropertyName'
)}' does not have any values associated with it. New Relic monitoring may not work as a result of this.`
);
} else if (config.get('Butler.thirdPartyToolsCredentials.newRelic') === null) {
// New Relic account specified as destination for events, but no account(s) specified in config file or on command line
logger.error(
`ASSERT CONFIG NEW RELIC: New Relic is set as a destination for alert logs, but no New Relic account(s) specified on either command line or in config file. Aborting,`
);
process.exit(1);
} else {
// Test each custom property choice value for existence in Butler config file
const availableNewRelicAccounts = config.get('Butler.thirdPartyToolsCredentials.newRelic');
Expand Down Expand Up @@ -223,6 +235,12 @@ const configFileNewRelicAssert = async (config, configQRS, logger) => {
'Butler.incidentTool.newRelic.reloadTaskAborted.destination.event.sendToAccount.byCustomProperty.customPropertyName'
)}' does not have any values associated with it. New Relic monitoring may not work as a result of this.`
);
} else if (config.get('Butler.thirdPartyToolsCredentials.newRelic') === null) {
// New Relic account specified as destination for events, but no account(s) specified in config file or on command line
logger.warn(
`ASSERT CONFIG NEW RELIC: New Relic is set as a destination for alert events, but no New Relic account(s) specified on either command line or in config file. Aborting,`
);
process.exit(1);
} else {
// Test each custom property choice value for existence in Butler config file
const availableNewRelicAccounts = config.get('Butler.thirdPartyToolsCredentials.newRelic');
Expand Down Expand Up @@ -304,6 +322,12 @@ const configFileNewRelicAssert = async (config, configQRS, logger) => {
'Butler.incidentTool.newRelic.reloadTaskAborted.destination.log.sendToAccount.byCustomProperty.customPropertyName'
)}' does not have any values associated with it. New Relic monitoring may not work as a result of this.`
);
} else if (config.get('Butler.thirdPartyToolsCredentials.newRelic') === null) {
// New Relic account specified as destination for events, but no account(s) specified in config file or on command line
logger.error(
`ASSERT CONFIG NEW RELIC: New Relic is set as a destination for alert logs, but no New Relic account(s) specified on either command line or in config file. Aborting,`
);
process.exit(1);
} else {
// Test each custom property choice value for existence in Butler config file
const availableNewRelicAccounts = config.get('Butler.thirdPartyToolsCredentials.newRelic');
Expand Down

0 comments on commit 178b908

Please sign in to comment.