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
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)
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
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
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
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)
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)
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)
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
def load(settings_yaml_file): "read the settings.yml file in from yaml" return utils.ordered_load(open(settings_yaml_file, 'r'))
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'))