Commit d63b7ba4 by Stéphane Graber

python3: Handle invalid global config keys

parent 3a491345
......@@ -329,12 +329,20 @@ LXC_get_global_config_item(PyObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"key", NULL};
char* key = NULL;
const char* value = NULL;
if (! PyArg_ParseTupleAndKeywords(args, kwds, "s|", kwlist,
&key))
return NULL;
return PyUnicode_FromString(lxc_get_global_config_item(key));
value = lxc_get_global_config_item(key);
if (!value) {
PyErr_SetString(PyExc_KeyError, "Invalid configuration key");
return NULL;
}
return PyUnicode_FromString(value);
}
static PyObject *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment