Skip to content

Commit

Permalink
Fix: Pass errors from lsb metadata generation back to the caller
Browse files Browse the repository at this point in the history
  • Loading branch information
beekhof committed Mar 19, 2013
1 parent c69c0cf commit 0d30d10
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
5 changes: 3 additions & 2 deletions crmd/lrm.c
Expand Up @@ -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 */
Expand All @@ -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
Expand All @@ -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;
Expand Down
11 changes: 8 additions & 3 deletions lib/lrmd/lrmd_client.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0d30d10

Please sign in to comment.