From 17f31a7677a585834d8d172a67bf39bfda048a46 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 14 Feb 2008 14:56:58 +0100 Subject: NET-API-BECOME-DC: at least find the 'provision' function in python mode This is still broken, as we call provision() with wrong arguments. Also the python provision() function, doesn't allow us to specify the locations of the partition ldb files, this is strictly needed otherwise the torture test destroys a production databases. I think we should have a provision_become_dc() again! metze (This used to be commit 096eafd34778dde222bce4b0a5c0fc38b7de0359) --- source4/torture/libnet/libnet_BecomeDC.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source4') diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 0dd06bda4c..997dbc93b8 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -284,6 +284,7 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, { struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state); bool ok; + PyObject *module, *module_dict; PyObject *provision_fn, *result, *parameters; DEBUG(0,("Provision for Become-DC test using PYTHON\n")); @@ -293,13 +294,24 @@ static NTSTATUS test_become_dc_prepare_db_py(void *private_data, py_update_path("bin"); /* FIXME: Can't assume this always runs in source/... */ - provision_fn = PyImport_Import(PyString_FromString("samba.provision.provision")); + module = PyImport_Import(PyString_FromString("samba.provision")); + if (module == NULL) { + DEBUG(0, ("Unable to import 'samba.provision' Python module.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + + module_dict = PyModule_GetDict(module); + if (module_dict == NULL) { + DEBUG(0, ("Unable to GetDict of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; + } + provision_fn = PyDict_GetItemString(module_dict, "provision"); if (provision_fn == NULL) { - DEBUG(0, ("Unable to import provision Python module.\n")); - return NT_STATUS_UNSUCCESSFUL; + DEBUG(0, ("Unable to get function 'provision' of 'samba.provision'.\n")); + return NT_STATUS_UNSUCCESSFUL; } - + DEBUG(0,("New Server[%s] in Site[%s]\n", p->dest_dsa->dns_name, p->dest_dsa->site_name)); -- cgit