diff --git a/src/app.jsx b/src/app.jsx index 55f1c88..a2441ef 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -28,10 +28,9 @@ export class Application extends React.Component { super(); this.state = { 'hostname': _("Unknown") }; - cockpit.file('/etc/hostname').read() - .done((content) => { - this.setState({ 'hostname': content.trim() }); - }); + cockpit.file('/etc/hostname').watch(content => { + this.setState({ 'hostname': content.trim() }); + }); } render() { diff --git a/test/check-application b/test/check-application index 40431e2..749427e 100755 --- a/test/check-application +++ b/test/check-application @@ -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")