File pacemaker-attrd_updater-HAVE_ATOMIC_ATTRD.patch of Package pacemaker.3577
commit a22b02ec46e9c7323489fef9f2680f2d0c078083
Author: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Tue Oct 25 17:26:43 2016 +0200
Fix: attrd_updater: fix usage of HAVE_ATOMIC_ATTRD
Index: pacemaker/tools/attrd_updater.c
===================================================================
--- pacemaker.orig/tools/attrd_updater.c
+++ pacemaker/tools/attrd_updater.c
@@ -44,7 +44,7 @@ static struct crm_option long_options[]
{"-spacer-",1, 0, '-', "\nCommands:"},
{"update", 1, 0, 'U', "Update the attribute's value in attrd. If this causes the value to change, it will also be updated in the cluster configuration"},
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
{"query", 0, 0, 'Q', "\tQuery the attribute's value from attrd"},
#endif
{"delete", 0, 0, 'D', "\tDelete the attribute in attrd. If a value was previously set, it will also be removed from the cluster configuration"},
@@ -54,7 +54,7 @@ static struct crm_option long_options[]
{"delay", 1, 0, 'd', "The time to wait (dampening) in seconds for further changes before writing"},
{"set", 1, 0, 's', "(Advanced) The attribute set in which to place the value"},
{"node", 1, 0, 'N', "Set the attribute for the named node (instead of the local one)"},
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
{"all", 0, 0, 'A', "Show values of the attribute for all nodes (query only)"},
/* lifetime could be implemented for atomic attrd if there is sufficient user demand */
{"lifetime",1, 0, 'l', "(Deprecated) Lifetime of the node attribute (silently ignored by cluster)"},
@@ -71,7 +71,9 @@ static struct crm_option long_options[]
};
/* *INDENT-ON* */
+#if HAVE_ATOMIC_ATTRD
static int do_query(const char *attr_name, const char *attr_node, gboolean query_all);
+#endif
static int do_update(char command, const char *attr_node, const char *attr_name,
const char *attr_value, const char *attr_section,
const char *attr_set, const char *attr_dampen, int attr_options);
@@ -91,7 +93,7 @@ main(int argc, char **argv)
const char *attr_dampen = NULL;
char command = 'Q';
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
gboolean query_all = FALSE;
#endif
@@ -132,7 +134,7 @@ main(int argc, char **argv)
case 'N':
attr_node = strdup(optarg);
break;
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
case 'A':
query_all = TRUE;
case 'p':
@@ -141,7 +143,7 @@ main(int argc, char **argv)
#endif
case 'q':
break;
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
case 'Q':
#endif
case 'R':
@@ -171,7 +173,7 @@ main(int argc, char **argv)
}
if (command == 'Q') {
-#ifdef HAVE_ATOMIC_ATTRD
+#if HAVE_ATOMIC_ATTRD
crm_exit(do_query(attr_name, attr_node, query_all));
#else
crm_help('?', EX_USAGE);
@@ -183,6 +185,8 @@ main(int argc, char **argv)
return crm_exit(pcmk_ok);
}
+#if HAVE_ATOMIC_ATTRD
+
/*!
* \internal
* \brief Submit a query request to attrd and wait for reply
@@ -356,6 +360,8 @@ do_query(const char *attr_name, const ch
return pcmk_ok;
}
+#endif
+
static int
do_update(char command, const char *attr_node, const char *attr_name,
const char *attr_value, const char *attr_section,