[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ginger-dev-list] about using confparse VS python configparser to pa
From: |
Jayavardhan Katta |
Subject: |
Re: [Ginger-dev-list] about using confparse VS python configparser to parse net scripts |
Date: |
Tue, 20 Oct 2015 17:36:30 +0530 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On Monday 19 October 2015 10:12 PM, Daniel Henrique Barboza wrote:
Hi,
I've been discussing this in private with Jayavardhan and I thought it
would be better to push the discussion to the ML.
Jayavardhan asked me if it was ok to use
https://code.google.com/p/confparse/ to parse the network scripts. The
idea is that the default python package, ConfigParser
(https://docs.python.org/2/library/configparser.html) does not work
well with files that are section-less, which happens to be the case of
Linux network scripts.
Checking out confparser I've noticed two downsides:
- license. It uses LGPLv3 while the rest of the plug-ins/WoK uses
LGPLv2. It is not *that* big of a deal - we would need to move Ginger,
Kimchi, Wok and the future Ginger-base to LGPL v3 as well - but it is
extra work.
We have seen that, confparse is also available at -
https://pypi.python.org/pypi/confparse/1.0a1 with GNU GPLv2
- support. As far as I've noticed, the project isn't being supported
anymore. There are 2 open issues in the old repo at code.google.com
and the latest commit in github is from Feb 22 2013. I am not sure if
we can rely in this library to release a product.
My suggestion is to use the default python library, ConfigParser, and
workaround its limitations to read the network files. Here's a
solution I've found in the web of the section-less config file:
http://stackoverflow.com/questions/2885190/using-pythons-configparser-to-read-a-file-without-section-name
This workaround is only for read operations. write, update and delete
operations needs to be taken care which looks complex.
Let me know your comments/thoughts and if you're having problems
parsing the network scripts and init files.
Option1: Use the confparse(https://pypi.python.org/pypi/confparse/1.0a1)
as library
Option2: Port the source code of confparse to the Ginger/WOKbase
Advantage of using confparse: taken care exception
handling, has all required methods like
read/write/update/delete/keyexists etc..
Option3: Our own parser code
Parser code attach
We feel Option1 or 2 is better. We have started using Option2 for the
network use case implementation. Sooner we decide on the options we
would have less rework. :-)
Daniel
propfile_parser.py
Description: Text Data