12 Commits

Author SHA1 Message Date
Robert Li
751ad1aadf Allow multi-line config items in meta-section of local.conf
It would behave such as the contents from each meta-section in
local.conf is copied to the destination files. One exception is the multiline
options not grouped together. In that case, the contents will be grouped
together in its destination config file.

Check tests/test_config.sh for examples.

This was originally committed in https://review.openstack.org/128805.
But the original change used AWK syntax that is not supported in AWK
3.1.8, and caused syntax error on servers with that AWK version. This
patch makes the necessary change so that it's compatible with AWK
3.1.8.

Change-Id: Id1e1fe01f05bd0f19ea6e89c4f4c0f8be695dfce
Partial-Bug: #1374118
2014-10-15 21:44:31 -04:00
Kevin Benton
a7eb07a3e2 Revert "Allow multi-line config items in meta-section of local.conf"
This reverts commit 6ff21acf4c4d4ef08bbef419ba582cade4da8da7.

This commit has broken config options with colons in them.
The following is a sample configuration that no longer works:

[[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
[restproxy]
server_ssl=False
servers=10.211.1.9:80
server_ssl=False

With the above config and the code present that this reverts,
the 'servers' option will come out blank.

Change-Id: I328852d2d941605051a1bf5eaf0f7674191f8c48
2014-10-14 04:38:56 -07:00
Robert Li
6ff21acf4c Allow multi-line config items in meta-section of local.conf
It would behave such as the contents from each meta-section in
local.conf is copied to the destination files. One exception is the multiline
options not grouped together. In that case, the contents will be grouped
together in its destination config file.

Check tests/test_config.sh for examples.

Change-Id: I8c046b558eeb98ed221f6f1a59182d4179956ced
Partial-Bug: #1374118
2014-10-10 12:53:24 -04:00
Fergal Mc Carthy
cc87c2871d local.conf processing doesn't handle '=' in values
When attempting to add a libvirt section with a volume_drivers entry
to $NOVA_CONF, via a post-config block in the local.conf file, I
encountered problems; the value for this attribute takes the form

    driver=python.import.path.to.driver

but the value actually populated in the $NOVA_CONF was truncated at the
equals.

Taking the iscsi driver setting specified in the official nova.conf
documentation as an example, if I have the following in my local.conf
file:

[[post-config|$NOVA_CONF]]
[libvirt]
volume_drivers = iscsi=nova.virt.libvirt.volume.LibvirtISCSIVolumeDriver

I will see that the generated $NOVA_CONF has the following:

[libvirt]
volume_driver = iscsi

This occurs because the existing handling for a post-config setion, as
implemented in merge_config_file(), splits the line on the equals sign,
and then uses the first and seconds elements of the resulting array as
attribute name and value respectively.

However when an equals occurs as part of the value this results in the
value being truncated at the first equals in the value.

The fix I've implemented, based upon review feedback, extracts the
contents of $0 before the first equals as the attr name, and extracts
the remainder after the equals as the value. Then it strips the leading
and trailing whitespaces from both as appropriate.

I've also added test5 to tests/test_config.sh to test for, and verify,
correct operation when this scenario is encountered.  Similarly I've
added test6 to ensure that trailing spaces in values are stripped
correctly.

Change-Id: Id0cb1e6e1cece21bc5dbf427c4d756af86fbd927
Closes-Bug: #1374482
2014-10-10 08:25:38 -04:00
Ian Wienand
e2c9fee8ed Single quote iniset argument in merge_config_file
If we don't single quote the extracted argument to iniset we drop any
quotes from the source.  Add a simple test-case for this.

Partial-bug: #1374118

Change-Id: If2f47b64b11015e727a011c7e5f6e8ad378b90eb
2014-10-07 12:16:00 +11:00
Dean Troyer
b1e3d0f222 Clean up local variable usage - Remainder
Minor cleanups in a couple ofplaces:
* Config funtions
* Stackforge
* TLS

Combined a couple of smaller changesets that are loosly related

Change-Id: Ifa16f2e4c0eca0ef3401c0dfdc4f3d91809021a5
2014-08-19 19:14:04 -05:00
Ryota MIBU
410f5c0016 Fix unsubstituted filename creation
Since merge_config_file() tries to create an unsubstituted config file,
stack.sh fails due to permission denied in the file creation when you
use '[[post-config|/$Q_PLUGIN_CONF_FILE]]' and the file does not exist.

This patch deletes unnecessary 'touch' command, because the file will
be made by 'iniset' function in the next command line with evaled
string from 'configfile'.

This patch also fixes merge_config_group() to use evaled 'configfile'
when it checks the directory of the config file exists.

Change-Id: I608847a34143b5c6a1708c180186dd88a32dd44b
Closes-bug: #1294213
2014-06-17 15:43:07 +09:00
Ian Wienand
aee18c749b Enforce function declaration format in bash8
Check that function calls look like ^function foo {$ in bash8, and fix
all existing failures of that check.  Add a note to HACKING.rst

Change-Id: Ic19eecb39e0b20273d1bcd551a42fe400d54e938
2014-02-28 07:59:03 +11:00
Isaku Yamahata
bff001456c config: get_meta_section() misunderstands the beginning of metasection
For example, the line, "if [[ -n $no_proxy ]]; then" is misparsed
as the beginning of metasection because get_meta_section() misses
escaping of "|" unlike get_meta_section_files().
This patch adds necessary escape as "|" -> "\|".

Change-Id: Ic14b2ac167037c4f5db89492f0e8a4c5b13c7b6d
Closes-Bug: #1262960
2013-12-20 12:02:39 +09:00
Dean Troyer
2ac8b3f3c2 Fix a couple of INI whitespace bugs
* iniset() bails if no section or option (attribute) is supplied
* merge_config_file() properly skips lines with only whitespace

* Also split the ini-tests into their own script

Bug 1257954

Change-Id: Ie31c5bd0df8dfed129fbcf1e37228aaf25e9305d
2013-12-09 10:30:02 -06:00
Sean Dague
537d4025c5 whitespace cleanup on functions & lib/config
fix some of the bash8 issues found in functions and lib/config,
part of the long march towards fixing all the bash8 issues.

Change-Id: Ia131f64870acb0f9d196fe1a9a45d633abb6fc4d
2013-10-22 12:59:22 -04:00
Dean Troyer
893e66360c Add meta-config via local.conf
This defines a new local.conf file that is designed to take the place of all
of the 'pass-through'[1] configuration options that have been defined in DevStack.

* new local.conf file can contain multiple config file settings to be
  merged in to existing project config files
* localrc can be embedded into local.conf and will auto-extract if
  localrc does not exist
* Adds functions get_meta_section(), get_meta_section_files(),
  merge_config_file() and merge_config_group()
* Adds EXTRA_OPTS, EXTRA_BAREMETAL_OPTS, Q_DHCP_EXTRA_DEFAULT_OPTS and
  Q_SRV_EXTRA_DEFAULT_OPTS to the deprecated warning list at the end of stack.sh

[1] Pass-through options are those that do not configure or change DevStack's behaviour
but simply set a value in a project config file.  This includes most of the EXTRA_XXX_OPTS
configuration variables.

Change-Id: I367cadc86116621e9574ac203aafdab483d810d3
2013-10-11 11:41:58 -05:00