コード例 #1
0
                        dest='discovery_url',
                        help='Etcd discovery url')
    parser.add_argument('--display-group',
                        required=False,
                        dest='node_display_group',
                        help='Display group (used for Linode IP discovery).')
    parser.add_argument(
        '--hosts',
        nargs='+',
        dest='hosts',
        help='The public IP addresses of the hosts to apply rules to (for ssh)'
    )
    parser.add_argument(
        '--nodes',
        nargs='+',
        dest='nodes',
        help='The private IP addresses of the hosts (for iptable setup)')
    parser.set_defaults(cmd=FirewallCommand)

    args = parser.parse_args()
    cmd = args.cmd(args)
    args.cmd(args).run()


if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        linodeutils.log_error(e.message)
        sys.exit(1)
コード例 #2
0
ファイル: apply-firewall.py プロジェクト: CloudSide/deis
        
        linodeutils.log_info('Applying rules...')
        self.apply_rules_to_all(host_ips, rules)
        linodeutils.log_success('Done!')


def main():
    linodeutils.init()

    parser = argparse.ArgumentParser(description='Apply a "Security Group" to a Deis cluster')
    parser.add_argument('--api-key', dest='linode_api_key', help='Linode API Key')
    parser.add_argument('--private-key', required=True, type=file, dest='private_key', help='Cluster SSH Private Key')
    parser.add_argument('--private', action='store_true', dest='private', help='Only allow access to the cluster from the private network')
    parser.add_argument('--adding-new-nodes', action='store_true', dest='adding_new_nodes', help='When adding new nodes to existing cluster, allows access to etcd')
    parser.add_argument('--discovery-url', dest='discovery_url', help='Etcd discovery url')
    parser.add_argument('--display-group', required=False, dest='node_display_group', help='Display group (used for Linode IP discovery).')
    parser.add_argument('--hosts', nargs='+', dest='hosts', help='The public IP addresses of the hosts to apply rules to (for ssh)')
    parser.add_argument('--nodes', nargs='+', dest='nodes', help='The private IP addresses of the hosts (for iptable setup)')
    parser.set_defaults(cmd=FirewallCommand)
    
    args = parser.parse_args()
    cmd = args.cmd(args)
    args.cmd(args).run()
    
if __name__ == "__main__":
    try:
        main()
    except Exception as e:
        linodeutils.log_error(e.message)
        sys.exit(1)