[PKG-Openstack-devel] Bug#774788: Bug#774788: neutron-metadata-agent overwrites config on update

Thomas Goirand zigo at debian.org
Fri Jan 9 22:03:45 UTC 2015

On 01/09/2015 03:13 PM, Benedikt Trefzer wrote:
> Hi Thomas
> Well the commit
> http://anonscm.debian.org/cgit/openstack/neutron.git/commit/?id=5c17e246c7e1ed00a7f58ba1be98ab0185d25b81
> mentioned does definitly not solve the bug.
>>> Though if I understand it correctly, this patch also means, that if
>>> installation is made interactivly, the user is twice asked for the
>>> values for neutron-metadata-agent/*.
>> Correct. That's annoying, but I don't see any other way to fix it. Do you?
> no I don't have better idea. Actually the question was more for me to
> check my understanding of you're fix.
> Another issue: I realized, that the old debconf values are still present
> after upgrade. Do we not need to delete them ?
> (I do not know package policy well  enough to have a qualified opinien
> about that, but it would make sense to remove them I think.)

They are useful for neutron-server, so I believe it's fine to leave them in.

> So I did some upgrade testing on my testing system (fresh install of
> jessie, install neutron-metadata-agent, upgrade to you're new version.
> Everything with
> export DEBIAN_FRONTEND=noninteractive;
> set.
> The lines in the pkgos_write_admin_creds() function
> in the neutron-metadata-agent.postinst script are guilty for the
> troubles (as far as I see).
> In 489 line you lookup the port in the config file. This one is
> correctly taken. The protocol is switched to http hardcoded, as far as I
> understand the code. And the hostname is taken from debconf value,
> without respecting the value in the config file.
> I currently not able to imagine where it reads the config file. (Sorry
> ;(). Especially I cannot understand why it does eg not change the region
> which seems to me like equivalent configured.

The values are read from within the pkgos_read_admin_creds function of
openstack-pkg-tools. The function is called this way in the

pkgos_read_admin_creds ${META_AGNT_CONF} DEFAULT neutron-metadata

- ${META_AGNT_CONF} obviously is the config file path.
- DEFAULT is the section in the config file.
- neutron-metadata is the prefix of the debconf templates (for example,

If you have a look inside the pkgos_read_admin_creds, you'll see that it
uses the pkgos_read_config function. For example for the admin user, it

pkgos_read_config -p medium ${READ_ADMIN_CRED_CONF_FNAME} \

If you solve the values of the variables, this becomes:

pkgos_read_config -p medium /etc/neutron/metadata_agent.ini \
	DEFAULT admin_user neutron-metadata/admin-user

Then you can go in the pkgos_read_config function, and see how it works.
In it, you'll see that it does read the current configuration value using:

pkgos_inifile get ${CONF_PATH} \

If a value is found, then db_set is called, before calling db_input and
db_go, then another db_get is called to populate the $RET variable (but
this isn't used here).

Does this help you to understand how all of this works?


Thomas Goirand (zigo)

More information about the Openstack-devel mailing list