Bug 1106405

Summary: beah-beaker-backend fails to set default HOSTNAME configuration variable
Product: [Retired] Beaker Reporter: Jun'ichi NOMURA <junichi.nomura>
Component: beahAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.16CC: aigao, asaha, dcallagh, kueda, rmancy, tatsu-ab1, tnishimura, xma
Target Milestone: 0.17.1   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-17 00:14:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jun'ichi NOMURA 2014-06-09 09:32:07 UTC
Description of the problem:
beah-beaker-backend fails to set HOSTNAME configuration variable by default and emits a warning message.

Version-Release number of selected component (if applicable):
systemd-208-11.el7.x86_64
beah-0.7.3-1.el7eng.noarch

How reproducible:
Always

Steps to Reproduce:
1. Run a recipe in beaker
2. Check the output of "systemctl status beah-beaker-backend"

Actual behavior:
# systemctl status -l beah-beaker-backend | grep -i warning || echo OK
Jun 09 01:06:38 myhost beah-beaker-backend[1839]: --- WARNING: Value for DEFAULT.HOSTNAME (None) is not an string.

Expected behavior:
# systemctl status -l beah-beaker-backend | grep -i warning || echo OK
OK

Additional Information:

beakerlc.py tries to obtain hostname via "HOSTNAME" env:
  def defaults():
    ...
    d.update({
            ...
            'HOSTNAME':os.getenv('HOSTNAME'),

However, os.getenv('HOSTNAME') returns empty.

Using the output of '/bin/hostname' instead solves the problem.
Or there might be better systemd-way to get the equivalent information.

Comment 2 Nick Coghlan 2014-06-10 03:57:37 UTC
We've had to do some intricate dances in kickstart files to get the correct hostname information during %post, but I wasn't previously aware of troubles with HOSTNAME not being set when beah starts up. We'll investigate further.

Comment 3 Dan Callaghan 2014-06-10 04:06:18 UTC
HOSTNAME (the environment variable) is a bash-ism, it was always previously available because SysV init does everything through bash. However with systemd bash is removed from the equation entirely.

It should probably be using socket.gethostname() as the default, although it actually doesn't matter since HOSTNAME (the beah config option) is not used for anything important anymore.

Comment 4 Dan Callaghan 2014-06-10 06:01:38 UTC
On Gerrit: http://gerrit.beaker-project.org/3132

Comment 7 Amit Saha 2014-06-17 00:14:00 UTC
Beah 0.7.5 has been released on beaker-project.org.