React to hostname changes

Closes #94
This commit is contained in:
Bogdan Mustiata 2019-01-27 15:24:08 +01:00 committed by Martin Pitt
parent 891480366c
commit 2a2f99b6f0
2 changed files with 8 additions and 4 deletions

View file

@ -28,8 +28,7 @@ export class Application extends React.Component {
super();
this.state = { 'hostname': _("Unknown") };
cockpit.file('/etc/hostname').read()
.done((content) => {
cockpit.file('/etc/hostname').watch(content => {
this.setState({ 'hostname': content.trim() });
});
}

View file

@ -28,6 +28,11 @@ class TestApplication(testlib.MachineCase):
b.wait_present(".container-fluid p")
b.wait_text(".container-fluid p", "Running on " + hostname)
# change current hostname
m.execute("echo new-%s > /etc/hostname" % hostname)
# verify new hostname name
b.wait_text(".container-fluid p", "Running on new-" + hostname)
# change language to German
b.switch_to_top()
b.click("#content-user-name")