コード例 #1
0
ファイル: files.py プロジェクト: elifesciences/builder
def all_projects(project_file):
    allp = utils.ordered_load(open(project_file))
    if allp is None:
        return ({}, [])
    assert "defaults" in allp, ("Project file %s is missing a `default` section" % project_file)
    defaults = allp.pop("defaults")
    return defaults, allp
コード例 #2
0
ファイル: files.py プロジェクト: stephenwf/builder
def find_snippets(project_file):
    path = project_dir_path(project_file)
    fnames = os.listdir(path)
    fnames = filter(lambda fname: not fname.startswith('.'), fnames)
    fnames = filter(lambda fname: fname.endswith('.yaml'), fnames)
    path_list = map(lambda fname: join(path, fname), fnames)
    path_list = sorted(filter(os.path.isfile, path_list))
    return map(lambda p: utils.ordered_load(open(p, 'r')), path_list)
コード例 #3
0
ファイル: files.py プロジェクト: garyttierney/builder
def all_projects(project_file):  # , project_file=config.PROJECT_FILE):
    allp = utils.ordered_load(open(project_file))
    if allp is None:
        return ({}, [])
    assert "defaults" in allp, ("Project file %s is missing a `default` section" % project_file)
    defaults = allp["defaults"]
    del allp["defaults"]
    return defaults, allp
コード例 #4
0
ファイル: files.py プロジェクト: elife-anonymous-user/builder
def all_projects(project_file): #, project_file=config.PROJECT_FILE):
    allp = utils.ordered_load(open(project_file))
    if allp is None:
        return ({}, [])
    assert "defaults" in allp, ("Project file %s is missing a `default` section" % project_file)
    defaults = allp["defaults"]
    del allp["defaults"]
    return defaults, allp
コード例 #5
0
def all_projects(project_file):
    allp = utils.ordered_load(open(project_file))
    if allp is None:
        return ({}, [])
    assert "defaults" in allp, (
        "Project file %s is missing a `default` section" % project_file)
    defaults = allp.pop("defaults")
    return defaults, allp
コード例 #6
0
def refresh_config():
    with open('/etc/salt/master', 'r') as cfgfile:
        cfg = core_utils.ordered_load(cfgfile)
    cfg['file_roots']['base'] = private_file_roots() + formula_file_roots() + basic_file_roots()
    cfg['interface'] = private_ip()
    
    with open('/etc/salt/master', 'w') as cfgfile:
        core_utils.ordered_dump(cfg, cfgfile)
コード例 #7
0
ファイル: files.py プロジェクト: elife-anonymous-user/builder
def find_snippets(project_file):
    path = project_dir_path(project_file)
    fnames = os.listdir(path)
    fnames = filter(lambda fname: not fname.startswith('.'), fnames)
    fnames = filter(lambda fname: fname.endswith('.yaml'), fnames)
    path_list = map(lambda fname: join(path, fname), fnames)
    path_list = filter(os.path.isfile, path_list)
    path_list.sort() # your snippets need to be in a natural ordering
    return map(lambda p: utils.ordered_load(open(p, 'r')), path_list)
コード例 #8
0
ファイル: remote_master.py プロジェクト: garyttierney/builder
def refresh_config():
    with open('/etc/salt/master', 'r') as cfgfile:
        cfg = core_utils.ordered_load(cfgfile)
    cfg['file_roots']['base'] = private_file_roots() + formula_file_roots(
    ) + basic_file_roots()
    cfg['interface'] = private_ip()

    with open('/etc/salt/master', 'w') as cfgfile:
        core_utils.ordered_dump(cfg, cfgfile)
コード例 #9
0
def update_project_file(pname):
    "detects if a box exists for project, updates project file"
    updates = [
        ('%s.vagrant.box' % pname, box_name(pname)),
        ('%s.vagrant.box-url' % pname, box_metadata_url(pname))
    ]
    if pname == 'basebox':
        # special handling when updating the basebox
        # leave the actual basebox project's box and box_url settings as-is
        updates = [
            ('defaults.vagrant.box', box_name(pname)),
            ('defaults.vagrant.box-url', box_metadata_url(pname))
        ]

    project_file = 'asdf'
            
    project_data = core_utils.ordered_load(open(project_file, 'r'))
    for path, new_val in updates:
        project_data = project.update_project_file(path, new_val, project_data)
    project.write_project_file(project_data)
    print 'wrote',project_file
    return project_data
コード例 #10
0
ファイル: config.py プロジェクト: garyttierney/builder
def load(settings_yaml_file):
    "read the settings.yml file in from yaml"
    return utils.ordered_load(open(settings_yaml_file, 'r'))
コード例 #11
0
def read_project_file(project_file):
    "reads the contents of the YAML project file (`/path/to/builder/projects/elife.yaml`)."
    return utils.ordered_load(open(project_file, 'r'))