def install_maas_cli(self):
"""Ensure maas-cli is installed
Fallback to MAAS stable PPA when needed.
"""
apt.init()
cache = apt.Cache()
try:
pkg = cache['maas-cli']
except KeyError:
cmd = ['add-apt-repository', '-y', MAAS_STABLE_PPA]
subprocess.check_call(cmd)
cmd = ['apt-get', 'update']
subprocess.check_call(cmd)
self.install_maas_cli()
return
if not pkg.current_ver:
apt_install('maas-cli', fatal=True)
评论列表
文章目录