Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get the values, for multiline options ? #10

Open
aniruddha-a opened this issue Oct 5, 2014 · 6 comments
Open

How do I get the values, for multiline options ? #10

aniruddha-a opened this issue Oct 5, 2014 · 6 comments
Assignees

Comments

@aniruddha-a
Copy link

As in this example:

[service_providers]       
service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
service_provider=VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default

i.e, there can be multiple service_provider params under the section, I want to get them all, from my sh script, and be able to modify either of them.

I tried a crudini --get <file> service_providers service_provider and I got only the last param set!
Am I missing any option here, or this is not supported?

@pixelb
Copy link
Owner

pixelb commented Oct 5, 2014

Unfortunately crudini doesn't support that at present. The interface is there now to support it through the --list option, though it will require updating the iniparse project to support that. It's a pity that openstack went with this non standard format rather than for example:

[service_providers]
service_provider=LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default
                 VPN:openswan:neutron.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default

@aniruddha-a
Copy link
Author

Ok, for now I am managing with sed, and for these kind of options, I think I have no other choice, for now.

@larsks
Copy link

larsks commented Oct 6, 2015

Is there any chance we can use the oslo.config module to read OpenStack-style config files correctly (specifically, to handle multi-line entries in a mannager identical to OpenStack)?

@pixelb
Copy link
Owner

pixelb commented Oct 7, 2015

BTW the standard list format mentioned in my reply above can be written with crudini --set --list --list-sep=$'\n' ...

For getting and setting the openstack format, it would need a selector in the interface, as currently the last item=val is read/updated, which may be depended on. I suppose this could be done with something like crudini --list --list-sep=REPEAT ... and if 'REPEAT' is specified then until we enhance the parser, have a soft dependency on oslo.config to parse/update/extract_text multistr options.

Hmm, perhaps we might avoid oslo.config and with REPEAT preprocess input to transform repeated items to/from the more standard list format shown in my first reply.

@pixelb
Copy link
Owner

pixelb commented Dec 31, 2015

I see that php supports a similar "array" format like:

[States]
east[] = Michigan
east[] = New York
east[] = Minnesota

I suppose that could be supported also with something like --list-sep=PHP

@bramford
Copy link

Unreal Engine's INI files also use this stupid non-standard format. E.g. Config/DefaultInput.ini:

-AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName="Mouse2D",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Trigger_Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName="ValveIndex_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))

@pixelb pixelb self-assigned this Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants