pixelb / crudini

A utility for manipulating ini files
GNU General Public License v2.0
443 stars 60 forks source link

add flag to allow creating a parameter if it does not exist #46

Closed frippe75 closed 7 years ago

frippe75 commented 7 years ago

Not sure if I'm missing something but i would like to have crudini add the parameter if it's missing using a flag --allow-missing or something.

using openstack-config command which basically calls crudini by passing all given arguments. Some boilerplate files sometimes miss a few default parameters which really should be there.

So my script will fail with: Parameter not found: rabbit_hosts

pixelb commented 7 years ago

That should be supported by default (unless --existing is specified). I.E. This will create file/section/param:

crudini --set new.ini section1 parameter1

What version of crudini are you using?

frippe75 commented 7 years ago

Hmm you are right it does work calling crudini directly. Not sure why I didn't test it, simply jumped to conclusion it had to be crudini

openstack-config simply does this: exec crudini "$@"

I think you can close this issue log and I'll hunt it down where it belongs. Thanks for the quick response and sorry for being way to fast opening this issue

pixelb commented 7 years ago

I'm guessing you're using an older version of openstack-config that didn't call out to crudini.