41 [
CRM_alert_rc] = {
"CRM_notify_rc",
"CRM_alert_rc", NULL},
67 entry->
id = strdup(
id);
68 entry->
path = strdup(path);
85 g_hash_table_destroy(entry->
envvars);
127 crm_trace(
"Unsetting alert key %s", *key);
138 crm_trace(
"Inserting alert key %s = '%s'", *key, value);
140 g_hash_table_insert(table, strdup(*key), strdup(value));
142 g_hash_table_remove(table, *key);
152 crm_trace(
"Inserting alert key %s = %d", *key, value);
153 g_hash_table_insert(table, strdup(*key),
crm_itoa(value));
158 set_envvar(gpointer key, gpointer value, gpointer user_data)
160 gboolean always_unset = GPOINTER_TO_INT(user_data);
162 crm_trace(
"%s environment variable %s='%s'",
163 (value?
"Setting" :
"Unsetting"),
164 (
char*)key, (value? (
char*)value :
""));
165 if (value && !always_unset) {
176 g_hash_table_foreach(entry->
envvars, set_envvar, GINT_TO_POINTER(FALSE));
187 g_hash_table_foreach(entry->
envvars, set_envvar, GINT_TO_POINTER(TRUE));
191 #define XPATH_PATCHSET1_DIFF "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED 193 #define XPATH_PATCHSET1_CRMCONFIG XPATH_PATCHSET1_DIFF "//" XML_CIB_TAG_CRMCONFIG 194 #define XPATH_PATCHSET1_ALERTS XPATH_PATCHSET1_DIFF "//" XML_CIB_TAG_ALERTS 196 #define XPATH_PATCHSET1_EITHER \ 197 XPATH_PATCHSET1_CRMCONFIG " | " XPATH_PATCHSET1_ALERTS 199 #define XPATH_CONFIG "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION 201 #define XPATH_CRMCONFIG XPATH_CONFIG "/" XML_CIB_TAG_CRMCONFIG "/" 202 #define XPATH_ALERTS XPATH_CONFIG "/" XML_CIB_TAG_ALERTS 219 xmlNode *change = NULL;
220 xmlXPathObject *xpathObj = NULL;
238 }
else if (format == 2) {
239 for (change = __xml_first_child(patchset); change != NULL; change = __xml_next(change)) {
251 xmlNode *section = NULL;
252 const char *name = NULL;
255 ((section = __xml_first_child(change)) == NULL) ||
256 ((name = crm_element_name(section)) == NULL) ||
268 crm_warn(
"Unknown patch format: %d", format);
#define CRM_CHECK(expr, failure_action)
void crm_unset_envvar_list(crm_alert_entry_t *entry)
xmlNode * get_message_xml(xmlNode *msg, const char *field)
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
#define CRM_ALERT_DEFAULT_TIMEOUT_MS
const char * pcmk_strerror(int rc)
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int value)
int crm_element_value_int(const xmlNode *data, const char *name, int *dest)
Retrieve the integer value of an XML attribute.
#define XPATH_PATCHSET1_EITHER
#define crm_warn(fmt, args...)
#define XPATH_PATCHSET1_ALERTS
void crm_unset_alert_keys()
const char * crm_element_value(const xmlNode *data, const char *name)
Retrieve the value of an XML attribute.
#define crm_trace(fmt, args...)
int setenv(const char *name, const char *value, int why)
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
#define CRM_ALERT_NODE_SEQUENCE
#define F_CIB_UPDATE_RESULT
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name, const char *value)
bool crm_patchset_contains_alert(xmlNode *msg, bool config)
xmlXPathObjectPtr xpath_search(xmlNode *xml_top, const char *path)
GHashTable * crm_str_table_dup(GHashTable *old_table)
char ** select_attribute_name
#define XML_CIB_TAG_ALERTS
char * crm_itoa(int an_int)
void crm_set_envvar_list(crm_alert_entry_t *entry)
void freeXpathObject(xmlXPathObjectPtr xpathObj)
void crm_free_alert_entry(crm_alert_entry_t *entry)
#define CRM_ALERT_INTERNAL_KEY_MAX