コード例 #1
0
def start_project(ctx, name, **kwargs):
    """ Create an infrastructure project from scratch with the configured options """

    try:

        logging.basicConfig(level=kwargs.get('log_level'))
        file_data = {}
        if kwargs.get('config_file'):
            file_data = parse_infile(kwargs.get('config_file'))[0]
        kwargs.update(file_data)
        logging.debug(kwargs)
        cloud = kwargs.get('cloud')
        if cloud.lower() == 'aws':
            project = pentagon.AWSPentagonProject(name, kwargs)
        elif cloud.lower() == 'gcp':
            project = pentagon.GCPPentagonProject(name, kwargs)
        elif cloud.lower() == 'none':
            project = pentagon.PentagonProject(name, kwargs)
        else:
            raise PentagonException("Value passed for option --cloud not 'aws' or 'gcp'")
        logging.debug('Creating {} project {} with {}'.format(cloud.upper(), name, kwargs))
        project.start()
    except Exception as e:
        logging.error(e)
        logging.debug(traceback.format_exc(e))
コード例 #2
0
ファイル: cli.py プロジェクト: rushins/pentagon
def start_project(ctx, name, **kwargs):
    try:
        logging.basicConfig(level=kwargs.get('log_level'))
        project = pentagon.PentagonProject(name, kwargs)
        project.start()
    except Exception as e:
        logging.error(e)
        logging.debug(traceback.format_exc(e))
コード例 #3
0
ファイル: test_args.py プロジェクト: trumant/pentagon
 def test_noninteget_az_count(self):
     args = {
         'configure': True,
         'aws_default_region': 'test_default_region',
         'aws_availability_zone_count': 'not_an_integer'
     }
     with self.assertRaises(ValueError):
         p = pentagon.PentagonProject(self.name, args)
コード例 #4
0
ファイル: test_args.py プロジェクト: trumant/pentagon
 def setUp(self):
     self.p = pentagon.PentagonProject(self.name, self.args)