Skip to content

Commit

Permalink
Merge pull request #1981 from poncovka/master-disable_spokes
Browse files Browse the repository at this point in the history
Hide spokes with the Anaconda configuration file
  • Loading branch information
poncovka committed Jun 13, 2019
2 parents 1cf489a + 31910e2 commit e5fe6ec
Show file tree
Hide file tree
Showing 16 changed files with 186 additions and 564 deletions.
8 changes: 0 additions & 8 deletions anaconda.py
Expand Up @@ -594,14 +594,6 @@ def _earlyExceptionHandler(ty, value, traceback):
threadMgr.add(AnacondaThread(name=constants.THREAD_WAIT_FOR_CONNECTING_NM,
target=wait_for_connecting_NM_thread))

# initialize the screen access manager before launching the UI
from pyanaconda import screen_access
screen_access.initSAM()
# try to open any existing config file
# (might be created by pre-anaconda helper tools, injected during image
# generation, etc.)
screen_access.sam.open_config_file()

# now start the interface
display.setup_display(anaconda, opts)
if anaconda.gui_startup_failed:
Expand Down
3 changes: 3 additions & 0 deletions data/anaconda.conf
Expand Up @@ -140,6 +140,9 @@ default_help_pages =
# Is the partitioning with blivet-gui supported?
blivet_gui_supported = True

# A list of spokes to hide in UI.
# FIXME: Use other identification then names of the spokes.
hidden_spokes =

[License]
# A path to EULA (if any)
Expand Down
2 changes: 1 addition & 1 deletion data/liveinst/liveinst
Expand Up @@ -74,7 +74,7 @@ fi
if [ -f /etc/os-release ]; then
variantid=$( grep VARIANT_ID /etc/os-release | tail -1 | cut -d= -f2)
if [ "$variantid" = "workstation" ]; then
export ANACONDA_PRODUCTVARIANT="Workstation"
export ANACONDA_PRODUCTVARIANT="Workstation Live"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion data/product.d/fedora-silverblue.conf
Expand Up @@ -6,4 +6,4 @@ variant_name = Silverblue

[Base Product]
product_name = Fedora
variant_name = Workstation
variant_name = Workstation Live
15 changes: 15 additions & 0 deletions data/product.d/fedora-workstation-live.conf
@@ -0,0 +1,15 @@
# Anaconda configuration file for Fedora Workstation Live.

[Product]
product_name = Fedora
variant_name = Workstation Live

[Base Product]
product_name = Fedora
variant_name = Workstation

[User Interface]
hidden_spokes =
NetworkSpoke
PasswordSpoke
UserSpoke
5 changes: 0 additions & 5 deletions pyanaconda/core/configuration/system.py
Expand Up @@ -167,11 +167,6 @@ def provides_resolver_config(self):
"""Can we copy /etc/resolv.conf to the target system?"""
return self._is_boot_iso

@property
def provides_user_interaction_config(self):
"""Can we read /etc/sysconfig/anaconda?"""
return self._is_boot_iso or self._is_live_os

@property
def provides_web_browser(self):
"""Can we redirect users to web pages?"""
Expand Down
8 changes: 8 additions & 0 deletions pyanaconda/core/configuration/ui.py
Expand Up @@ -45,3 +45,11 @@ def default_help_pages(self):
def blivet_gui_supported(self):
"""Is the partitioning with blivet-gui supported?"""
return self._get_option("blivet_gui_supported", bool)

@property
def hidden_spokes(self):
"""A list of spokes to hide in UI.
:return: a list of strings
"""
return self._get_option("hidden_spokes", str).split()
18 changes: 0 additions & 18 deletions pyanaconda/installation.py
Expand Up @@ -40,7 +40,6 @@
from pyanaconda.core import util
from pyanaconda import timezone
from pyanaconda import network
from pyanaconda import screen_access
from pyanaconda.core.i18n import N_
from pyanaconda.threading import threadMgr
from pyanaconda.ui.lib.entropy import wait_for_entropy
Expand Down Expand Up @@ -113,11 +112,6 @@ def doConfiguration(storage, payload, ksdata):
task_proxy = SERVICES.get_proxy(dbus_task)
os_config.append(Task(task_proxy.Name, sync_run_task, (task_proxy,)))

# The user interaction config file needs to be synchronized with
# current state of the Services module.
os_config.append(Task("Synchronize user interaction config file state",
screen_access.sam.update_config_file_state))

os_config.append(Task("Configure keyboard", ksdata.keyboard.execute))
os_config.append(Task("Configure timezone", ksdata.timezone.execute))

Expand Down Expand Up @@ -212,18 +206,6 @@ def doConfiguration(storage, payload, ksdata):
# write anaconda related configs & kickstarts
write_configs.append(Task("Store kickstarts", _writeKS, (ksdata,)))

