# 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_lab = subparsers.add_parser(name='lab')
        subparsers_infrastructure = parser_infrastructure.add_subparsers(dest='infrastructure')
        parser_infrastructure_deploy = subparsers_infrastructure.add_parser(name='deploy')
        parser_infrastructure_list = subparsers_infrastructure.add_parser(name='list')
        subparsers_lab = parser_lab.add_subparsers(dest='lab')
        parser_lab_deploy = subparsers_lab.add_parser(name='deploy')
        parser_lab_list = subparsers_lab.add_parser(name='list')
        subparsers_infrastructure_deploy = parser_infrastructure_deploy.add_subparsers(dest='deploy')
        subparsers_lab_deploy = parser_lab_deploy.add_subparsers(dest='deploy')
        for module in infrastructure_list:
            exec('parser_{0} = subparsers_infrastructure_deploy.add_parser(name=\'{0}\', add_help=False, parents=[{0}.parser])'.format(module))
        for module in lab_list:
            exec('parser_{0} = subparsers_lab_deploy.add_parser(name=\'{0}\', add_help=False, parents=[{0}.parser])'.format(module))
        parser_all = subparsers_infrastructure_deploy.add_parser(name='all')
        parser_all.add_argument('--debug', action='store_const', const=True, help='Enable debug mode')
        parser_all.add_argument('-e', '--environment', required=True, help='CloudFormation environment to deploy to')
        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':

# 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_lab = subparsers.add_parser(name='lab')
        subparsers_infrastructure = parser_infrastructure.add_subparsers(dest='infrastructure')
        parser_infrastructure_deploy = subparsers_infrastructure.add_parser(name='deploy')
        parser_infrastructure_list = subparsers_infrastructure.add_parser(name='list')
        subparsers_lab = parser_lab.add_subparsers(dest='lab')
        parser_lab_deploy = subparsers_lab.add_parser(name='deploy')
        parser_lab_list = subparsers_lab.add_parser(name='list')
        subparsers_infrastructure_deploy = parser_infrastructure_deploy.add_subparsers(dest='deploy')
        subparsers_lab_deploy = parser_lab_deploy.add_subparsers(dest='deploy')
        for module in infrastructure_list:
            exec('parser_{0} = subparsers_infrastructure_deploy.add_parser(name=\'{0}\', add_help=False, parents=[{0}.parser])'.format(module))
        for module in lab_list:
            exec('parser_{0} = subparsers_lab_deploy.add_parser(name=\'{0}\', add_help=False, parents=[{0}.parser])'.format(module))
        parser_all = subparsers_infrastructure_deploy.add_parser(name='all')
        parser_all.add_argument('--debug', action='store_const', const=True, help='Enable debug mode')
        parser_all.add_argument('-e', '--environment', required=True, help='CloudFormation environment to deploy to')
        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)