# Path: labs/lab.py
# def enable_debug(args):
#     if "debug" in args.__dict__ and args.debug == True:
#         if not config.has_section('Boto'):
#             config.add_section('Boto')
#         config.set('Boto', 'debug', '2')


from argparse import ArgumentParser, ArgumentTypeError
from subprocess import call
from boto import config
from labs.lab import enable_debug
import os
        parser_all.add_argument('-r', '--region', required=True, help='Geographic area to deploy to')
        parser_all.add_argument('-z', '--availability-zone', required=True, help='Isolated location to deploy to')
        parser_all.add_argument('-i', '--instance-type', default='m1.small', help='AWS EC2 instance type of nat and bastion instances to deploy')
        parser_all.add_argument('-u', '--repo-url', default='https://git@github.com/stealthly/minotaur.git', help='Public repository url where user info is stored')
        parser_all.add_argument('-c', '--cidr-block', default='10.0.0.0/21', type=check_subnet,
                                help='Subnet mask of VPC network to create, must be x.x.x.x/21')
        self.args, self.unknown = self.parser.parse_known_args()

    def deploy(self):
        # LIST
        self.print_labs()
        # DEPLOY
        if 'infrastructure' in self.args.__dict__ and self.args.infrastructure == 'deploy':
            if self.args.deploy == 'all':
                enable_debug(self.args)
                ip, mask = self.args.cidr_block.split('/')
                public_ip = '.'.join([ip.split('.')[0], ip.split('.')[1], str(int(ip.split('.')[2])+2),
                                      ip.split('.')[3]])
                sns.Sns(self.args.environment, self.args.region, 'cloudformation-notifications').deploy()
                sns.Sns(self.args.environment, self.args.region, 'autoscaling-notifications').deploy()
                vpc.Vpc(self.args.environment, self.args.region, self.args.cidr_block).deploy()
                subnet.Subnet(self.args.environment, self.args.region, self.args.availability_zone,
                              'private', '/'.join([ip, str(int(mask)+2)])).deploy()
                subnet.Subnet(self.args.environment, self.args.region, self.args.availability_zone,
                              'public', '/'.join([public_ip, str(int(mask)+3)])).deploy()
                nat.Nat(self.args.environment, self.args.region, self.args.availability_zone,
                        self.args.instance_type).deploy()
                bastion.Bastion(self.args.environment, self.args.region, self.args.availability_zone,
                                self.args.instance_type, self.args.repo_url).deploy()
            elif self.args.deploy in infrastructure_list:

# Path: labs/lab.py
# def enable_debug(args):
#     if "debug" in args.__dict__ and args.debug == True:
#         if not config.has_section('Boto'):
#             config.add_section('Boto')
#         config.set('Boto', 'debug', '2')


# Path: minotaur.py
from argparse import ArgumentParser, ArgumentTypeError
from subprocess import call
from boto import config
from labs.lab import enable_debug
import os

        parser_all.add_argument('-r', '--region', required=True, help='Geographic area to deploy to')
        parser_all.add_argument('-z', '--availability-zone', required=True, help='Isolated location to deploy to')
        parser_all.add_argument('-i', '--instance-type', default='m1.small', help='AWS EC2 instance type of nat and bastion instances to deploy')
        parser_all.add_argument('-u', '--repo-url', default='https://git@github.com/stealthly/minotaur.git', help='Public repository url where user info is stored')
        parser_all.add_argument('-c', '--cidr-block', default='10.0.0.0/21', type=check_subnet,
                                help='Subnet mask of VPC network to create, must be x.x.x.x/21')
        self.args, self.unknown = self.parser.parse_known_args()

    def deploy(self):
        # LIST
        self.print_labs()
        # DEPLOY
        if 'infrastructure' in self.args.__dict__ and self.args.infrastructure == 'deploy':
            if self.args.deploy == 'all':
                enable_debug(self.args)
                ip, mask = self.args.cidr_block.split('/')
                public_ip = '.'.join([ip.split('.')[0], ip.split('.')[1], str(int(ip.split('.')[2])+2),
                                      ip.split('.')[3]])
                sns.Sns(self.args.environment, self.args.region, 'cloudformation-notifications').deploy()
                sns.Sns(self.args.environment, self.args.region, 'autoscaling-notifications').deploy()
                vpc.Vpc(self.args.environment, self.args.region, self.args.cidr_block).deploy()
                subnet.Subnet(self.args.environment, self.args.region, self.args.availability_zone,
                              'private', '/'.join([ip, str(int(mask)+2)])).deploy()
                subnet.Subnet(self.args.environment, self.args.region, self.args.availability_zone,
                              'public', '/'.join([public_ip, str(int(mask)+3)])).deploy()
                nat.Nat(self.args.environment, self.args.region, self.args.availability_zone,
                        self.args.instance_type).deploy()
                bastion.Bastion(self.args.environment, self.args.region, self.args.availability_zone,
                                self.args.instance_type, self.args.repo_url).deploy()
            elif self.args.deploy in infrastructure_list:

                exec('{0}.main(self.parser)'.format(self.args.deploy))