summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-11-10 15:42:44 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-11-17 00:34:09 +0100
commit42406d63a4475ed167ca46ae21c850ee77a071ef (patch)
tree1080a3c4d0fa5cb026d40dd61981996059e96144 /source4/param
parent15b8cfcd83ab502c99bb5c02d2198c46a22f165e (diff)
downloadsamba-42406d63a4475ed167ca46ae21c850ee77a071ef.tar.gz
samba-42406d63a4475ed167ca46ae21c850ee77a071ef.tar.bz2
samba-42406d63a4475ed167ca46ae21c850ee77a071ef.zip
py-param: Add python interface to get server_role
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/pyparam.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index d5049d7d66..e7eb43f28e 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -255,6 +255,18 @@ static PyObject *py_lp_ctx_services(pytalloc_Object *self)
return ret;
}
+static PyObject *py_lp_ctx_server_role(pytalloc_Object *self)
+{
+ struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self);
+ uint32_t role;
+ const char *role_str;
+
+ role = lpcfg_server_role(lp_ctx);
+ role_str = server_role_str(role);
+
+ return PyString_FromString(role_str);
+}
+
static PyObject *py_lp_dump(PyObject *self, PyObject *args)
{
PyObject *py_stream;
@@ -306,6 +318,9 @@ static PyMethodDef py_lp_ctx_methods[] = {
"S.private_path(name) -> path\n" },
{ "services", (PyCFunction)py_lp_ctx_services, METH_NOARGS,
"S.services() -> list" },
+ { "server_role", (PyCFunction)py_lp_ctx_server_role, METH_NOARGS,
+ "S.server_role() -> value\n"
+ "Get the server role." },
{ "dump", (PyCFunction)py_lp_dump, METH_VARARGS,
"S.dump(stream, show_defaults=False)" },
{ "samdb_url", (PyCFunction)py_samdb_url, METH_NOARGS,