def _show_inventory(self):
title = '{serial} {hostname} {ip} {account}\n'.format(
serial='ID'.ljust(10),
hostname='Hostname'.ljust(15),
ip='IP'.ljust(25),
account='Account'.ljust(10),
)
body = [
'{serial} {hostname} {ip} {account}'.format(
serial=str(c).ljust(10),
hostname=value.asset.hostname.ljust(15),
ip=value.asset.ip.ljust(25),
account=value.account.username.ljust(10),
) for c, value in enumerate(self._inventory)
]
sys.stdout.write(colored(title, 'grey', 'on_cyan', attrs=[]))
sys.stdout.write('\n'.join(body) + '\n\n')
评论列表
文章目录