def token(self, value=None):
"""Get or set the admin token from/to the local state."""
if value is not None:
# Save the token to a file
host.write_file(
paths.ADMIN_TOKEN, value.encode("utf-8"), owner="root",
group="root", perms=0o0600)
if not os.path.exists(paths.ADMIN_TOKEN):
return None
with open(paths.ADMIN_TOKEN, 'r') as f:
return f.read().strip()
评论列表
文章目录