aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--sos/plugins/maas.py29
2 files changed, 30 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index faf5361a..706f187a 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,6 +19,7 @@ Jeremy Agee <jagee@redhat.com>
Jesse Jaggars <jjaggars@redhat.com>
Joey Boggs <jboggs@redhat.com>
John Berninger <jwb@redhat.com>
+Jorge Niedbalski <jnr@metaklass.org>
Justin Payne <jpayne@redhat.com>
Keith Kearnan <kearnan_keith@emc.com>
Kent Lamb <klamb@redhat.com>
diff --git a/sos/plugins/maas.py b/sos/plugins/maas.py
index 9a9b88ae..8da94498 100644
--- a/sos/plugins/maas.py
+++ b/sos/plugins/maas.py
@@ -16,12 +16,33 @@
from sos.plugins import Plugin, UbuntuPlugin
+
class Maas(Plugin, UbuntuPlugin):
"""MAAS Plugin
"""
plugin_name = 'maas'
+ option_list = [
+ ('profile-name',
+ 'The name with which you will later refer to this remote', '', False),
+ ('url', 'The URL of the remote API', '', False),
+ ('credentials',
+ 'The credentials, also known as the API key', '', False)
+ ]
+
+ def _has_login_options(self):
+ return self.get_option("url") and self.get_option("credentials") \
+ and self.get_option("profile-name")
+
+ def _remote_api_login(self):
+ ret = self.call_ext_prog("maas login %s %s %s" % (
+ self.get_option("profile-name"),
+ self.get_option("url"),
+ self.get_option("credentials")))
+
+ return ret['status'] == 0
+
def setup(self):
self.add_copy_specs([
"/etc/squid-deb-proxy",
@@ -37,4 +58,12 @@ class Maas(Plugin, UbuntuPlugin):
"maas dumpdata"
])
+ if self._has_login_options():
+ if self._remote_api_login():
+ self.add_cmd_output("maas %s commissioning-results list" %
+ self.get_option("profile-name"))
+ else:
+ self.log_error(
+ "Cannot login into Maas remote API with provided creds.")
+
# vim: et ts=4 sw=4