Esempio n. 1
0
def requires_aws_project_stack(*plist):
    if not plist:
        plist = [
            utils._pick("project",
                        project.project_list(),
                        default_file=deffile('.project'))
        ]

    def wrap1(func):
        @wraps(func)
        def _wrapper(stackname=None, *args, **kwargs):
            region = aws.find_region(stackname)
            asl = core.active_stack_names(region)
            if not asl:
                print '\nno AWS stacks exist, cannot continue.'
                return

            def pname_startswith(stack):
                for pname in plist:
                    if stack.startswith(pname):
                        return stack

            asl = filter(pname_startswith, asl)
            if not stackname or stackname not in asl:
                stackname = utils._pick("stack", asl)
            return func(stackname, *args, **kwargs)

        return _wrapper

    return wrap1
 def test_project_list(self):
     "a simple list of projects are returned, ignoring which org they belong to"
     prj_loc_lst = self.parsed_config['project-locations']
     expected = [
         'dummy1', 'dummy2', 'dummy3'
     ]
     self.assertEqual(project.project_list(prj_loc_lst), expected)
 def test_project_list(self):
     "a simple list of projects are returned, ignoring which org they belong to"
     prj_loc_lst = self.parsed_config['project-locations']
     expected = [
         'dummy1', 'dummy2', 'dummy3', 'just-some-sns', 'project-with-sqs', 'project-with-s3', 'project-with-ext', 'project-with-cluster',
     ]
     self.assertEqual(project.project_list(prj_loc_lst), expected)
    def test_project_list_from_multiple_files(self):
        expected = [
            'dummy1', 'dummy2', 'dummy3', 'just-some-sns', 'project-with-sqs', 'project-with-s3', 'project-with-ext', 'project-with-cluster',

            'yummy1'
        ]
        self.assertEqual(project.project_list(self.parsed_config), expected)
Esempio n. 5
0
def requires_aws_project_stack(*plist):
    if not plist:
        plist = [utils._pick("project", project.project_list(), default_file=deffile('.project'))]

    def wrap1(func):
        @wraps(func)
        def _wrapper(stackname=None, *args, **kwargs):
            region = utils.find_region(stackname)
            asl = core.active_stack_names(region)
            if not asl:
                print('\nno AWS stacks exist, cannot continue.')
                return

            def pname_startswith(stack):
                for pname in plist:
                    if stack.startswith(pname):
                        return stack
            asl = lfilter(pname_startswith, asl)
            if not stackname or stackname not in asl:
                stackname = utils._pick("stack", asl)
            return func(stackname, *args, **kwargs)
        return _wrapper
    return wrap1
Esempio n. 6
0
    
    if args.task == 'project-data':
        output = project.project_data(pname)

    elif pname == 'master-server' and args.task == 'salt-master-config':
        master_configuration_template = open('etc-salt-master.template', 'r')
        output = bootstrap.expand_master_configuration(master_configuration_template)

# many projects
else:
    if args.formula:
        # only project formulas
        output = project.known_formulas()
    elif args.env: # vagrant/aws
        # only projects that use given environment
        output = list(project.filtered_projects(lambda pname, pdata: args.env in pdata).keys())
    else:
        # all projects
        output = project.project_list()
    output.sort()

formats = {
    'yaml': utils.yaml_dumps,
    'json': partial(json.dumps, indent=4),
}
if args.format not in formats:
    print('unknown format: %s' % args.format)
    print('known formats: %s' % list(formats.keys()))
    exit(1)
print(formats[args.format](output))
Esempio n. 7
0
def add_all_boxes():
    #_, projects = core.all_projects()
    projects = project.project_list()
    # kinda gross because everything is keyed to the project, but works nicely
    boxes = {prj(pname, 'vagrant.box'): pname for pname in projects.keys()}
    return map(add_box, boxes.values())
Esempio n. 8
0
logging.disable(logging.CRITICAL)

# import buildercore
src_dir = os.path.abspath('src')
sys.path.insert(0, src_dir)
from buildercore import project, utils

# project data
if args.pname:
    pname = args.pname[0]  # multiple projects in future?
    output = project.project_data(pname)

# project list
else:
    if args.env:  # vagrant/aws
        output = project.filtered_projects(
            lambda pname, pdata: args.env in pdata).keys()
    else:
        output = project.project_list()
    output.sort()

formats = {
    'yaml': utils.ordered_dump,
    'json': partial(json.dumps, indent=4),
}
if args.format not in formats:
    print 'unknown format: %s' % args.format
    print 'known formats: %s' % formats.keys()
    exit(1)
print formats[args.format](output)
 def test_project_list(self):
     "a simple list of projects are returned, ignoring which org they belong to"
     prj_loc_lst = self.parsed_config['project-locations']
     expected = ALL_PROJECTS
     self.assertEqual(project.project_list(prj_loc_lst), expected)
 def test_project_list_from_multiple_files(self):
     expected = ALL_PROJECTS + ['yummy1']
     self.assertEqual(project.project_list(self.parsed_config), expected)
 def test_project_list(self):
     "a simple list of projects are returned, ignoring which org they belong to"
     expected = ALL_PROJECTS + ['yummy1']
     self.assertEqual(project.project_list(), expected)
Esempio n. 12
0
def all_projects():
    "returns a list of all project names"
    return project.project_list()
 def test_project_list(self):
     "a simple list of projects are returned, ignoring which org they belong to"
     expected = ALL_PROJECTS + ['yummy1']
     self.assertEqual(project.project_list(), expected)
 def test_project_list_from_multiple_files(self):
     expected = [
         'dummy1', 'dummy2', 'dummy3',
         'yummy1'
     ]
     self.assertEqual(project.project_list(self.parsed_config), expected)