diff options
author | Dan Prince <dprince@redhat.com> | 2014-08-20 21:46:46 -0400 |
---|---|---|
committer | Dan Prince <dprince@redhat.com> | 2014-08-20 21:46:46 -0400 |
commit | 416943cc4e1ec7e4fc0e86640f24f0133a8b2f4e (patch) | |
tree | 67698cc6a037c5bc3339dab31bf7e4226d875074 /os_net_config/cli.py | |
parent | b3e74611befb157dc4bf992f23aaba346e655a86 (diff) |
Add support for parsing YAML
Adds new YAML examples. Also adds some new CLI test
cases which compare --noop stdout (from the CLI) for
the json and yaml examples to verify they generate
the same things.
Diffstat (limited to 'os_net_config/cli.py')
-rw-r--r-- | os_net_config/cli.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/os_net_config/cli.py b/os_net_config/cli.py index 247a1b4..e919d02 100644 --- a/os_net_config/cli.py +++ b/os_net_config/cli.py @@ -16,10 +16,10 @@ import argparse -import json import logging import os import sys +import yaml import os_net_config from os_net_config import impl_eni @@ -37,7 +37,7 @@ def parse_opts(argv): ' config file format.') parser.add_argument('-c', '--config-file', metavar='CONFIG_FILE', help="""path to the configuration file.""", - default='/etc/os-net-config/config.json') + default='/etc/os-net-config/config.yaml') parser.add_argument('-p', '--provider', metavar='PROVIDER', help="""The provider to use.""" """One of: ifcfg, eni, iproute.""", @@ -118,7 +118,7 @@ def main(argv=sys.argv): if os.path.exists(opts.config_file): with open(opts.config_file) as cf: - iface_array = json.loads(cf.read()).get("network_config") + iface_array = yaml.load(cf.read()).get("network_config") logger.debug('network_config JSON: %s' % str(iface_array)) else: logger.error('No config file exists at: %s' % opts.config_file) |