New version 28.22.2-7

- Fix accessing org.freedesktop.hostname1 for current hostname (rvykydal)
This commit is contained in:
Martin Kolman 2018-03-26 18:34:04 +02:00
parent 7c460586e1
commit 28fb99da97
2 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,73 @@
From e9f78f3c3a1ffa41977933609d787825b00ea575 Mon Sep 17 00:00:00 2001
From: Radek Vykydal <rvykydal@redhat.com>
Date: Fri, 9 Mar 2018 13:24:09 +0100
Subject: [PATCH] Fix accessing org.freedesktop.hostname1 for current hostname
The org.freedesktop.hostname1 service is expected to be started by a
method call and is shut down when not used so using observer does not
fit here.
---
pyanaconda/modules/network/network.py | 30 ++++++++++++------------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/pyanaconda/modules/network/network.py b/pyanaconda/modules/network/network.py
index 49fbb5f2d5..6f37f36bd0 100644
--- a/pyanaconda/modules/network/network.py
+++ b/pyanaconda/modules/network/network.py
@@ -42,18 +42,12 @@ def __init__(self):
self._hostname = "localhost.localdomain"
self.current_hostname_changed = Signal()
- self._hostname_service = self._get_hostname_service_observer()
+ self._hostname_service_proxy = None
- def _get_hostname_service_observer(self):
- """Get an observer of the hostname service."""
- service = SystemBus.get_cached_observer(
- HOSTNAME_SERVICE, HOSTNAME_PATH, [HOSTNAME_INTERFACE])
-
- service.cached_properties_changed.connect(
- self._hostname_service_properties_changed)
-
- service.connect_once_available()
- return service
+ if SystemBus.check_connection():
+ self._hostname_service_proxy = SystemBus.get_proxy(HOSTNAME_SERVICE, HOSTNAME_PATH)
+ self._hostname_service_proxy.PropertiesChanged.connect(
+ self._hostname_service_properties_changed)
def publish(self):
"""Publish the module."""
@@ -90,25 +84,25 @@ def set_hostname(self, hostname):
self.hostname_changed.emit()
log.debug("Hostname is set to %s", hostname)
- def _hostname_service_properties_changed(self, observer, changed, invalid):
- if "Hostname" in changed:
- hostname = self._hostname_service.cache.Hostname
+ def _hostname_service_properties_changed(self, interface, changed, invalid):
+ if interface == HOSTNAME_INTERFACE and "Hostname" in changed:
+ hostname = changed["Hostname"]
self.current_hostname_changed.emit(hostname)
log.debug("Current hostname changed to %s", hostname)
def get_current_hostname(self):
"""Return current hostname of the system."""
- if self._hostname_service.is_service_available:
- return self._hostname_service.proxy.Hostname
+ if self._hostname_service_proxy:
+ return self._hostname_service_proxy.Hostname
log.debug("Current hostname cannot be get.")
return ""
def set_current_hostname(self, hostname):
"""Set current system hostname."""
- if not self._hostname_service.is_service_available:
+ if not self._hostname_service_proxy:
log.debug("Current hostname cannot be set.")
return
- self._hostname_service.proxy.SetHostname(hostname, False)
+ self._hostname_service_proxy.SetHostname(hostname, False)
log.debug("Current hostname is set to %s", hostname)

View File

@ -7,7 +7,7 @@
Summary: Graphical system installer
Name: anaconda
Version: 28.22.2
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2+ and MIT
Group: Applications/System
URL: http://fedoraproject.org/wiki/Anaconda
@ -36,6 +36,9 @@ Patch3: 0003-Write-rootpw-command-to-kickstart-1557529.patch
# Bug 1558906 - AttributeError: 'DiskDevice' object has no attribute 'isDisk'
Patch4: 0004-Fix-isDisk-property-name-1558906.patch
# Bug 1559680 - Realm join via kickstart during install fails with 'This computer's host name is not set correctly', but it is
Patch5: 0005-Fix-hostname-configuration-1559680.patch
# Versions of required components (done so we make sure the buildrequires
# match the requires versions of things).
@ -262,6 +265,7 @@ runtime on NFS/HTTP/FTP servers or local disks.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
# use actual build-time release number, not tarball creation time release number
@ -356,6 +360,9 @@ update-desktop-database &> /dev/null || :
%{_prefix}/libexec/anaconda/dd_*
%changelog
* Mon Mar 26 2018 Martin Kolman <mkolman@redhat.com> - 28.22.2-7
- Fix accessing org.freedesktop.hostname1 for current hostname (rvykydal)
* Thu Mar 22 2018 Martin Kolman <mkolman@redhat.com> - 28.22.2-6
- Fix 'isDisk' property name (#1558906) (vtrefny)