]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
python3: Add controllable property to the binding
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 27 Nov 2013 18:49:03 +0000 (13:49 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 27 Nov 2013 22:45:05 +0000 (17:45 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/python-lxc/lxc.c

index 7c28607c25457e2776c8356d1c27bf641c0466ba..43e571d9d2c748e43f97391ec9c85a330116819c 100644 (file)
@@ -455,6 +455,16 @@ Container_config_file_name(Container *self, void *closure)
                 self->container->config_file_name(self->container));
 }
 
+static PyObject *
+Container_controllable(Container *self, void *closure)
+{
+    if (self->container->may_control(self->container)) {
+        Py_RETURN_TRUE;
+    }
+
+    Py_RETURN_FALSE;
+}
+
 static PyObject *
 Container_defined(Container *self, void *closure)
 {
@@ -1101,6 +1111,10 @@ static PyGetSetDef Container_getseters[] = {
      (getter)Container_config_file_name, NULL,
      "Path to the container configuration",
      NULL},
+    {"controllable",
+     (getter)Container_controllable, NULL,
+     "Boolean indicating whether the container may be controlled",
+     NULL},
     {"defined",
      (getter)Container_defined, NULL,
      "Boolean indicating whether the container configuration exists",