Skip to content

Commit

Permalink
[maas] remove obsolete CLI call & CLI params
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Troyanov <[email protected]>
  • Loading branch information
troyanov committed Jun 27, 2024
1 parent 5f7fd01 commit a0d3c43
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions sos/report/plugins/maas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# See the LICENSE file in the source distribution for further information.

import os
from sos.report.plugins import Plugin, UbuntuPlugin, PluginOpt
from sos.report.plugins import Plugin, UbuntuPlugin


class MAAS(Plugin, UbuntuPlugin):
Expand Down Expand Up @@ -44,27 +44,6 @@ class MAAS(Plugin, UbuntuPlugin):
'snap.maas.pebble',
)

option_list = [
PluginOpt('profile-name', default='', val_type=str,
desc='Profile name of the remote API'),
PluginOpt('url', default='', val_type=str,
desc='URL of the remote API'),
PluginOpt('credentials', default='', val_type=str,
desc='Credentials, or the API key')
]

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.exec_cmd(
f"maas login {self.get_option('profile-name')} "
f"{self.get_option('url')} {self.get_option('credentials')}"
)

return ret['status'] == 0

def _is_snap_installed(self):
maas_pkg = self.policy.package_manager.pkg_by_name('maas')
if maas_pkg:
Expand Down Expand Up @@ -177,14 +156,6 @@ def setup(self):
else:
self._deb_collect()

if self._has_login_options():
if self._remote_api_login():
self.add_cmd_output(f"maas {self.get_option('profile-name')} "
"commissioning-results list")
else:
self._log_error(
"Cannot login into MAAS remote API with provided creds.")

def postproc(self):
self.do_path_regex_sub(
r"(.*)\.(conf|yaml|yml|toml)$",
Expand Down

0 comments on commit a0d3c43

Please sign in to comment.