[rhel7-branch 1/1] Make the anaconda-generator exit early outside of
the
installation environment (#1289179)
by dashea
From: Martin Kolman <mkolman(a)redhat.com>
Check if the anaconda-generator is running in the installation
environment by checking where the default.target is pointing.
Proceed normally if it is pointing to the anaconda.target,
exit early if not.
This should get rid of the annoying "anaconda-generator failed with
error code 1" errors in journal when the generator tried to run in
outside of the installation environment.
Resolves: rhbz#1289179
---
data/systemd/anaconda-generator | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/data/systemd/anaconda-generator b/data/systemd/anaconda-generator
index fc4c47c..6a8a553 100755
--- a/data/systemd/anaconda-generator
+++ b/data/systemd/anaconda-generator
@@ -1,6 +1,14 @@
#!/bin/bash
# anaconda-generator: generate services needed for anaconda operation
+# only run in the Anaconda installation environment
+ANACONDA_TARGET="/lib/systemd/system/anaconda.target"
+CURRENT_DEFAULT_TARGET=$(readlink /etc/systemd/system/default.target)
+
+if [ "$ANACONDA_TARGET" != "$CURRENT_DEFAULT_TARGET" ]; then
+ exit 0
+fi
+
# set up dirs
systemd_dir=/lib/systemd/system
target_dir=$systemd_dir/anaconda.target.wants
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/267e49e486a8bee19f651009b9...
7 years, 12 months
[master 1/1] Fix crash when NM get_setting* methods return None
(#1273497)
by dashea
From: Jiri Konecny <jkonecny(a)redhat.com>
Test calling of these methods on few places.
Resolves: rhbz#1273497
---
pyanaconda/ui/gui/spokes/network.py | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 862deb5..ba9ded0 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -230,8 +230,9 @@ def get_iface(self):
iface = self.device.get_iface()
elif self.con:
iface = self.con.get_setting_connection().get_interface_name()
- if not iface:
- mac = self.con.get_setting_wired().get_mac_address()
+ wired_setting = self.con.get_setting_wired()
+ if not iface and wired_setting:
+ mac = wired_setting.get_mac_address()
if mac:
iface = nm.nm_hwaddr_to_device_name(mac)
return iface
@@ -388,7 +389,8 @@ def add_connection_to_list(self, con):
if self.dev_cfg(uuid=uuid):
log.debug("network: GUI, not adding connection %s, already in list", uuid)
return False
- if con.get_setting_connection().get_read_only():
+ con_setting = con.get_setting_connection()
+ if con_setting and con_setting.get_read_only():
log.debug("network: GUI, not adding read-only connection %s", uuid)
return False
dev_cfg = DeviceConfiguration(con=con)
@@ -399,7 +401,7 @@ def add_connection_to_list(self, con):
log.debug("network: GUI, not adding connection %s of unsupported type", uuid)
return False
if dev_cfg.get_device_type() == NM.DeviceType.ETHERNET:
- if con.get_setting_connection().get_master():
+ if con_setting and con_setting.get_master():
log.debug("network: GUI, not adding slave connection %s", uuid)
return False
# Wireless settings are handled in scope of its device's dev_cfg
@@ -530,10 +532,11 @@ def on_device_removed(self, client, device, *args):
def _find_first_ap_setting(self, device, ap):
for con in device.filter_connections(self.client.get_connections()):
- if not con.get_setting_wireless().get_ssid():
- # non-broadcast AP, we ignore these
+ wireless_setting = con.get_setting_wireless()
+ if not wireless_setting or not wireless_setting.get_ssid():
+ # setting is None or non-broadcast AP, we ignore these
return
- if con.get_setting_wireless().get_ssid().get_data() == ap.get_ssid().get_data():
+ if wireless_setting.get_ssid().get_data() == ap.get_ssid().get_data():
return con
def on_edit_connection(self, *args):
@@ -750,7 +753,8 @@ def add_device_to_list(self, device):
rc = ac.get_connection()
# Getting of NMRemoteConnection can fail (None), isn't it a bug in NM?
if rc:
- if rc.get_setting_connection().get_read_only():
+ con_setting = rc.get_setting_connection()
+ if con_setting and con_setting.get_read_only():
log.debug("network: not adding read-only connection "
"(assuming iBFT) for device %s", device.get_iface())
return
@@ -764,7 +768,7 @@ def add_device_to_list(self, device):
if device.get_device_type() != NM.DeviceType.WIFI:
cons = device.get_available_connections()
for c in cons:
- if not c.get_setting_connection().get_slave_type():
+ if c.get_setting_connection() and not c.get_setting_connection().get_slave_type():
con = c
if len(cons) != 1:
log.warning("network: %s has unexpected number of connections: %s",
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/6efeaac42a5e480658c52c9676...
7 years, 12 months