config generator returns wrong value for CONF.host parameter

Bug #1282481 reported by Viktor Serhieiev
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Viktor Serhieiev
oslo-incubator
Fix Released
Medium
Yuriy Zveryanskyy

Bug Description

CONF.host parameter get it's default value as socket.getfqdn(), see [1], but in config generator we check, if default value of CONF.host equal with socket.gethostname(). See [2], [3].

Python documentation says, that " gethostname() doesn’t always return the fully qualified domain name". See [4]. So it caused pep-8 failures as on patch set 1 in patches [5] and [6].

[1] https://github.com/openstack/ironic/blob/master/ironic/common/service.py#L36
[2] https://github.com/openstack/ironic/blob/master/ironic/openstack/common/config/generator.py#L205
[3] https://github.com/openstack/oslo-incubator/blob/master/openstack/common/config/generator.py#L229
[4] http://docs.python.org/2/library/socket.html#socket.gethostname
[5] https://review.openstack.org/#/c/74760/
[6] https://review.openstack.org/#/c/74781/

Tags: config
Revision history for this message
Yuriy Zveryanskyy (yzveryanskyy) wrote :

I think this is an Oslo bug.

Possible fix in Oslo code

elif value in (socket.gethostname(), socket.getfqdn()) and 'host' in name:

here

https://github.com/openstack/oslo-incubator/blob/master/openstack/common/config/generator.py#L229

Changed in ironic:
status: New → Confirmed
Revision history for this message
Viktor Serhieiev (vsergeyev) wrote :

I looked at some other projects, and found, that they use socket.gethostname() for host default value.
Anyway, let's ask Oslo folks opinion.

Xurong Yang (idopra)
Changed in ironic:
assignee: nobody → Xurong Yang (idopra)
Changed in oslo:
assignee: nobody → Xurong Yang (idopra)
Ben Nemec (bnemec)
Changed in oslo:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Ben Nemec (bnemec) wrote :

I would be fine with adding getfqdn to that check. It fits the behavior we're expecting there, and I don't think it's unreasonable for a project to want the fqdn as the default value.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo-incubator (master)

Fix proposed to branch: master
Review: https://review.openstack.org/75349

Changed in oslo:
assignee: Xurong Yang (idopra) → Yuriy Zveryanskyy (yzveryanskyy)
status: Confirmed → In Progress
aeva black (tenbrae)
Changed in ironic:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/75349
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=1a6dfb956d1b4b8a912b148de299a9d94cb46bd3
Submitter: Jenkins
Branch: master

commit 1a6dfb956d1b4b8a912b148de299a9d94cb46bd3
Author: Yuriy Zveryanskyy <email address hidden>
Date: Fri Feb 21 10:59:43 2014 +0200

    Sanitize FQDN in config generator

    Some projects (Ironic for example) may to use socket.getfqdn()
    as default for 'host' config parameter. It can cause an error
    in check_uptodate config test.

    Closes-Bug: #1282481
    Change-Id: I322b1f472babd3894a9a27269c03d5aace26d650

Changed in oslo:
status: In Progress → Fix Committed
Changed in oslo:
milestone: none → icehouse-3
Changed in ironic:
assignee: Xurong Yang (idopra) → Victor Sergeyev (vsergeyev)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/74760
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=1fd5b44425646ddcc8801e57f65a1974f30e4330
Submitter: Jenkins
Branch: master

commit 1fd5b44425646ddcc8801e57f65a1974f30e4330
Author: Victor Sergeyev <email address hidden>
Date: Tue Feb 18 16:54:55 2014 +0200

    Sync common config module from Oslo

    List of changes

    1a6dfb9 Sanitize FQDN in config generator
    e839886 Config generator fails with lazy messages
    763eedf Fix DictOpt support in config sample generator
    e3dddd7 generator: use EXTRA_* env vars in the bash script
    e8e636c generator: add an EXTRA_LIBRARIES env variable
    5dce17b Use entry points to discover options in libraries
    dd9aa2b Remove unused variables
    ad17a69 Fix filter() usage due to python 3 compability
    7c18261 Temporary workaround for config generator
    4b3e32b Sort the output of config/generator.py by group name
    12bcdb7 Remove vim header
    806272e Improve error reporting on import failures
    6cd1c33 Clean up extra modules code

    Updated ironic.conf.sample using new config generator.

    Closes-Bug: #1282481
    Change-Id: Ice3e527589bbf0e881d21f55229264513ea445d2

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
milestone: none → icehouse-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-3 → 2014.1
Thierry Carrez (ttx)
Changed in ironic:
milestone: icehouse-3 → 2014.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.