parent
7ed78b892a
commit
cd40b9d0e8
@ -0,0 +1,27 @@
|
|||||||
|
From 4d59d92ea86ed70866896bfdbf49a83b162016be Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 11:24:22 +0300
|
||||||
|
Subject: [PATCH 01/14] Disable subscription
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/ui/gui/spokes/subscription.py | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/ui/gui/spokes/subscription.py b/pyanaconda/ui/gui/spokes/subscription.py
|
||||||
|
index f4ee772..27d6b42 100644
|
||||||
|
--- a/pyanaconda/ui/gui/spokes/subscription.py
|
||||||
|
+++ b/pyanaconda/ui/gui/spokes/subscription.py
|
||||||
|
@@ -547,6 +547,10 @@ class SubscriptionSpoke(NormalSpoke):
|
||||||
|
# also set the spoke warning banner
|
||||||
|
self.show_warning_message(error_message)
|
||||||
|
|
||||||
|
+ @property
|
||||||
|
+ def showable(self):
|
||||||
|
+ return False
|
||||||
|
+
|
||||||
|
def initialize(self):
|
||||||
|
NormalSpoke.initialize(self)
|
||||||
|
self.initialize_start()
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 2013ba5f3258e388864d0dd47d49cf5c05308867 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 11:25:09 +0300
|
||||||
|
Subject: [PATCH 02/14] Hide CDN source button
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/ui/gui/spokes/installation_source.py | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/ui/gui/spokes/installation_source.py b/pyanaconda/ui/gui/spokes/installation_source.py
|
||||||
|
index d0d4da7..4d1c659 100644
|
||||||
|
--- a/pyanaconda/ui/gui/spokes/installation_source.py
|
||||||
|
+++ b/pyanaconda/ui/gui/spokes/installation_source.py
|
||||||
|
@@ -704,6 +704,8 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler, SourceSwitchHandler):
|
||||||
|
self._network_button = self.builder.get_object("networkRadioButton")
|
||||||
|
self._network_box = self.builder.get_object("networkBox")
|
||||||
|
|
||||||
|
+ really_hide(self._cdn_button)
|
||||||
|
+
|
||||||
|
self._url_entry = self.builder.get_object("urlEntry")
|
||||||
|
self._protocol_combo_box = self.builder.get_object("protocolComboBox")
|
||||||
|
self._iso_chooser_button = self.builder.get_object("isoChooserButton")
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,29 @@
|
|||||||
|
From ac121e85f4b97070c76f5b4a998ee1067c8d0fcc Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 11:26:08 +0300
|
||||||
|
Subject: [PATCH 03/14] Set MSVSphere installer colors
|
||||||
|
|
||||||
|
---
|
||||||
|
data/anaconda-gtk.css | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/data/anaconda-gtk.css b/data/anaconda-gtk.css
|
||||||
|
index 60a670e..cc1ec4b 100644
|
||||||
|
--- a/data/anaconda-gtk.css
|
||||||
|
+++ b/data/anaconda-gtk.css
|
||||||
|
@@ -92,10 +92,12 @@ infobar.error {
|
||||||
|
|
||||||
|
@define-color redhat #2d2d2d;
|
||||||
|
@define-color fedora #2f4265;
|
||||||
|
+@define-color msvsphere #343434;
|
||||||
|
|
||||||
|
/* theme colors/images */
|
||||||
|
|
||||||
|
@define-color product_bg_color @redhat;
|
||||||
|
+@define-color product_bg_color @msvsphere;
|
||||||
|
|
||||||
|
/* logo and sidebar classes */
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,27 @@
|
|||||||
|
From c8221db2c44911d38a06e91c203d791ef07c841c Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 11:28:41 +0300
|
||||||
|
Subject: [PATCH 04/14] Add Minimal and Server repository support
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/core/constants.py | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
|
||||||
|
index 0ab2627..bcc5270 100644
|
||||||
|
--- a/pyanaconda/core/constants.py
|
||||||
|
+++ b/pyanaconda/core/constants.py
|
||||||
|
@@ -61,7 +61,9 @@ DEFAULT_REPOS = [productName.split('-')[0].lower(),
|
||||||
|
"fedora-modular-server",
|
||||||
|
"rawhide",
|
||||||
|
"BaseOS", # Used by RHEL
|
||||||
|
- "baseos"] # Used by CentOS Stream
|
||||||
|
+ "baseos", # Used by CentOS Stream
|
||||||
|
+ "Server", # Used by MSVSphere
|
||||||
|
+ "Minimal"] # Used by MSVSphere
|
||||||
|
|
||||||
|
# Get list of repo names which should be used as updates repos
|
||||||
|
DEFAULT_UPDATE_REPOS = ["updates",
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
From e661a97359b307477babe614b6f48f3c9a0c99d8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 11:34:46 +0300
|
||||||
|
Subject: [PATCH 05/14] Set default timezone to Europe/Moscow
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/modules/timezone/installation.py | 4 ++--
|
||||||
|
pyanaconda/modules/timezone/timezone.py | 2 +-
|
||||||
|
pyanaconda/ui/gui/spokes/datetime_spoke.py | 2 +-
|
||||||
|
3 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/timezone/installation.py b/pyanaconda/modules/timezone/installation.py
|
||||||
|
index a766000..fd7fa5b 100644
|
||||||
|
--- a/pyanaconda/modules/timezone/installation.py
|
||||||
|
+++ b/pyanaconda/modules/timezone/installation.py
|
||||||
|
@@ -67,8 +67,8 @@ class ConfigureTimezoneTask(Task):
|
||||||
|
else:
|
||||||
|
# this should never happen, but for pity's sake
|
||||||
|
log.warning("Timezone %s set in kickstart is not valid, "
|
||||||
|
- "falling back to default (America/New_York).", self._timezone)
|
||||||
|
- self._timezone = "America/New_York"
|
||||||
|
+ "falling back to default (Europe/Moscow).", self._timezone)
|
||||||
|
+ self._timezone = "Europe/Moscow"
|
||||||
|
|
||||||
|
def _make_timezone_symlink(self):
|
||||||
|
"""Create the symlink that actually defines timezone."""
|
||||||
|
diff --git a/pyanaconda/modules/timezone/timezone.py b/pyanaconda/modules/timezone/timezone.py
|
||||||
|
index b0fedc4..9782ee7 100644
|
||||||
|
--- a/pyanaconda/modules/timezone/timezone.py
|
||||||
|
+++ b/pyanaconda/modules/timezone/timezone.py
|
||||||
|
@@ -39,7 +39,7 @@ class TimezoneService(KickstartService):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.timezone_changed = Signal()
|
||||||
|
- self._timezone = "America/New_York"
|
||||||
|
+ self._timezone = "Europe/Moscow"
|
||||||
|
|
||||||
|
self.is_utc_changed = Signal()
|
||||||
|
self._is_utc = False
|
||||||
|
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
|
||||||
|
index bf60750..9dd25ed 100644
|
||||||
|
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
|
||||||
|
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
|
||||||
|
@@ -67,7 +67,7 @@ SERVER_POOL = 1
|
||||||
|
SERVER_WORKING = 2
|
||||||
|
SERVER_USE = 3
|
||||||
|
|
||||||
|
-DEFAULT_TZ = "America/New_York"
|
||||||
|
+DEFAULT_TZ = "Europe/Moscow"
|
||||||
|
|
||||||
|
SPLIT_NUMBER_SUFFIX_RE = re.compile(r'([^0-9]*)([-+])([0-9]+)')
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,62 @@
|
|||||||
|
From 96287b6d95bcf8490311ab96154fb1588432132f Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 12:00:36 +0300
|
||||||
|
Subject: [PATCH 06/14] Add MSVSphere product config
|
||||||
|
|
||||||
|
---
|
||||||
|
data/product.d/msvsphere.conf | 30 ++++++++++++++++++++++++++++++
|
||||||
|
data/product.d/rhel.conf | 1 -
|
||||||
|
2 files changed, 30 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 data/product.d/msvsphere.conf
|
||||||
|
|
||||||
|
diff --git a/data/product.d/msvsphere.conf b/data/product.d/msvsphere.conf
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f795db9
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/data/product.d/msvsphere.conf
|
||||||
|
@@ -0,0 +1,30 @@
|
||||||
|
+# Anaconda configuration file for MSVSphere.
|
||||||
|
+
|
||||||
|
+[Product]
|
||||||
|
+product_name = MSVSphere
|
||||||
|
+
|
||||||
|
+[Base Product]
|
||||||
|
+product_name = Red Hat Enterprise Linux
|
||||||
|
+
|
||||||
|
+[Anaconda]
|
||||||
|
+# List of enabled Anaconda DBus modules for RHEL.
|
||||||
|
+# but without org.fedoraproject.Anaconda.Modules.Subscription
|
||||||
|
+kickstart_modules =
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Timezone
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Network
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Localization
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Security
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Users
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Payloads
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Storage
|
||||||
|
+ org.fedoraproject.Anaconda.Modules.Services
|
||||||
|
+
|
||||||
|
+[Bootloader]
|
||||||
|
+efi_dir = msvsphere
|
||||||
|
+
|
||||||
|
+[Payload]
|
||||||
|
+enable_closest_mirror = True
|
||||||
|
+default_source = CLOSEST_MIRROR
|
||||||
|
+
|
||||||
|
+[License]
|
||||||
|
+eula = /usr/share/sphere-release/EULA
|
||||||
|
diff --git a/data/product.d/rhel.conf b/data/product.d/rhel.conf
|
||||||
|
index c4de9b6..3f7e282 100644
|
||||||
|
--- a/data/product.d/rhel.conf
|
||||||
|
+++ b/data/product.d/rhel.conf
|
||||||
|
@@ -14,7 +14,6 @@ kickstart_modules =
|
||||||
|
org.fedoraproject.Anaconda.Modules.Payloads
|
||||||
|
org.fedoraproject.Anaconda.Modules.Storage
|
||||||
|
org.fedoraproject.Anaconda.Modules.Services
|
||||||
|
- org.fedoraproject.Anaconda.Modules.Subscription
|
||||||
|
|
||||||
|
[Installation System]
|
||||||
|
# The detection is disabled since #1645686.
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,25 @@
|
|||||||
|
From 12b96a427587b418f2c069ce258e6583c3c6276c Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 12:01:29 +0300
|
||||||
|
Subject: [PATCH 07/14] Set Russian language as default
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/core/constants.py | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/core/constants.py b/pyanaconda/core/constants.py
|
||||||
|
index bcc5270..1745ce2 100644
|
||||||
|
--- a/pyanaconda/core/constants.py
|
||||||
|
+++ b/pyanaconda/core/constants.py
|
||||||
|
@@ -79,7 +79,7 @@ ANACONDA_CONFIG_DIR = "/etc/anaconda/"
|
||||||
|
ANACONDA_CONFIG_TMP = "/run/anaconda/anaconda.conf"
|
||||||
|
|
||||||
|
# NOTE: this should be LANG_TERRITORY.CODESET, e.g. en_US.UTF-8
|
||||||
|
-DEFAULT_LANG = "en_US.UTF-8"
|
||||||
|
+DEFAULT_LANG = "ru_RU.UTF-8"
|
||||||
|
|
||||||
|
DEFAULT_VC_FONT = "eurlatgr"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,34 @@
|
|||||||
|
From 58455792e6d21b7b6c7a5119fe1a82af06e00496 Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 12:03:49 +0300
|
||||||
|
Subject: [PATCH 08/14] Set Russian as default language for new regions
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/geoloc.py | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/geoloc.py b/pyanaconda/geoloc.py
|
||||||
|
index 4873ea0..a9aa117 100644
|
||||||
|
--- a/pyanaconda/geoloc.py
|
||||||
|
+++ b/pyanaconda/geoloc.py
|
||||||
|
@@ -483,6 +483,17 @@ class FedoraGeoIPProvider(GeolocationBackend):
|
||||||
|
timezone_source = "GeoIP"
|
||||||
|
timezone_code = json_reply.get("time_zone", None)
|
||||||
|
|
||||||
|
+ # set Russian as default language for new regions
|
||||||
|
+ if territory == "UA":
|
||||||
|
+ region = json_reply.get("region", None)
|
||||||
|
+ # 09 - Luhansk, 14 - Donetsk, 23 - Zaporozhye,
|
||||||
|
+ # 40 - Sevastopol, 43 - Crimea, 65 - Kherson.
|
||||||
|
+ # See ISO 3166-2:UA
|
||||||
|
+ new_region_codes = ("09", "14", "23", "40", "43", "65")
|
||||||
|
+ if region in new_region_codes:
|
||||||
|
+ territory = "RU"
|
||||||
|
+ timezone_code = "Europe/Moscow"
|
||||||
|
+
|
||||||
|
# check if the timezone returned by the API is valid
|
||||||
|
if not is_valid_timezone(timezone_code):
|
||||||
|
# try to get a timezone from the territory code
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@
|
|||||||
|
From 0b57471484b98dd37de0eb6ce95b3cda393aae7c Mon Sep 17 00:00:00 2001
|
||||||
|
From: tigro <tigro@msvsphere-os.ru>
|
||||||
|
Date: Tue, 19 Dec 2023 13:53:57 +0300
|
||||||
|
Subject: [PATCH 11/14] Enable administrator by default
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/ui/gui/spokes/user.glade | 3 ++-
|
||||||
|
pyanaconda/ui/lib/users.py | 4 +++-
|
||||||
|
2 files changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/ui/gui/spokes/user.glade b/pyanaconda/ui/gui/spokes/user.glade
|
||||||
|
index 69156b1..3409166 100644
|
||||||
|
--- a/pyanaconda/ui/gui/spokes/user.glade
|
||||||
|
+++ b/pyanaconda/ui/gui/spokes/user.glade
|
||||||
|
@@ -263,7 +263,8 @@
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
- <property name="use_underline">True</property>
|
||||||
|
+ <property name="use_underline">True</property>
|
||||||
|
+ <property name="active">True</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
<signal name="toggled" handler="on_admin_toggled" swapped="no"/>
|
||||||
|
diff --git a/pyanaconda/ui/lib/users.py b/pyanaconda/ui/lib/users.py
|
||||||
|
index 31665f0..415a914 100644
|
||||||
|
--- a/pyanaconda/ui/lib/users.py
|
||||||
|
+++ b/pyanaconda/ui/lib/users.py
|
||||||
|
@@ -40,7 +40,9 @@ def get_user_list(users_module, add_default=False, add_if_not_empty=False):
|
||||||
|
# we only add default user to an empty list, to add default user to
|
||||||
|
# a populated list the add_if_not_empty option needs to be used
|
||||||
|
if not user_data_list or add_if_not_empty:
|
||||||
|
- user_data_list.insert(0, UserData())
|
||||||
|
+ data = UserData()
|
||||||
|
+ data.set_admin_priviledges(True)
|
||||||
|
+ user_data_list.insert(0, data)
|
||||||
|
|
||||||
|
return user_data_list
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,44 @@
|
|||||||
|
From 44aeb5edc044dd6e8af54117c02181d9e9552413 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anton Volkov <AV.Volkov@softline.com>
|
||||||
|
Date: Thu, 8 Feb 2024 20:59:29 +0300
|
||||||
|
Subject: [PATCH 12/14] Backport bugfixes for keyboard layout:
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1039185
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1912609
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/keyboard.py | 12 ++++++++++--
|
||||||
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
|
||||||
|
index 2c3226c..3ab47bc 100644
|
||||||
|
--- a/pyanaconda/keyboard.py
|
||||||
|
+++ b/pyanaconda/keyboard.py
|
||||||
|
@@ -171,8 +171,10 @@ def set_x_keyboard_defaults(localization_proxy, xkl_wrapper):
|
||||||
|
# store it normalized
|
||||||
|
new_layouts = [normalize_layout_variant(layouts[0])]
|
||||||
|
if not langtable.supports_ascii(layouts[0]):
|
||||||
|
- # does not support typing ASCII chars, append the default layout
|
||||||
|
- new_layouts.append(DEFAULT_KEYBOARD)
|
||||||
|
+ # The default keymap setting should have "us" before the native layout
|
||||||
|
+ # which does not support ascii,
|
||||||
|
+ # refer: https://bugzilla.redhat.com/show_bug.cgi?id=1039185
|
||||||
|
+ new_layouts.insert(0, DEFAULT_KEYBOARD)
|
||||||
|
else:
|
||||||
|
log.error("Failed to get layout for chosen locale '%s'", locale)
|
||||||
|
new_layouts = [DEFAULT_KEYBOARD]
|
||||||
|
@@ -181,6 +183,12 @@ def set_x_keyboard_defaults(localization_proxy, xkl_wrapper):
|
||||||
|
if conf.system.can_configure_keyboard:
|
||||||
|
xkl_wrapper.replace_layouts(new_layouts)
|
||||||
|
|
||||||
|
+ # the console layout configured should be "native" by default,
|
||||||
|
+ # setting that explicitly for non-ascii layouts where we prepend "us"
|
||||||
|
+ # refer: https://bugzilla.redhat.com/show_bug.cgi?id=1912609
|
||||||
|
+ if len(new_layouts) >= 2 and not langtable.supports_ascii(new_layouts[1]):
|
||||||
|
+ localization_proxy.SetVirtualConsoleKeymap(new_layouts[1])
|
||||||
|
+
|
||||||
|
if len(new_layouts) >= 2 and not localization_proxy.LayoutSwitchOptions:
|
||||||
|
# initialize layout switching if needed
|
||||||
|
localization_proxy.SetLayoutSwitchOptions(["grp:alt_shift_toggle"])
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,262 @@
|
|||||||
|
From e9211745672557570dc16829489556fa58254cbd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anton Volkov <AV.Volkov@softline.com>
|
||||||
|
Date: Tue, 20 Feb 2024 19:38:47 +0300
|
||||||
|
Subject: [PATCH 13/14] Activate all wired network devices with link in up
|
||||||
|
state when running interactive installation
|
||||||
|
|
||||||
|
---
|
||||||
|
anaconda.py | 3 +
|
||||||
|
pyanaconda/modules/network/initialization.py | 44 +++++++++
|
||||||
|
pyanaconda/modules/network/network.py | 15 ++-
|
||||||
|
.../modules/network/network_interface.py | 9 ++
|
||||||
|
pyanaconda/network.py | 91 +++++++++++++++++++
|
||||||
|
5 files changed, 161 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/anaconda.py b/anaconda.py
|
||||||
|
index bbf801b..ae282e3 100755
|
||||||
|
--- a/anaconda.py
|
||||||
|
+++ b/anaconda.py
|
||||||
|
@@ -516,6 +516,9 @@ if __name__ == "__main__":
|
||||||
|
# Initialize the network now, in case the display needs it
|
||||||
|
from pyanaconda.network import initialize_network, wait_for_connecting_NM_thread, wait_for_connected_NM
|
||||||
|
|
||||||
|
+ import pyanaconda.network # @UnusedImport
|
||||||
|
+ pyanaconda.network.interactive_mode = anaconda.interactive_mode
|
||||||
|
+
|
||||||
|
initialize_network()
|
||||||
|
# If required by user, wait for connection before starting the installation.
|
||||||
|
if opts.waitfornet:
|
||||||
|
diff --git a/pyanaconda/modules/network/initialization.py b/pyanaconda/modules/network/initialization.py
|
||||||
|
index f61b88f..dc8035a 100644
|
||||||
|
--- a/pyanaconda/modules/network/initialization.py
|
||||||
|
+++ b/pyanaconda/modules/network/initialization.py
|
||||||
|
@@ -32,6 +32,7 @@ from pyanaconda.modules.network.ifcfg import get_ifcfg_file_of_device, find_ifcf
|
||||||
|
from pyanaconda.modules.network.device_configuration import supported_wired_device_types, \
|
||||||
|
virtual_device_types
|
||||||
|
from pyanaconda.modules.network.utils import guard_by_system_configuration
|
||||||
|
+from pyanaconda.network import switch_all_network_devices
|
||||||
|
|
||||||
|
log = get_module_logger(__name__)
|
||||||
|
|
||||||
|
@@ -40,6 +41,49 @@ gi.require_version("NM", "1.0")
|
||||||
|
from gi.repository import NM
|
||||||
|
|
||||||
|
|
||||||
|
+class SwitchNetworkDevicesTask(Task):
|
||||||
|
+ """Task for switching all network devices ON"""
|
||||||
|
+
|
||||||
|
+ def __init__(self, network_data, supported_devices, bootif, ifname_option_values):
|
||||||
|
+ """Create a new task.
|
||||||
|
+
|
||||||
|
+ :param network_data: kickstart network data to be applied
|
||||||
|
+ :type: list(NetworkData)
|
||||||
|
+ :param supported_devices: list of names of supported network devices
|
||||||
|
+ :type supported_devices: list(str)
|
||||||
|
+ :param bootif: MAC addres of device to be used for --device=bootif specification
|
||||||
|
+ :type bootif: str
|
||||||
|
+ :param ifname_option_values: list of ifname boot option values
|
||||||
|
+ :type ifname_option_values: list(str)
|
||||||
|
+ """
|
||||||
|
+ super().__init__()
|
||||||
|
+ self._network_data = network_data
|
||||||
|
+ self._supported_devices = supported_devices
|
||||||
|
+ self._bootif = bootif
|
||||||
|
+ self._ifname_option_values = ifname_option_values
|
||||||
|
+
|
||||||
|
+ @property
|
||||||
|
+ def name(self):
|
||||||
|
+ return "Switch network devices on"
|
||||||
|
+
|
||||||
|
+ def for_publication(self):
|
||||||
|
+ """Return a DBus representation."""
|
||||||
|
+ return NetworkInitializationTaskInterface(self)
|
||||||
|
+
|
||||||
|
+ @guard_by_system_configuration(return_value=[])
|
||||||
|
+ def run(self):
|
||||||
|
+ """Run the switching network devices on.
|
||||||
|
+
|
||||||
|
+ :returns: names of devices
|
||||||
|
+ :rtype: list(str)
|
||||||
|
+ """
|
||||||
|
+ with nm_client_in_thread() as nm_client:
|
||||||
|
+ return self._run(nm_client)
|
||||||
|
+
|
||||||
|
+ def _run(self, nm_client):
|
||||||
|
+ return switch_all_network_devices(nm_client)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
class ApplyKickstartTask(Task):
|
||||||
|
"""Task for application of kickstart network configuration."""
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/network/network.py b/pyanaconda/modules/network/network.py
|
||||||
|
index 1e194c3..d436190 100644
|
||||||
|
--- a/pyanaconda/modules/network/network.py
|
||||||
|
+++ b/pyanaconda/modules/network/network.py
|
||||||
|
@@ -39,7 +39,7 @@ from pyanaconda.modules.network.ifcfg import get_kickstart_network_data, \
|
||||||
|
get_ifcfg_file, get_ifcfg_files_content
|
||||||
|
from pyanaconda.modules.network.installation import NetworkInstallationTask, \
|
||||||
|
ConfigureActivationOnBootTask, HostnameConfigurationTask
|
||||||
|
-from pyanaconda.modules.network.initialization import ApplyKickstartTask, \
|
||||||
|
+from pyanaconda.modules.network.initialization import ApplyKickstartTask, SwitchNetworkDevicesTask, \
|
||||||
|
ConsolidateInitramfsConnectionsTask, SetRealOnbootValuesFromKickstartTask, \
|
||||||
|
DumpMissingIfcfgFilesTask
|
||||||
|
from pyanaconda.modules.network.utils import get_default_route_iface
|
||||||
|
@@ -550,6 +550,19 @@ class NetworkService(KickstartService):
|
||||||
|
self._ifname_option_values = values
|
||||||
|
log.debug("ifname boot option values are set to %s", values)
|
||||||
|
|
||||||
|
+ def switch_network_devices_with_task(self):
|
||||||
|
+ """Switch all network devices ON
|
||||||
|
+
|
||||||
|
+ :returns: a task switching all network devices ON
|
||||||
|
+ """
|
||||||
|
+ supported_devices = [dev_info.device_name for dev_info in self.get_supported_devices()]
|
||||||
|
+ task = SwitchNetworkDevicesTask(self._original_network_data,
|
||||||
|
+ supported_devices,
|
||||||
|
+ self.bootif,
|
||||||
|
+ self.ifname_option_values)
|
||||||
|
+ task.succeeded_signal.connect(lambda: self.log_task_result(task, check_result=True))
|
||||||
|
+ return task
|
||||||
|
+
|
||||||
|
def apply_kickstart_with_task(self):
|
||||||
|
"""Apply kickstart configuration which has not already been applied.
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/network/network_interface.py b/pyanaconda/modules/network/network_interface.py
|
||||||
|
index 6e904ba..27e6e3d 100644
|
||||||
|
--- a/pyanaconda/modules/network/network_interface.py
|
||||||
|
+++ b/pyanaconda/modules/network/network_interface.py
|
||||||
|
@@ -213,6 +213,15 @@ class NetworkInterface(KickstartModuleInterface):
|
||||||
|
self.implementation.consolidate_initramfs_connections_with_task()
|
||||||
|
)
|
||||||
|
|
||||||
|
+ def SwitchNetworkDevicesWithTask(self) -> ObjPath:
|
||||||
|
+ """Switch network devices ON
|
||||||
|
+
|
||||||
|
+ :returns: DBus path of the task switching network devices ON
|
||||||
|
+ """
|
||||||
|
+ return TaskContainer.to_object_path(
|
||||||
|
+ self.implementation.switch_network_devices_with_task()
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
def ApplyKickstartWithTask(self) -> ObjPath:
|
||||||
|
"""Apply kickstart configuration which has not already been applied.
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
|
||||||
|
index d757934..f7fa48c 100644
|
||||||
|
--- a/pyanaconda/network.py
|
||||||
|
+++ b/pyanaconda/network.py
|
||||||
|
@@ -50,6 +50,8 @@ log = get_module_logger(__name__)
|
||||||
|
|
||||||
|
DEFAULT_HOSTNAME = "localhost.localdomain"
|
||||||
|
|
||||||
|
+interactive_mode = False
|
||||||
|
+
|
||||||
|
network_connected = None
|
||||||
|
network_connected_condition = threading.Condition()
|
||||||
|
|
||||||
|
@@ -272,6 +274,91 @@ def run_network_initialization_task(task_path):
|
||||||
|
log.debug(msg)
|
||||||
|
|
||||||
|
|
||||||
|
+def switch_all_network_devices(client, activate=True, check_link=True, wait=True):
|
||||||
|
+ """
|
||||||
|
+ Switch ON (or OFF) all wired network devices with link in up state.
|
||||||
|
+ Return list of device names switched ON
|
||||||
|
+ :param client: Network Manager client object
|
||||||
|
+ :param activate: True = activate (ON), False = deactivate network devices
|
||||||
|
+ :param check_link: True = activate network devices with link in up state only
|
||||||
|
+ :param wait: True = wait for network devices to become active before exiting the function
|
||||||
|
+ :rtype list(str)
|
||||||
|
+ """
|
||||||
|
+ action = "on" if activate else "off"
|
||||||
|
+ log.debug("start switching all devices %s", action)
|
||||||
|
+ if not client:
|
||||||
|
+ log.debug("NM client not available")
|
||||||
|
+ return []
|
||||||
|
+ devices = client.get_devices()
|
||||||
|
+ if not devices:
|
||||||
|
+ log.debug("No devices found")
|
||||||
|
+ return []
|
||||||
|
+ activated_ifaces = get_activated_devices(client)
|
||||||
|
+ active_connections = client.get_active_connections()
|
||||||
|
+ active_uuids = set([con.get_uuid() for con in active_connections])
|
||||||
|
+ changed = False
|
||||||
|
+ ifaces = set()
|
||||||
|
+ for device in devices:
|
||||||
|
+ if not device:
|
||||||
|
+ continue
|
||||||
|
+ switched = False
|
||||||
|
+ iface = device.get_iface()
|
||||||
|
+ if not device_type_is_supported_wired(device.get_device_type()):
|
||||||
|
+ log.debug("device %s is not wired, skipping", iface)
|
||||||
|
+ continue
|
||||||
|
+ if activate:
|
||||||
|
+ if iface in activated_ifaces:
|
||||||
|
+ log.debug("device %s activated already, skipping", iface)
|
||||||
|
+ continue
|
||||||
|
+ elif iface not in activated_ifaces:
|
||||||
|
+ log.debug("device %s not activated already, skipping", iface)
|
||||||
|
+ continue
|
||||||
|
+ # check if the link for the device is up
|
||||||
|
+ if check_link and activate:
|
||||||
|
+ try:
|
||||||
|
+ carrier = device.get_carrier()
|
||||||
|
+ except AttributeError:
|
||||||
|
+ carrier = None
|
||||||
|
+ if carrier:
|
||||||
|
+ log.debug("device %s link is up", iface)
|
||||||
|
+ else:
|
||||||
|
+ log.debug("device %s link is down", iface)
|
||||||
|
+ # skip activating device if link is down
|
||||||
|
+ continue
|
||||||
|
+ connections = device.get_available_connections()
|
||||||
|
+ if not connections:
|
||||||
|
+ log.debug("No available connections for device %s", iface)
|
||||||
|
+ continue
|
||||||
|
+ for con in connections:
|
||||||
|
+ if not con:
|
||||||
|
+ continue
|
||||||
|
+ uuid = con.get_uuid()
|
||||||
|
+ if activate:
|
||||||
|
+ if uuid in active_uuids:
|
||||||
|
+ log.debug("connection %s for device %s is active already, skipping", uuid, iface)
|
||||||
|
+ continue
|
||||||
|
+ elif uuid not in active_uuids:
|
||||||
|
+ log.debug("connection %s for device %s is not active already, skipping", uuid, iface)
|
||||||
|
+ continue
|
||||||
|
+ if activate:
|
||||||
|
+ client.activate_connection_async(con, device, None, None)
|
||||||
|
+ ifaces.add(iface)
|
||||||
|
+ else:
|
||||||
|
+ device.disconnect(None)
|
||||||
|
+ switched = changed = True
|
||||||
|
+ if switched:
|
||||||
|
+ log.info("device %s switched %s", iface, action)
|
||||||
|
+ if not changed:
|
||||||
|
+ log.debug("No devices switched %s", action)
|
||||||
|
+ if wait and ifaces:
|
||||||
|
+ if wait_for_network_devices(ifaces):
|
||||||
|
+ log.debug("waiting succeeded: devices are active")
|
||||||
|
+ else:
|
||||||
|
+ log.debug("waiting timeout has expired")
|
||||||
|
+ log.debug("finish switching all devices %s", action)
|
||||||
|
+ return list(ifaces)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def initialize_network():
|
||||||
|
"""Initialize networking."""
|
||||||
|
if not conf.system.can_configure_network:
|
||||||
|
@@ -290,6 +377,10 @@ def initialize_network():
|
||||||
|
run_network_initialization_task(network_proxy.ApplyKickstartWithTask())
|
||||||
|
run_network_initialization_task(network_proxy.DumpMissingIfcfgFilesWithTask())
|
||||||
|
run_network_initialization_task(network_proxy.SetRealOnbootValuesFromKickstartWithTask())
|
||||||
|
+ if interactive_mode:
|
||||||
|
+ run_network_initialization_task(network_proxy.SwitchNetworkDevicesWithTask())
|
||||||
|
+ else:
|
||||||
|
+ log.debug("Not activating all wired network devices in non-interactive mode")
|
||||||
|
|
||||||
|
if network_proxy.Hostname == DEFAULT_HOSTNAME:
|
||||||
|
bootopts_hostname = hostname_from_cmdline(kernel_arguments)
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
@ -0,0 +1,234 @@
|
|||||||
|
From b6807446c6531753b5b46ec906f8fa4d05f91770 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anton Volkov <AV.Volkov@softline.com>
|
||||||
|
Date: Thu, 22 Feb 2024 12:42:25 +0300
|
||||||
|
Subject: [PATCH 14/14] Set autoconnect and autoconnect-priority for
|
||||||
|
connections of all network devices with link in up state
|
||||||
|
|
||||||
|
---
|
||||||
|
pyanaconda/modules/network/initialization.py | 53 +++++++++++++-
|
||||||
|
pyanaconda/modules/network/network.py | 15 +++-
|
||||||
|
.../modules/network/network_interface.py | 9 +++
|
||||||
|
pyanaconda/network.py | 69 +++++++++++++++++++
|
||||||
|
4 files changed, 144 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/network/initialization.py b/pyanaconda/modules/network/initialization.py
|
||||||
|
index dc8035a..5530075 100644
|
||||||
|
--- a/pyanaconda/modules/network/initialization.py
|
||||||
|
+++ b/pyanaconda/modules/network/initialization.py
|
||||||
|
@@ -32,7 +32,7 @@ from pyanaconda.modules.network.ifcfg import get_ifcfg_file_of_device, find_ifcf
|
||||||
|
from pyanaconda.modules.network.device_configuration import supported_wired_device_types, \
|
||||||
|
virtual_device_types
|
||||||
|
from pyanaconda.modules.network.utils import guard_by_system_configuration
|
||||||
|
-from pyanaconda.network import switch_all_network_devices
|
||||||
|
+from pyanaconda.network import switch_all_network_devices, configure_connections
|
||||||
|
|
||||||
|
log = get_module_logger(__name__)
|
||||||
|
|
||||||
|
@@ -41,6 +41,57 @@ gi.require_version("NM", "1.0")
|
||||||
|
from gi.repository import NM
|
||||||
|
|
||||||
|
|
||||||
|
+class SetAutoconnectPriorityTask(Task):
|
||||||
|
+ """
|
||||||
|
+ Task for configuring autoconnect and autoconnect-priority for connections of
|
||||||
|
+ all network devices with link in up state
|
||||||
|
+ """
|
||||||
|
+
|
||||||
|
+ def __init__(self, network_data, supported_devices, bootif, ifname_option_values):
|
||||||
|
+ """Create a new task.
|
||||||
|
+
|
||||||
|
+ :param network_data: kickstart network data to be applied
|
||||||
|
+ :type: list(NetworkData)
|
||||||
|
+ :param supported_devices: list of names of supported network devices
|
||||||
|
+ :type supported_devices: list(str)
|
||||||
|
+ :param bootif: MAC addres of device to be used for --device=bootif specification
|
||||||
|
+ :type bootif: str
|
||||||
|
+ :param ifname_option_values: list of ifname boot option values
|
||||||
|
+ :type ifname_option_values: list(str)
|
||||||
|
+ """
|
||||||
|
+ super().__init__()
|
||||||
|
+ self._network_data = network_data
|
||||||
|
+ self._supported_devices = supported_devices
|
||||||
|
+ self._bootif = bootif
|
||||||
|
+ self._ifname_option_values = ifname_option_values
|
||||||
|
+
|
||||||
|
+ @property
|
||||||
|
+ def name(self):
|
||||||
|
+ return "Set autoconnect and autoconnect-priority for connections of network devices with link in up state"
|
||||||
|
+
|
||||||
|
+ def for_publication(self):
|
||||||
|
+ """Return a DBus representation."""
|
||||||
|
+ return NetworkInitializationTaskInterface(self)
|
||||||
|
+
|
||||||
|
+ @guard_by_system_configuration(return_value=[])
|
||||||
|
+ def run(self):
|
||||||
|
+ """
|
||||||
|
+ Run nmcli utility to set autoconnect and autoconnect-priority for
|
||||||
|
+ connections of network devices with link in up state
|
||||||
|
+ :returns: names of devices
|
||||||
|
+ :rtype: list(str)
|
||||||
|
+ """
|
||||||
|
+ with nm_client_in_thread() as nm_client:
|
||||||
|
+ return self._run(nm_client)
|
||||||
|
+
|
||||||
|
+ def _run(self, nm_client):
|
||||||
|
+ settings = {
|
||||||
|
+ "connection.autoconnect" : "yes",
|
||||||
|
+ "connection.autoconnect-priority" : "-999"
|
||||||
|
+ }
|
||||||
|
+ return configure_connections(nm_client, settings)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
class SwitchNetworkDevicesTask(Task):
|
||||||
|
"""Task for switching all network devices ON"""
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/network/network.py b/pyanaconda/modules/network/network.py
|
||||||
|
index d436190..c196ac5 100644
|
||||||
|
--- a/pyanaconda/modules/network/network.py
|
||||||
|
+++ b/pyanaconda/modules/network/network.py
|
||||||
|
@@ -40,7 +40,7 @@ from pyanaconda.modules.network.ifcfg import get_kickstart_network_data, \
|
||||||
|
from pyanaconda.modules.network.installation import NetworkInstallationTask, \
|
||||||
|
ConfigureActivationOnBootTask, HostnameConfigurationTask
|
||||||
|
from pyanaconda.modules.network.initialization import ApplyKickstartTask, SwitchNetworkDevicesTask, \
|
||||||
|
- ConsolidateInitramfsConnectionsTask, SetRealOnbootValuesFromKickstartTask, \
|
||||||
|
+ ConsolidateInitramfsConnectionsTask, SetRealOnbootValuesFromKickstartTask, SetAutoconnectPriorityTask, \
|
||||||
|
DumpMissingIfcfgFilesTask
|
||||||
|
from pyanaconda.modules.network.utils import get_default_route_iface
|
||||||
|
from pyanaconda.modules.common.structures.network import NetworkDeviceInfo
|
||||||
|
@@ -550,6 +550,19 @@ class NetworkService(KickstartService):
|
||||||
|
self._ifname_option_values = values
|
||||||
|
log.debug("ifname boot option values are set to %s", values)
|
||||||
|
|
||||||
|
+ def set_autoconnect_priority_with_task(self):
|
||||||
|
+ """
|
||||||
|
+ Set autoconnect and autoconnect-priority for connections of network devices with link in up state
|
||||||
|
+ :returns: a task configuring autoconnect and autoconnect-priority for all network devices
|
||||||
|
+ """
|
||||||
|
+ supported_devices = [dev_info.device_name for dev_info in self.get_supported_devices()]
|
||||||
|
+ task = SetAutoconnectPriorityTask(self._original_network_data,
|
||||||
|
+ supported_devices,
|
||||||
|
+ self.bootif,
|
||||||
|
+ self.ifname_option_values)
|
||||||
|
+ task.succeeded_signal.connect(lambda: self.log_task_result(task, check_result=True))
|
||||||
|
+ return task
|
||||||
|
+
|
||||||
|
def switch_network_devices_with_task(self):
|
||||||
|
"""Switch all network devices ON
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/modules/network/network_interface.py b/pyanaconda/modules/network/network_interface.py
|
||||||
|
index 27e6e3d..52b7b48 100644
|
||||||
|
--- a/pyanaconda/modules/network/network_interface.py
|
||||||
|
+++ b/pyanaconda/modules/network/network_interface.py
|
||||||
|
@@ -213,6 +213,15 @@ class NetworkInterface(KickstartModuleInterface):
|
||||||
|
self.implementation.consolidate_initramfs_connections_with_task()
|
||||||
|
)
|
||||||
|
|
||||||
|
+ def SetAutoconnectPriorityWithTask(self) -> ObjPath:
|
||||||
|
+ """Set autoconnect and autoconnect-priority for connections of network devices with link in up state
|
||||||
|
+
|
||||||
|
+ :returns: DBus path of the task switching network devices ON
|
||||||
|
+ """
|
||||||
|
+ return TaskContainer.to_object_path(
|
||||||
|
+ self.implementation.set_autoconnect_priority_with_task()
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
def SwitchNetworkDevicesWithTask(self) -> ObjPath:
|
||||||
|
"""Switch network devices ON
|
||||||
|
|
||||||
|
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
|
||||||
|
index f7fa48c..7179c19 100644
|
||||||
|
--- a/pyanaconda/network.py
|
||||||
|
+++ b/pyanaconda/network.py
|
||||||
|
@@ -46,6 +46,8 @@ from pyanaconda.modules.common.structures.network import NetworkDeviceInfo
|
||||||
|
from pyanaconda.modules.common.util import is_module_available
|
||||||
|
from pyanaconda.anaconda_loggers import get_module_logger
|
||||||
|
|
||||||
|
+import subprocess
|
||||||
|
+
|
||||||
|
log = get_module_logger(__name__)
|
||||||
|
|
||||||
|
DEFAULT_HOSTNAME = "localhost.localdomain"
|
||||||
|
@@ -274,6 +276,72 @@ def run_network_initialization_task(task_path):
|
||||||
|
log.debug(msg)
|
||||||
|
|
||||||
|
|
||||||
|
+def configure_connections(client, settings, check_link=True):
|
||||||
|
+ """
|
||||||
|
+ Configure connection parameters for all wired network devices with link in up state.
|
||||||
|
+ Return list of device names affected
|
||||||
|
+ :param client: Network Manager client object
|
||||||
|
+ :param settings: dict(str, str) = {name:value} of the setting to configure
|
||||||
|
+ :param check_link: True = handle network devices with link in up state only
|
||||||
|
+ :rtype list(str)
|
||||||
|
+ """
|
||||||
|
+ log.debug("start configuring autoconnect for all network devices with link in up state")
|
||||||
|
+ if not client:
|
||||||
|
+ log.debug("NM client not available")
|
||||||
|
+ return []
|
||||||
|
+ devices = client.get_devices()
|
||||||
|
+ if not devices:
|
||||||
|
+ log.debug("No devices found")
|
||||||
|
+ return []
|
||||||
|
+ if not settings:
|
||||||
|
+ log.debug("No settings passed")
|
||||||
|
+ return []
|
||||||
|
+ changed = False
|
||||||
|
+ ifaces = set()
|
||||||
|
+ for device in devices:
|
||||||
|
+ if not device:
|
||||||
|
+ continue
|
||||||
|
+ switched = False
|
||||||
|
+ iface = device.get_iface()
|
||||||
|
+ if not device_type_is_supported_wired(device.get_device_type()):
|
||||||
|
+ log.debug("device %s is not wired, skipping", iface)
|
||||||
|
+ continue
|
||||||
|
+ # check if the link for the device is up
|
||||||
|
+ if check_link:
|
||||||
|
+ try:
|
||||||
|
+ carrier = device.get_carrier()
|
||||||
|
+ except AttributeError:
|
||||||
|
+ carrier = None
|
||||||
|
+ if carrier:
|
||||||
|
+ log.debug("device %s link is up", iface)
|
||||||
|
+ else:
|
||||||
|
+ log.debug("device %s link is down", iface)
|
||||||
|
+ # skip modifying the autoconnect.priority setting for the device if link is down
|
||||||
|
+ continue
|
||||||
|
+ connections = device.get_available_connections()
|
||||||
|
+ if not connections:
|
||||||
|
+ log.debug("No available connections for device %s", iface)
|
||||||
|
+ continue
|
||||||
|
+ for con in connections:
|
||||||
|
+ if not con:
|
||||||
|
+ continue
|
||||||
|
+ uuid = con.get_uuid()
|
||||||
|
+ cmd_line = ["nmcli", "connection", "modify", "uuid", uuid]
|
||||||
|
+ for setting_name in settings:
|
||||||
|
+ setting_value = settings[setting_name]
|
||||||
|
+ cmd_line.extend([setting_name, setting_value])
|
||||||
|
+ p = subprocess.run(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, check=False, close_fds=True)
|
||||||
|
+ log.debug("update settings for connection %s for device %s, nmcli exit code = %s", uuid, iface, str(p.returncode))
|
||||||
|
+ ifaces.add(iface)
|
||||||
|
+ switched = changed = True
|
||||||
|
+ if switched:
|
||||||
|
+ log.info("connection settings for device %s updated", iface)
|
||||||
|
+ if not changed:
|
||||||
|
+ log.debug("No settings for devices updated")
|
||||||
|
+ log.debug("finish configuring autoconnect for all network devices with link in up state")
|
||||||
|
+ return list(ifaces)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def switch_all_network_devices(client, activate=True, check_link=True, wait=True):
|
||||||
|
"""
|
||||||
|
Switch ON (or OFF) all wired network devices with link in up state.
|
||||||
|
@@ -379,6 +447,7 @@ def initialize_network():
|
||||||
|
run_network_initialization_task(network_proxy.SetRealOnbootValuesFromKickstartWithTask())
|
||||||
|
if interactive_mode:
|
||||||
|
run_network_initialization_task(network_proxy.SwitchNetworkDevicesWithTask())
|
||||||
|
+ run_network_initialization_task(network_proxy.SetAutoconnectPriorityWithTask())
|
||||||
|
else:
|
||||||
|
log.debug("Not activating all wired network devices in non-interactive mode")
|
||||||
|
|
||||||
|
--
|
||||||
|
2.39.3
|
||||||
|
|
Loading…
Reference in new issue