provision-linode-cluster.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:paas-tools 作者: imperodesign 项目源码 文件源码
def _report_created(self):
        # set up the report data
        rows = []
        ips = []
        data_center = self._get_data_center().get('ABBR')
        plan = self._get_plan().get('RAM')

        for linode in self._created_linodes:
            rows.append((
                linode['hostname'],
                linode['public'],
                linode['private'],
                linode['gateway'],
                data_center,
                plan
            ))
            ips.append(linode['public'])

        firewall_command = './apply-firewall.py --private-key /path/to/key/deis --hosts ' + string.join(ips, ' ')

        # set up the report constants
        divider = Style.BRIGHT + Fore.MAGENTA + ('=' * 109) + Fore.RESET + Style.RESET_ALL
        column_format = "  {:<20} {:<20} {:<20} {:<20} {:<12} {:>8}"
        formatted_header = column_format.format(*('HOSTNAME', 'PUBLIC IP', 'PRIVATE IP', 'GATEWAY', 'DC', 'PLAN'))

        # display the report
        print('')
        print(divider)
        print(divider)
        print('')
        print(Style.BRIGHT + Fore.LIGHTGREEN_EX + '  Successfully provisioned ' + str(self.num_nodes) + ' nodes!' + Fore.RESET + Style.RESET_ALL)
        print('')
        print(Style.BRIGHT + Fore.CYAN + formatted_header + Fore.RESET + Style.RESET_ALL)
        for row in rows:
            print(Fore.CYAN + column_format.format(*row) + Fore.RESET)
        print('')
        print('')
        print(Fore.LIGHTYELLOW_EX + '  Finish up your installation by securing your cluster with the following command:' + Fore.RESET)
        print('')
        print('  ' + firewall_command)
        print('')
        print(divider)
        print(divider)
        print('')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号