Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 0d30d108783d3ab01d9b97bac262ffe00e25267e 1 parent c69c0cf
Andrew Beekhof authored March 19, 2013
5  crmd/lrm.c
@@ -418,6 +418,7 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
418 418
 static char *
419 419
 get_rsc_metadata(const char *type, const char *class, const char *provider)
420 420
 {
  421
+    int rc = 0;
421 422
     char *metadata = NULL;
422 423
 
423 424
     /* Always use a local connection for this operation */
@@ -432,7 +433,7 @@ get_rsc_metadata(const char *type, const char *class, const char *provider)
432 433
     }
433 434
 
434 435
     crm_trace("Retreiving metadata for %s::%s:%s", type, class, provider);
435  
-    lrm_state_get_metadata(lrm_state, class, provider, type, &metadata, 0);
  436
+    rc = lrm_state_get_metadata(lrm_state, class, provider, type, &metadata, 0);
436 437
 
437 438
     if (metadata) {
438 439
         /* copy the metadata because the LRM likes using
@@ -444,7 +445,7 @@ get_rsc_metadata(const char *type, const char *class, const char *provider)
444 445
         metadata = m_copy;
445 446
 
446 447
     } else {
447  
-        crm_warn("No metadata found for %s::%s:%s", type, class, provider);
  448
+        crm_warn("No metadata found for %s::%s:%s: %s (%d)", type, class, provider, pcmk_strerror(rc), rc);
448 449
     }
449 450
 
450 451
     return metadata;
11  lib/lrmd/lrmd_client.c
@@ -1555,11 +1555,15 @@ lsb_get_metadata(const char *type, char **output)
1555 1555
     char *xml_l_dscrpt = NULL;
1556 1556
     GString *l_dscrpt = NULL;
1557 1557
 
1558  
-    snprintf(ra_pathname, sizeof(ra_pathname), "%s%s%s",
1559  
-             type[0] == '/' ? "" : LSB_ROOT_DIR, type[0] == '/' ? "" : "/", type);
  1558
+    if(type[0] == '/') {
  1559
+        snprintf(ra_pathname, sizeof(ra_pathname), "%s", type);
  1560
+    } else {
  1561
+        snprintf(ra_pathname, sizeof(ra_pathname), "%s/%s", LSB_ROOT_DIR, type);
  1562
+    }
1560 1563
 
  1564
+    crm_trace("Looking into %s", ra_pathname);
1561 1565
     if (!(fp = fopen(ra_pathname, "r"))) {
1562  
-        return -EIO;
  1566
+        return -errno;
1563 1567
     }
1564 1568
 
1565 1569
     /* Enter into the lsb-compliant comment block */
@@ -1628,6 +1632,7 @@ lsb_get_metadata(const char *type, char **output)
1628 1632
     *output = strdup(meta_data->str);
1629 1633
     g_string_free(meta_data, TRUE);
1630 1634
 
  1635
+    crm_trace("Created fake metadata: %d", strlen(*output));
1631 1636
     return pcmk_ok;
1632 1637
 }
1633 1638
 

0 notes on commit 0d30d10

Please sign in to comment.
Something went wrong with that request. Please try again.