[Openstack-devel] Rewriting the .ini parsing bit of openstack-pkg-tools

gustavo panizzo <gfa> gfa at zumbi.com.ar
Mon Mar 11 17:39:23 UTC 2013


On 2013-03-11 4:55, Thomas Goirand wrote:
> Hi,

hello, first i want to thank you for your packages

>
> In Grizzly, there's a new python module called python-oslo.config. 
> It's
> very easy to use, and knows how to parse. The problem is that using a
> python module means adding a Pre-Depends, which breaks the flow of
> Debconf. Indeed, here's what it does currently:
>
> # apt-get install openstack-proxy-node
> 1/ some downloads
> 2/ Absolutely all debconf questions
> 3/ Installation of all packages
>
> But if I add a Pre-Depends: python-oslo.config, it will go like this:
>
> # apt-get install openstack-proxy-node
> 1/ some downloads
> 2/ some debconf questions, for example mysqld password
> 3/ some install with dpkg, including python-oslo.config
> 4/ some more questions for the packages that have the Pre-Depends:
> 5/ some install with dpkg of the packages not finished to install

i agree that is not nice to be disturbed in the middle of an install

>
> I don't want the 2nd version. Openstack operator all want to answer 
> all
> questions, then go to the coffee machine and rest 10 minutes during 
> the
> setup... ;)

wheel, if one really don't want to be disturbed would pressed debconf, 
right?

>
> So, I continue to think that everything should be done in shell 
> script.
> Not the way I wrote it the first time though. The goal is to have the
> same implementation as this:
> 
> https://github.com/openstack/oslo-config/blob/master/oslo/config/iniparser.py
>
> So, I wrote 2 versions: one in pure sh, and one using awk. Both are
> using regular expression, so they are easy to fix if the config files
> where to evolve in format (which is most probable seeing the history 
> of
> nova.conf: from flag file, to config file, to .ini format, to what it 
> is
> now ...).
>
> I have attached both versions, and I would like my you, my fellow
> Openstack Debian packaging team members, to comment on the
> implementation. Which of the 2 seems the most maintainable, easy to
> understand, and above all the most correct and bug free?

i think sh is the way to go, less people knows awk (at that level), at 
least i don't know that much awk ahahah

>
> Would any of you use a totally different approach to the problem?

yes, i would use oslo.config, if upstream decides tomorrow to save 
their config in gconf2 (as an example)
the parser should be rewrote, they have changed the syntax for config 
files in the past, there are no
warranties they wouldn't do it again.

openstack is a big complex software to package, i think the packaging 
work should be keep as small as possible
not in quality but in amount of work

>
> For the moment, I would lean toward the grep + sed version, as I see 
> it
> easier to read and understand, plus there's a unique parsing logic 
> for
> both get and set, which is nicer.
can python-oslo.config set values? or just retrieve?



More information about the Openstack-devel mailing list