aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stokes <adam.stokes@ubuntu.com>2014-04-15 13:46:16 -0400
committerAdam Stokes <adam.stokes@ubuntu.com>2014-04-15 13:51:32 -0400
commit69380894c21d307776bf9062f193f53c9374a2ee (patch)
tree8fe257e722480537a1dd6a9f4dc873ce61bf05f5
parent1bbf9e9690e7f2a5afc234b905537daacaecb6d4 (diff)
parentbfdde0d9cba13b577ddf9ae24f00d8ca920ac211 (diff)
downloadsos-69380894c21d307776bf9062f193f53c9374a2ee.tar.gz
Foward maas patch code to latest trunk and update authors
Closes #272 Signed-off-by: Jorge Niedbalski <jnr@metaklass.org> Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
-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