# Write out the user interaction config file.
#
# But make sure it's not written out in the image and directory installation mode,
# as that might result in spokes being inadvertently hidden when the actual installation
# starts from the generate image or directory contents.
if conf.target.is_image:
log.info("Not writing out user interaction config file due to image install mode.")
elif conf.target.is_directory:
log.info("Not writing out user interaction config file due to directory install mode.")
else:
write_configs.append(Task("Store user interaction config", screen_access.sam.write_out_config_file))

# only add write_configs to the main queue if we actually store some kickstarts/configs
if write_configs.task_count:
configuration_queue.append(write_configs)
Expand Down
61 changes: 58 additions & 3 deletions pyanaconda/modules/services/installation.py
Expand Up @@ -16,16 +16,20 @@
# Red Hat, Inc.
#
import os
from configparser import ConfigParser

from pyanaconda.core import util

from pyanaconda.core.configuration.anaconda import conf
from pyanaconda.modules.common.task import Task
from pyanaconda.modules.services.constants import SetupOnBootAction
from pyanaconda.startup_utils import get_anaconda_version_string

from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)

__all__ = ["ConfigureInitialSetupTask", "ConfigureServicesTask"]

__all__ = ["ConfigureInitialSetupTask", "ConfigurePostInstallationToolsTask",
"ConfigureServicesTask"]


class ConfigureInitialSetupTask(Task):
Expand All @@ -37,7 +41,7 @@ def __init__(self, sysroot, setup_on_boot):
"""Create a new Initial Setup configuration task.
:param str sysroot: a path to the root of the target system
:param enum setup_on_boot: setup-on-boot mode for Initial Setup
:param Enum setup_on_boot: setup-on-boot mode for Initial Setup
Modes are defined by the SetupOnBoot enum as distinct integers.
Expand Down Expand Up @@ -90,6 +94,57 @@ def run(self):
self._disable_service()


class ConfigurePostInstallationToolsTask(Task):
"""Installation task for configuration of post-installation tools."""

def __init__(self, sysroot, tools_enabled):
"""Create a new task.
:param str sysroot: a path to the root of the target system
:param bool tools_enabled: are the post-installation tools enabled?
"""
super().__init__()
self._sysroot = sysroot
self._tools_enabled = tools_enabled

@property
def name(self):
return "Configure post-installation tools"

def run(self):
"""Run the task. """
if conf.target.is_image:
log.info("Not writing out user interaction config file due to image install mode.")
elif conf.target.is_directory:
log.info("Not writing out user interaction config file due to directory install mode.")
else:
parser = self._get_config()
self._write_config(parser)

def _get_config(self):
"""Generate the user interaction configuration."""
parser = ConfigParser(delimiters=("=", ), comment_prefixes=("#", ))
parser.add_section("General")
parser["General"]["post_install_tools_disabled"] = "1" if not self._tools_enabled else "0"
return parser

def _write_config(self, parser):
"""Write the user interaction config file."""
path = os.path.join(self._sysroot, "etc/sysconfig/anaconda")
log.info("Writing out user interaction config at %s", path)

try:
with open(path, "wt") as f:
f.write(
"# This file has been generated by the Anaconda Installer "
"{}\n\n".format(get_anaconda_version_string())
)

parser.write(f)
except OSError:
log.exception("Can't write user interaction config file.")


class ConfigureServicesTask(Task):
"""Installation task for service configuration.
Expand Down
13 changes: 9 additions & 4 deletions pyanaconda/modules/services/services.py
Expand Up @@ -28,8 +28,7 @@
from pyanaconda.modules.services.kickstart import ServicesKickstartSpecification
from pyanaconda.modules.services.services_interface import ServicesInterface
from pyanaconda.modules.services.installation import ConfigureInitialSetupTask, \
ConfigureServicesTask

ConfigureServicesTask, ConfigurePostInstallationToolsTask

from pyanaconda.anaconda_loggers import get_module_logger
log = get_module_logger(__name__)
Expand Down Expand Up @@ -241,13 +240,19 @@ def install_with_tasks(self, sysroot):
:returns: list of object paths of installation tasks
"""
tasks = [
ConfigureInitialSetupTask(sysroot=sysroot, setup_on_boot=self.setup_on_boot),
ConfigureInitialSetupTask(
sysroot=sysroot,
setup_on_boot=self.setup_on_boot
),
ConfigurePostInstallationToolsTask(
sysroot=sysroot,
tools_enabled=self.post_install_tools_enabled
),
ConfigureServicesTask(
sysroot=sysroot,
disabled_services=self.disabled_services,
enabled_services=self.enabled_services
),

]

paths = [
Expand Down

0 comments on commit e5fe6ec

Please sign in to comment.