europython 2014 yaml reader lightning talk

6
www.immobilienscout24.de Berlin | Juli 2014 | Schlomo Schapiro Systems Architect / Open Source Evangelist http://creativecommons.org/licenses/by-nd/4.0 YAML Reader Modularized Configuration Made Easy @schlomoschapiro

Upload: schlomo-schapiro

Post on 08-May-2015

241 views

Category:

Technology


2 download

DESCRIPTION

Python library (https://github.com/ImmobilienScout24/yamlreader) that wraps the yaml.safe_load function to support reading multiple YAML files as one.

TRANSCRIPT

Page 1: EuroPython 2014 YAML Reader Lightning Talk

www.immobilienscout24.de

Berlin | Juli 2014 | Schlomo SchapiroSystems Architect / Open Source Evangelist

http://creativecommons.org/licenses/by-nd/4.0

YAML Reader

Modularized Configuration Made Easy

@schlomoschapiro

Page 2: EuroPython 2014 YAML Reader Lightning Talk

/etc/foobar.conf

log:level: INFOfile: /var/log/foobar.log

users:admin:

password: changemefull_name: Admin User

Page 3: EuroPython 2014 YAML Reader Lightning Talk

/etc/foobar.d/

log:level: INFOfile: /var/log/foobar.log

users:admin:

password: changemefull_name: Admin User

00_default.yaml

foobar.rpm

is24-foobar.yaml

log:file: /is24/logs/foobar.log

users:admin:

password: is24!123view:

password: view

is24-foobar.rpm

Page 4: EuroPython 2014 YAML Reader Lightning Talk

https://github.com/ImmobilienScout24/yamlreader

YAML

YAML

YAML

YAML

YAMLMERGE

Page 5: EuroPython 2014 YAML Reader Lightning Talk

from yaml import safe_loadconfig = safe_load(open(“/etc/foobar.conf”))initialize_logging(config[“log”][“file”])

https://github.com/ImmobilienScout24/yamlreader

from yamlreader import yaml_loadconfig = yaml_load(“/etc/foobar.d/”)initialize_logging(config[“log”][“file”])

Page 6: EuroPython 2014 YAML Reader Lightning Talk

from yamlreader import yaml_load

yaml_load(“/etc/foobar.conf”)yaml_load(“/etc/foobar.d/”)yaml_load(“/etc/foobar.d/*.yml”)yaml_load([“file1.conf”,”file2.conf”])

https://github.com/ImmobilienScout24/yamlreader

http://www.yadt-project.orghttps://github.com/ImmobilienScout24