Skip to content

Commit

Permalink
Fix that manifest and plugindef were using same configmgr config id
Browse files Browse the repository at this point in the history
Signed-off-by: 1000TurquoisePogs <[email protected]>
  • Loading branch information
1000TurquoisePogs authored Jun 24, 2024
1 parent 93b9fd8 commit 02fd64c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions bin/libs/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,32 +116,33 @@ function showExceptions(e: any,depth: number): void {

export function getPluginDefinition(pluginRootPath:string, continueOnFailure?: boolean) {
const pluginDefinitionPath = `${pluginRootPath}/pluginDefinition.json`;
const configId = `appfwPlugin:${pluginRootPath}`;

const printer = continueOnFailure ? common.printError : common.printErrorAndExit;

if (fs.fileExists(pluginDefinitionPath)) {
let status;
if ((status = CONFIG_MGR.addConfig(pluginRootPath))) {
if ((status = CONFIG_MGR.addConfig(configId))) {
printer(`Could not add config for ${pluginRootPath}, status=${status}`);
return null;
}

if ((status = CONFIG_MGR.loadSchemas(pluginRootPath, PLUGIN_DEF_SCHEMAS))) {
if ((status = CONFIG_MGR.loadSchemas(configId, PLUGIN_DEF_SCHEMAS))) {
printer(`Could not load schemas ${PLUGIN_DEF_SCHEMAS} for plugin ${pluginRootPath}, status=${status}`);
return null;
}


if ((status = CONFIG_MGR.setConfigPath(pluginRootPath, `FILE(${pluginDefinitionPath})`))) {
if ((status = CONFIG_MGR.setConfigPath(configId, `FILE(${pluginDefinitionPath})`))) {
printer(`Could not set config path for ${pluginDefinitionPath}, status=${status}`);
return null;
}
if ((status = CONFIG_MGR.loadConfiguration(pluginRootPath))) {
if ((status = CONFIG_MGR.loadConfiguration(configId))) {
printer(`Could not load config for ${pluginDefinitionPath}, status=${status}`);
return null;
}

let validation = CONFIG_MGR.validate(pluginRootPath);
let validation = CONFIG_MGR.validate(configId);
if (validation.ok){
if (validation.exceptionTree){
common.printError(`Validation of ${pluginDefinitionPath} against schema ${PLUGIN_DEF_SCHEMA_ID} found invalid JSON Schema data`);
Expand All @@ -151,7 +152,7 @@ export function getPluginDefinition(pluginRootPath:string, continueOnFailure?: b
}
return null;
} else {
return CONFIG_MGR.getConfigData(pluginRootPath);
return CONFIG_MGR.getConfigData(configId);
}
} else {
printer(`Error occurred on validation of ${pluginDefinitionPath} against schema ${PLUGIN_DEF_SCHEMA_ID} `);
Expand Down

0 comments on commit 02fd64c

Please sign in to comment.