Permalink
Browse files

Fix: Pass errors from lsb metadata generation back to the caller

  • Loading branch information...
1 parent c69c0cf commit 0d30d108783d3ab01d9b97bac262ffe00e25267e @beekhof committed Mar 19, 2013
Showing with 11 additions and 5 deletions.
  1. +3 −2 crmd/lrm.c
  2. +8 −3 lib/lrmd/lrmd_client.c
View
@@ -418,6 +418,7 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
static char *
get_rsc_metadata(const char *type, const char *class, const char *provider)
{
+ int rc = 0;
char *metadata = NULL;
/* Always use a local connection for this operation */
@@ -432,7 +433,7 @@ get_rsc_metadata(const char *type, const char *class, const char *provider)
}
crm_trace("Retreiving metadata for %s::%s:%s", type, class, provider);
- lrm_state_get_metadata(lrm_state, class, provider, type, &metadata, 0);
+ rc = lrm_state_get_metadata(lrm_state, class, provider, type, &metadata, 0);
if (metadata) {
/* copy the metadata because the LRM likes using
@@ -444,7 +445,7 @@ get_rsc_metadata(const char *type, const char *class, const char *provider)
metadata = m_copy;
} else {
- crm_warn("No metadata found for %s::%s:%s", type, class, provider);
+ crm_warn("No metadata found for %s::%s:%s: %s (%d)", type, class, provider, pcmk_strerror(rc), rc);
}
return metadata;
View
@@ -1555,11 +1555,15 @@ lsb_get_metadata(const char *type, char **output)
char *xml_l_dscrpt = NULL;
GString *l_dscrpt = NULL;
- snprintf(ra_pathname, sizeof(ra_pathname), "%s%s%s",
- type[0] == '/' ? "" : LSB_ROOT_DIR, type[0] == '/' ? "" : "/", type);
+ if(type[0] == '/') {
+ snprintf(ra_pathname, sizeof(ra_pathname), "%s", type);
+ } else {
+ snprintf(ra_pathname, sizeof(ra_pathname), "%s/%s", LSB_ROOT_DIR, type);
+ }
+ crm_trace("Looking into %s", ra_pathname);
if (!(fp = fopen(ra_pathname, "r"))) {
- return -EIO;
+ return -errno;
}
/* Enter into the lsb-compliant comment block */
@@ -1628,6 +1632,7 @@ lsb_get_metadata(const char *type, char **output)
*output = strdup(meta_data->str);
g_string_free(meta_data, TRUE);
+ crm_trace("Created fake metadata: %d", strlen(*output));
return pcmk_ok;
}

0 comments on commit 0d30d10

Please sign in to comment.