Skip to content

Commit

Permalink
[RTT-4222] Add support for enabling/disabling root account for fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
You-never-know authored and jstodola committed Mar 6, 2024
1 parent 203e207 commit 11f57ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions anabot/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from anabot.conditions import is_distro_version_ge
import sys

try: # python3
from configparser import RawConfigParser
Expand All @@ -21,9 +21,9 @@
'profile_name': None,
}

# From python3.12 RawConfigParser doesn't have readfp method, we need to use read_file instead for RHEL 10 and Fedora 40
# From python3.12 RawConfigParser doesn't have readfp method, we need to use read_file
def use_read_file():
return is_distro_version_ge('rhel', 10) or is_distro_version_ge('fedora', 40)
return sys.version_info >= (3, 12)

def init_config(profile_name):
global _profile_name
Expand Down
5 changes: 2 additions & 3 deletions anabot/preprocessor/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
from anabot.conditions import is_anaconda_version_ge, is_distro, is_distro_version_ge

def has_new_root_psswd_spoke():
fedora_conditional = is_distro('fedora') and is_anaconda_version_ge('35.22.1')
return fedora_conditional or is_distro_version_ge('rhel', 10)
return is_anaconda_version_ge('35.22.1')

@replace("/installation")
def replace_installation(element):
Expand Down Expand Up @@ -105,7 +104,7 @@ def replace_hub_rootpw(element):
return
new = load_snippet("/installation/hub/root", element)
if has_new_root_psswd_spoke():
new = load_snippet("/installation/hub/root", element)
new = load_snippet("/installation/hub/new_root", element)
element.replaceNode(new)
new.xpathEval("./password")[0].setProp("value", password)
new.xpathEval("./confirm_password")[0].setProp("value", password)
Expand Down
8 changes: 6 additions & 2 deletions anabot/runtime/installation/configuration/root_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
logger = logging.getLogger('anabot')

from anabot.conditions import is_distro_version
from anabot.conditions import is_distro_version, is_anaconda_version_ge
from anabot.runtime.decorators import handle_action, handle_check, check_action_result
from anabot.runtime.default import default_handler, action_result
from anabot.runtime.functions import get_attr, getnode, getparent, getsibling, clear_text, handle_checkbox, \
Expand Down Expand Up @@ -38,10 +38,14 @@ def check_rootpw_error(parent_node):
except NonexistentError:
return True

def has_new_root_psswd_spoke():
return is_anaconda_version_ge('35.22.1')

SPOKE_SELECTOR="_Root Password"
if is_distro_version('rhel', 7):
SPOKE_SELECTOR="_ROOT PASSWORD"
elif is_distro_version('rhel', 10):

if has_new_root_psswd_spoke():
SPOKE_SELECTOR="_Root Account"

@handle_act_hub('')
Expand Down
11 changes: 4 additions & 7 deletions anabot/runtime/installation/hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from fnmatch import fnmatchcase
from time import sleep

from anabot.conditions import is_distro_version_ge
from anabot.conditions import is_distro_version_ge, is_distro_version_lt, is_distro_version
from anabot.variables import get_variable
from anabot.runtime.decorators import handle_action, handle_check, check_action_result
from anabot.runtime.default import default_handler, action_result
Expand All @@ -31,14 +31,11 @@ def _wait_for_depsolve(initial=True):
waitline = ".*DEBUG yum.verbose.YumBase: Depsolve time:.*"

# Temporary change to also support Fedora 34.
if is_distro_version_ge('rhel', 8) or is_distro_version_ge('fedora', 34):
if ((is_distro_version_ge('rhel', 8) and is_distro_version_lt('rhel', 10))
or is_distro_version('fedora', 34)):
waitline = '.* INF packaging: checking dependencies: success'

if is_distro_version_ge('fedora', 35):
filename = '/tmp/anaconda.log'
waitline = '.*software_selection: The selection has been checked.*'

if is_distro_version_ge('rhel', 10):
if is_distro_version_ge('rhel', 10) or is_distro_version_ge('fedora', 35):
waitline = '.*The software selection has been resolved.*'

if wait_for_line(filename, waitline, 600):
Expand Down
2 changes: 1 addition & 1 deletion anabot/runtime/installation/hub/partitioning/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def additional_space_manipulate2(element, app_node, local_node, dry_run):
"I would like to _make additional space available.",
context="GUI|Storage",
)
if is_distro_version_ge('rhel', 10):
if is_distro_version_ge('rhel', 10) or is_distro_version_ge('fedora', 35):
checkbox_text = tr(
"Free up space by re_moving or shrinking existing partitions",
context="GUI|Storage",
Expand Down

0 comments on commit 11f57ad

Please sign in to comment.