From afc85edbfa7c343b992d8f5f89147b6360d01c42 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 8 Jul 2024 13:11:37 +0200 Subject: [PATCH 1/3] Fix for checking wrong directory for extensions Signed-off-by: 1000TurquoisePogs --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 11e37c5..d21c174 100644 --- a/src/main.c +++ b/src/main.c @@ -1605,8 +1605,8 @@ static int get_component_list(char *buf, size_t buf_size,ConfigManager *configmg yamlExists = true; if (check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) { yamlExists = false; - // if not check instance/extensions/component/manifest.yaml - snprintf(manifestPath, PATH_MAX, "%s/components/%s/manifest.yaml", extensionDirectory, prop->key); + // if not check //manifest.yaml + snprintf(manifestPath, PATH_MAX, "%s/%s/manifest.yaml", extensionDirectory, prop->key); DEBUG("manifest path for component %s is %s\n", prop->key, manifestPath); if(!check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) yamlExists = true; From efeca78b0e0fa15637a5614a44fedc78ace34ae3 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 8 Jul 2024 13:50:07 +0200 Subject: [PATCH 2/3] Fix extensionDirectory not being read. Hide yaml check under enabled conditional Signed-off-by: 1000TurquoisePogs --- src/main.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/main.c b/src/main.c index d21c174..a0feefe 100644 --- a/src/main.c +++ b/src/main.c @@ -1581,12 +1581,15 @@ static int get_component_list(char *buf, size_t buf_size,ConfigManager *configmg JsonObject *resultObj = jsonAsObject(result); JsonProperty *prop = resultObj->firstProperty; int getStatus = cfgGetStringC(configmgr, ZOWE_CONFIG_NAME, &runtimeDirectory, 2, "zowe", "runtimeDirectory"); - if (getStatus) { + if (!getStatus) { getStatus = cfgGetStringC(configmgr, ZOWE_CONFIG_NAME, &extensionDirectory, 2, "zowe", "extensionDirectory"); if (getStatus) { - ERROR(" failed to get runtimeDirectory and extensionDirectory"); + ERROR(" failed to get extensionDirectory"); return -1; } + } else { + ERROR(" failed to get runtimeDirectory"); + return -1; } while (prop!=NULL) { @@ -1598,18 +1601,22 @@ static int get_component_list(char *buf, size_t buf_size,ConfigManager *configmg prop = prop->next; continue; } - snprintf(manifestPath, PATH_MAX, "%s/components/%s/manifest.yaml", runtimeDirectory, prop->key); - DEBUG("manifest path for component %s is %s\n", prop->key, manifestPath); - - // check if manifest.yaml is in instance/components/component-name/manifest.yaml - yamlExists = true; - if (check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) { - yamlExists = false; - // if not check //manifest.yaml - snprintf(manifestPath, PATH_MAX, "%s/%s/manifest.yaml", extensionDirectory, prop->key); + + yamlExists = true; //unused if not enabled. otherwise set to false if not found. + if (enabled) { + snprintf(manifestPath, PATH_MAX, "%s/components/%s/manifest.yaml", runtimeDirectory, prop->key); DEBUG("manifest path for component %s is %s\n", prop->key, manifestPath); - if(!check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) - yamlExists = true; + + // check if manifest.yaml is in /components//manifest.yaml + if (check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) { + yamlExists = false; + // if not check //manifest.yaml + snprintf(manifestPath, PATH_MAX, "%s/%s/manifest.yaml", extensionDirectory, prop->key); + DEBUG("manifest path for component %s is %s\n", prop->key, manifestPath); + if(!check_if_yaml_exists(manifestPath, "MANIFEST.YAML")) { + yamlExists = true; + } + } } // read the yaml and check for item 'commands.start', if present then add enabled component to component list From 78a383af6c9f2abee5713ca959c2d7e6a371d50a Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Mon, 8 Jul 2024 13:52:11 +0200 Subject: [PATCH 3/3] Missing newlines on printout Signed-off-by: 1000TurquoisePogs --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index a0feefe..5b0a12c 100644 --- a/src/main.c +++ b/src/main.c @@ -1584,11 +1584,11 @@ static int get_component_list(char *buf, size_t buf_size,ConfigManager *configmg if (!getStatus) { getStatus = cfgGetStringC(configmgr, ZOWE_CONFIG_NAME, &extensionDirectory, 2, "zowe", "extensionDirectory"); if (getStatus) { - ERROR(" failed to get extensionDirectory"); + ERROR("failed to get extensionDirectory\n"); return -1; } } else { - ERROR(" failed to get runtimeDirectory"); + ERROR("failed to get runtimeDirectory\n"); return -1; }