pixelb / crudini

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

crudini --get suppresses parameters that overlap with those in [DEFAULTS] #29

Closed leitingtod closed 8 years ago

leitingtod commented 8 years ago

nova.conf.zip

When I query the option directly, I can get the value.

$sudo crudini --get --format=lines /etc/nova/nova.conf neutron auth_strategy [ neutron ] auth_strategy = keystone

But when I query the section with the option , I can't get it.

$ sudo crudini --get --format=lines /etc/nova/nova.conf neutron [ neutron ] metadata_proxy_shared_secret = 123 [ neutron ] service_metadata_proxy = True [ neutron ] admin_password = 123 [ neutron ] admin_username = neutron [ neutron ] admin_tenant_name = service [ neutron ] admin_auth_url = http://controller:35357/v2.0 [ neutron ] url = http://controller:9696

So, I think it may be missing when the files has same options in different section.

$ sudo crudini --get --format=lines /etc/nova/nova.conf DEFAULT auth_strategy [DEFAULT ] auth_strategy = keystone

$ sudo crudini --get --format=lines /etc/nova/nova.conf DEFAULT [ DEFAULT ] firewall_driver = nova.virt.firewall.NoopFirewallDriver [ DEFAULT ] linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver [ DEFAULT ] security_group_api = neutron [ DEFAULT ] network_api_class = nova.network.neutronv2.api.API [ DEFAULT ] verbose = True [ DEFAULT ] vncserver_proxyclient_address = 192.168.122.11 [ DEFAULT ] vncserver_listen = 192.168.122.11 [ DEFAULT ] my_ip = 192.168.122.11 [ DEFAULT ] auth_strategy = keystone [ DEFAULT ] rpc_backend = rabbit

pixelb commented 8 years ago

Yes this is not ideal but only happens when there is an overlap in both name and value with the special DEFAULTS section. I.E. only non significant items are suppressed. You would need to list the DEFAULTS section anyway to get a true representation as to what was available through a particular section. We might add an option to include all defaults if a section is specified? You can see the note in the very first version of crudini at https://github.com/pixelb/crudini/blob/0.1/crudini#L278 noting the limitation of the iniparse interface

leitingtod commented 8 years ago

Got that! Thanks a lot! :-)