diff --git a/glean/cmd.py b/glean/cmd.py index 850f839..65291a7 100644 --- a/glean/cmd.py +++ b/glean/cmd.py @@ -1466,7 +1466,7 @@ def set_hostname_from_config_drive(args, meta_data): raise RuntimeError('Error setting hostname') else: # gentoo's hostname file is in a different location - if args.distro is 'gentoo': + if args.distro == 'gentoo': with open('/etc/conf.d/hostname', 'w') as fh: fh.write("hostname=\"{host}\"\n".format(host=hostname)) else: diff --git a/glean/tests/test_glean.py b/glean/tests/test_glean.py index 1e09dbe..eca8ba8 100644 --- a/glean/tests/test_glean.py +++ b/glean/tests/test_glean.py @@ -267,9 +267,9 @@ class TestGlean(base.BaseTestCase): hostname = meta_data['name'] mock_call.assert_has_calls([mock.call(['hostname', hostname])]) - if distro.lower() is 'gentoo': + if distro.lower() == 'gentoo': (self.file_handle_mocks['/etc/conf.d/hostname'].write. - assert_has_calls([mock.call(hostname)])) + assert_has_calls([mock.call('hostname="%s"\n' % hostname)])) else: self.file_handle_mocks['/etc/hostname'].write.assert_has_calls( [mock.call(hostname), mock.call('\n')])