41 [
CRM_alert_rc] = {
"CRM_notify_rc",
"CRM_alert_rc", NULL},
75 entry->
id = strdup(
id);
76 entry->
path = strdup(path);
93 g_hash_table_destroy(entry->
envvars);
146 crm_trace(
"Unsetting alert key %s", *key);
157 crm_trace(
"Inserting alert key %s = '%s'", *key, value);
159 g_hash_table_insert(table, strdup(*key), strdup(value));
161 g_hash_table_remove(table, *key);
171 crm_trace(
"Inserting alert key %s = %d", *key, value);
172 g_hash_table_insert(table, strdup(*key),
crm_itoa(value));
177 set_envvar(gpointer key, gpointer value, gpointer user_data)
179 gboolean always_unset = GPOINTER_TO_INT(user_data);
181 crm_trace(
"%s environment variable %s='%s'",
182 (value?
"Setting" :
"Unsetting"),
183 (
char*)key, (value? (
char*)value :
""));
184 if (value && !always_unset) {
195 g_hash_table_foreach(entry->
envvars, set_envvar, GINT_TO_POINTER(FALSE));
206 g_hash_table_foreach(entry->
envvars, set_envvar, GINT_TO_POINTER(TRUE));
210 #define XPATH_PATCHSET1_DIFF "//" F_CIB_UPDATE_RESULT "//" XML_TAG_DIFF_ADDED
212 #define XPATH_PATCHSET1_CRMCONFIG XPATH_PATCHSET1_DIFF "//" XML_CIB_TAG_CRMCONFIG
213 #define XPATH_PATCHSET1_ALERTS XPATH_PATCHSET1_DIFF "//" XML_CIB_TAG_ALERTS
215 #define XPATH_PATCHSET1_EITHER \
216 XPATH_PATCHSET1_CRMCONFIG " | " XPATH_PATCHSET1_ALERTS
218 #define XPATH_CONFIG "/" XML_TAG_CIB "/" XML_CIB_TAG_CONFIGURATION
220 #define XPATH_CRMCONFIG XPATH_CONFIG "/" XML_CIB_TAG_CRMCONFIG "/"
221 #define XPATH_ALERTS XPATH_CONFIG "/" XML_CIB_TAG_ALERTS
238 xmlNode *change = NULL;
239 xmlXPathObject *xpathObj = NULL;
257 }
else if (format == 2) {
258 for (change = __xml_first_child(patchset); change != NULL; change = __xml_next(change)) {
270 xmlNode *section = NULL;
271 const char *name = NULL;
274 ((section = __xml_first_child(change)) == NULL) ||
275 ((name = crm_element_name(section)) == NULL) ||
287 crm_warn(
"Unknown patch format: %d", format);
#define CRM_CHECK(expr, failure_action)
const char * crm_alert_keys[CRM_ALERT_INTERNAL_KEY_MAX][3]
xmlNode * get_message_xml(xmlNode *msg, const char *field)
#define CRM_ALERT_DEFAULT_TIMEOUT_MS
const char * pcmk_strerror(int rc)
crm_alert_envvar_t * crm_dup_alert_envvar(crm_alert_envvar_t *src)
void crm_unset_envvar_list(crm_alert_entry_t *entry)
void crm_set_envvar_list(crm_alert_entry_t *entry)
crm_alert_entry_t * crm_dup_alert_entry(crm_alert_entry_t *entry)
#define XPATH_PATCHSET1_EITHER
#define crm_warn(fmt, args...)
#define XPATH_PATCHSET1_ALERTS
void crm_unset_alert_keys(void)
#define crm_trace(fmt, args...)
int setenv(const char *name, const char *value, int why)
#define CRM_ALERT_NODE_SEQUENCE
#define F_CIB_UPDATE_RESULT
int crm_element_value_int(xmlNode *data, const char *name, int *dest)
const char * crm_element_value(xmlNode *data, const char *name)
void crm_insert_alert_key_int(GHashTable *table, enum crm_alert_keys_e name, int 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)
crm_alert_entry_t * crm_alert_entry_new(const char *id, const char *path)
Create a new alert entry structure.
char ** select_attribute_name
void crm_free_alert_envvar(crm_alert_envvar_t *entry)
void crm_insert_alert_key(GHashTable *table, enum crm_alert_keys_e name, const char *value)
#define XML_CIB_TAG_ALERTS
char * crm_itoa(int an_int)
void freeXpathObject(xmlXPathObjectPtr xpathObj)
void crm_free_alert_entry(crm_alert_entry_t *entry)
#define CRM_ALERT_INTERNAL_KEY_MAX