当我们登录 MAAS Web UI 时,我们可以MAAS Key
在页面中看到用户Preferences
。是否有机会通过控制台命令将其作为文本进行分类maas shell
?!
答案1
马斯壳牌
>>> from apiclient.creds import convert_tuple_to_string
>>> from django.contrib.auth.models import User
>>> from maasserver.models.user import get_creds_tuple
>>> admin = User.objects.get(username='admin')
>>> token = admin.tokens.all()[0]
>>> print convert_tuple_to_string(get_creds_tuple(token))