diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-05-16 23:53:40 -0500 |
---|---|---|
committer | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-05-26 00:17:00 -0500 |
commit | 5de0957ccc5ba51bba375d2434cd3420b7a2c3af (patch) | |
tree | eb3cd0cd22ff0695497362241b3b8da70ed2dd00 /settings.py | |
parent | 3b8d055ca761a68c74dad01a306f238674d71878 (diff) | |
download | phosphor-settingsd-5de0957ccc5ba51bba375d2434cd3420b7a2c3af.tar.gz phosphor-settingsd-5de0957ccc5ba51bba375d2434cd3420b7a2c3af.zip |
Add settings application
Implement settings d-bus interfaces.
Define a settings policy file (this commit checks in an example YAML
based policy), based on which code for a settings manager will be
generated via a python script.
This settings manager composes and places desired settings objects on
the bus.
The policy file can be supplied by a system specific bitbake recipe.
Resolves openbmc/openbmc#1487.
Change-Id: Ice0d3b319d9466824cef323a6915eb20ca5cae5c
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'settings.py')
-rwxr-xr-x | settings.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/settings.py b/settings.py new file mode 100755 index 0000000..adee094 --- /dev/null +++ b/settings.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +import os +import yaml +from mako.template import Template +import argparse + +def main(): + parser = argparse.ArgumentParser( + description="Settings YAML parser and code generator") + + parser.add_argument( + '-i', '--settings_yaml', dest='settings_yaml', + default='settings_example.yaml', help='settings yaml file to parse') + args = parser.parse_args() + + with open(os.path.join(script_dir, args.settings_yaml), 'r') as fd: + yamlDict = yaml.safe_load(fd) + + # Render the mako template + template = os.path.join(script_dir, 'settings_manager.mako.hpp') + t = Template(filename=template) + with open('settings_manager.hpp', 'w') as fd: + fd.write( + t.render( + settingsDict=yamlDict)) + + +if __name__ == '__main__': + script_dir = os.path.dirname(os.path.realpath(__file__)) + main() |