]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
sorcery/realtime: Add a bit of debug and warning messages for bad configs 73/773/1
authorMatt Jordan <mjordan@digium.com>
Wed, 1 Jul 2015 21:04:50 +0000 (16:04 -0500)
committerMatt Jordan <mjordan@digium.com>
Thu, 2 Jul 2015 12:31:56 +0000 (07:31 -0500)
When a mapping does not exist between a sorcery.conf defined object and
a realtime mapping in extconf, currently, the user will receive a slew
of ERROR messages that don't really tell what is happening. Some ERROR
messages may even be misleading, as they occur after the sorcery API has
already given up on the attempt to load and create the sorcery object.

This patch adds a bit of debug and a useful WARNING message for when a
wizard's open callback fails for a particular object type. In the bad
configurations that resulted in this patch, this provided a 'root cause'
WARNING message that pointed in the right direction of the configuration
problem.

Change-Id: I1cc7344f2b015b8b9c85a7e6ebc8cb4753a8f80b

main/config.c
main/sorcery.c

index d6a077b2df51c006b3e51bfe9d0ab00fb711d824..008abffdf57266fd2c70291d123881c1857c832b 100644 (file)
@@ -2869,6 +2869,7 @@ int ast_realtime_is_mapping_defined(const char *family)
                        return 1;
                }
        }
+       ast_debug(5, "Failed to find a realtime mapping for %s\n", family);
 
        return 0;
 }
index 1ff83de666b45e1f69e3e21534a2722b3e3050f1..20b3d6b2f1aea7df69c188b2d8bef48d7d0fe475 100644 (file)
@@ -991,7 +991,11 @@ enum ast_sorcery_apply_result __ast_sorcery_insert_wizard_mapping(struct ast_sor
                }
        }
 
+       ast_debug(5, "Calling wizard %s open callback on object type %s\n",
+               name, object_type->name);
        if (wizard->callbacks.open && !(object_wizard->data = wizard->callbacks.open(data))) {
+               ast_log(LOG_WARNING, "Wizard '%s' failed to open mapping for object type '%s' with data: %s\n",
+                       name, object_type->name, S_OR(data, ""));
                AST_VECTOR_RW_UNLOCK(&object_type->wizards);
                return AST_SORCERY_APPLY_FAIL;
        }