[lxc-devel] [pylxd/master] Add host config API call
zulcss on Github
lxc-bot at linuxcontainers.org
Mon Mar 7 13:37:49 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 396 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160307/6c332f4a/attachment.bin>
-------------- next part --------------
From 9d1c93ccc2d4389e06ac9d759e89b3281eed0975 Mon Sep 17 00:00:00 2001
From: Chuck Short <chuck.short at canonical.com>
Date: Sun, 6 Mar 2016 20:31:04 -0500
Subject: [PATCH] Add host config API call
Add ability to query the host config.
Signed-off-by: Chuck Short <chuck.short at canonical.com>
---
pylxd/deprecated/api.py | 3 +++
pylxd/deprecated/hosts.py | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/pylxd/deprecated/api.py b/pylxd/deprecated/api.py
index 18660d4..a051284 100644
--- a/pylxd/deprecated/api.py
+++ b/pylxd/deprecated/api.py
@@ -71,6 +71,9 @@ def get_kernel_version(self, data=None):
def get_host_certificate(self):
return self.hosts.get_certificate()
+ def host_config(self):
+ return self.hosts.host_config()
+
# images
def image_list(self):
return self.image.image_list()
diff --git a/pylxd/deprecated/hosts.py b/pylxd/deprecated/hosts.py
index 2ea757f..7044515 100644
--- a/pylxd/deprecated/hosts.py
+++ b/pylxd/deprecated/hosts.py
@@ -116,3 +116,11 @@ def get_certificate(self):
return data['environment']['certificate']
except exceptions.PyLXDException as e:
print('Handling run-time error: {}'.format(e))
+
+ def host_config(self):
+ try:
+ (state, data) = self.connection.get_object('GET', '/1.0')
+ return data.get('metadata')
+ except exceptions.PyLXDException as e:
+ print('Handling run-time error: {}'.format(e))
+
More information about the lxc-devel
mailing list