pyanaconda package¶
Subpackages¶
- pyanaconda.installclasses package
- pyanaconda.isys package
- pyanaconda.packaging package
- pyanaconda.ui package
- Subpackages
- pyanaconda.ui.categories package
- pyanaconda.ui.gui package
- Subpackages
- pyanaconda.ui.gui.hubs package
- pyanaconda.ui.gui.spokes package
- Subpackages
- pyanaconda.ui.gui.spokes.advstorage package
- pyanaconda.ui.gui.spokes.lib package
- Submodules
- pyanaconda.ui.gui.spokes.lib.accordion module
- pyanaconda.ui.gui.spokes.lib.cart module
- pyanaconda.ui.gui.spokes.lib.custom_storage_helpers module
- pyanaconda.ui.gui.spokes.lib.dasdfmt module
- pyanaconda.ui.gui.spokes.lib.detailederror module
- pyanaconda.ui.gui.spokes.lib.entropy_dialog module
- pyanaconda.ui.gui.spokes.lib.lang_locale_handler module
- pyanaconda.ui.gui.spokes.lib.passphrase module
- pyanaconda.ui.gui.spokes.lib.refresh module
- pyanaconda.ui.gui.spokes.lib.resize module
- pyanaconda.ui.gui.spokes.lib.summary module
- Module contents
- Submodules
- pyanaconda.ui.gui.spokes.custom module
- pyanaconda.ui.gui.spokes.datetime_spoke module
- pyanaconda.ui.gui.spokes.filter module
- pyanaconda.ui.gui.spokes.keyboard module
- pyanaconda.ui.gui.spokes.langsupport module
- pyanaconda.ui.gui.spokes.network module
- pyanaconda.ui.gui.spokes.password module
- pyanaconda.ui.gui.spokes.software module
- pyanaconda.ui.gui.spokes.source module
- pyanaconda.ui.gui.spokes.storage module
- pyanaconda.ui.gui.spokes.user module
- pyanaconda.ui.gui.spokes.welcome module
- Module contents
- Subpackages
- Submodules
- pyanaconda.ui.gui.helpers module
- pyanaconda.ui.gui.utils module
- pyanaconda.ui.gui.xkl_wrapper module
- Module contents
- Subpackages
- pyanaconda.ui.lib package
- pyanaconda.ui.tui package
- Subpackages
- pyanaconda.ui.tui.hubs package
- pyanaconda.ui.tui.simpleline package
- pyanaconda.ui.tui.spokes package
- Submodules
- pyanaconda.ui.tui.spokes.askvnc module
- pyanaconda.ui.tui.spokes.langsupport module
- pyanaconda.ui.tui.spokes.network module
- pyanaconda.ui.tui.spokes.password module
- pyanaconda.ui.tui.spokes.progress module
- pyanaconda.ui.tui.spokes.shell_spoke module
- pyanaconda.ui.tui.spokes.software module
- pyanaconda.ui.tui.spokes.source module
- pyanaconda.ui.tui.spokes.storage module
- pyanaconda.ui.tui.spokes.time_spoke module
- pyanaconda.ui.tui.spokes.user module
- pyanaconda.ui.tui.spokes.warnings_spoke module
- Module contents
- Submodules
- pyanaconda.ui.tui.tuiobject module
- Module contents
- Subpackages
- Submodules
- pyanaconda.ui.common module
- pyanaconda.ui.communication module
- pyanaconda.ui.helpers module
- Module contents
- Subpackages
Submodules¶
pyanaconda.addons module¶
- class pyanaconda.addons.AddonSection(*args, **kwargs)¶
Bases: pykickstart.sections.Section
- finalize()¶
Let addon know no additional data will come.
- handleHeader(lineno, args)¶
Process the arguments to the %addon header.
- handleLine(line)¶
- sectionOpen = '%addon'¶
- class pyanaconda.addons.AddonRegistry(dictionary)¶
Bases: builtins.object
This class represents the ksdata.addons object and maintains the ids and data structures for loaded addons.
It acts as a proxy during kickstart save.
- execute(storage, ksdata, instClass, users)¶
This method calls execute on all the registered addons.
- setup(storage, ksdata, instClass)¶
This method calls setup on all the registered addons.
- class pyanaconda.addons.AddonData(name)¶
Bases: builtins.object
This is a common parent class for loading and storing 3rd party data to kickstart. It is instantiated by kickstart parser and stored as ksdata.addons.<name> to be used in the user interfaces.
The mandatory method handle_line receives all lines from the corresponding addon section in kickstart and the mandatory __str__ implementation is responsible for returning the proper kickstart text (to be placed into the %addon section) back.
There is also a mandatory method execute, which should make all the described changes to the installed system.
- execute(storage, ksdata, instClass, users)¶
Make the changes to the underlying system.
This method is called only once in the post-install setup phase.
- finalize()¶
No additional data will come.
Addon should check if all mandatory attributes were populated.
- handle_header(lineno, args)¶
Process additional arguments to the %addon line.
This function receives any arguments on the %addon line after the addon ID. For example, for the line:
%addon com_example_foo –argument=’example’This function would be called with args=[“–argument=’example’”].
By default AddonData.handle_header just preserves the passed arguments by storing them and adding them to the __str__ output.
- handle_line(line)¶
Process one kickstart line.
- setup(storage, ksdata, instClass)¶
Make the changes to the install system.
This method is called before the installation is started and directly from spokes. It must be possible to call it multiple times without breaking the environment.
- pyanaconda.addons.collect_addon_paths(toplevel_addon_paths, ui_subdir='gui')¶
This method looks into the directories present in toplevel_addon_paths and registers each subdirectory as a new addon identified by that subdirectory name.
It then registers spokes, categories and data (ks) paths for the application to use. By default is looks for spokes and categories in <addon>/gui/ subdirectory but that can be changed using the ui_subdir argument.
pyanaconda.anaconda module¶
pyanaconda.anaconda_argparse module¶
- class pyanaconda.anaconda_argparse.AnacondaArgumentParser(*args, **kwargs)¶
Bases: argparse.ArgumentParser
Subclass of ArgumentParser that also examines boot arguments.
If the “bootarg_prefix” keyword argument is set, it’s assumed that all bootargs will start with that prefix.
- “require_prefix” is a bool:
- False: accept the argument with or without the prefix. True: ignore the argument without the prefix. (default)
- add_argument(*args, **kwargs)¶
Add a new option - like ArgumentParser.add_argument.
The long options will be added to the list of boot args, unless the keyword argument ‘bootarg’ is set to False.
Positional arguments that don’t start with ‘-‘ are considered extra boot args to look for.
NOTE: conflict_handler is currently ignored for boot args - they will always raise ArgumentError if they conflict.
- parse_args(args=None, boot_cmdline=None)¶
Like ArgumentParser.parse_args(), but also parses the boot cmdline. (see parse_boot_cmdline for details on that process.) Program cmdline arguments will override boot cmdline arguments.
Parameters: - args (string or None) – program command line arguments
- boot_cmdline (string, dict or None) – the Anaconda boot command line arguments
Returns: an argparse Namespace instance
Return type: Namespace
- parse_boot_cmdline(boot_cmdline)¶
Parse the boot cmdline and create an appropriate Namespace instance according to the option definitions set by add_argument.
boot_cmdline can be given as a string (to be parsed by BootArgs), or a dict (or any object with .items()) of {bootarg:value} pairs.
If boot_cmdline is None, the boot_cmdline data will be whatever BootArgs reads by default (/proc/cmdline, /run/initramfs/etc/cmdline, /etc/cmdline).
If an option requires a value but the boot arg doesn’t provide one, we’ll quietly not set anything in the Namespace. We also skip any boot options that were not specified by add_argument as we don’t care about them (there will usually be quite a lot of them (rd.*, etc.).
Parameters: boot_cmdline (string, dict or None) – the Anaconda boot command line arguments Returns: an argparse Namespace instance Return type: Namespace
- class pyanaconda.anaconda_argparse.HelpTextParser(path)¶
Bases: builtins.object
Class to parse help text from file and make it available to option parser.
Initializer :param path: The absolute path to the help text file
- help_text(option)¶
Returns the help text corresponding to the given command-line option. If no help text is available, returns the empty string.
Parameters: option (str) – The name of the option Return type: str
- read(lines)¶
Reads option, help text pairs from a text file.
Each pair is separated from the next by an empty line. The option comes first, followed by any number of lines of help text.
Parameters: lines – a sequence of lines of text
- pyanaconda.anaconda_argparse.get_help_width()¶
Try to detect the terminal window width size and use it to compute optimal help text width. If it can’t be detected a default values is returned.
Returns: optimal help text width in number of characters Return type: int
- pyanaconda.anaconda_argparse.name_path_pairs(image_specs)¶
Processes and verifies image file specifications. Generates pairs of names and paths.
Parameters: image_specs (list of str) – a list of image specifications Each image spec in image_specs has format <path>[:<name>] where <path> is the path to a local file and <name> is an optional name used to identify the disk in UI. <name> may not contain colons or slashes.
If no name given in specification, synthesizes name from basename of path. Since two distinct paths may have the same basename, handles name collisions by synthesizing a different name for the colliding name.
- Raises an exception if:
- A path is empty
- A path specifies a non-existant file
- A path specifies a directory
- Duplicate paths are specified
- A name contains a “/”
pyanaconda.anaconda_log module¶
- class pyanaconda.anaconda_log.AnacondaLog¶
Bases: builtins.object
- SYSLOG_CFGFILE = '/etc/rsyslog.conf'¶
- VIRTIO_PORT = '/dev/virtio-ports/org.fedoraproject.anaconda.log.0'¶
- addFileHandler(dest, addToLogger, minLevel=20, fmtStr='%(asctime)s, %(msecs)03d %(levelname)s %(name)s: %(message)s', autoLevel=False)¶
- forwardToSyslog(logr)¶
Forward everything that goes in the logger to the syslog daemon.
- restartSyslog()¶
- setupVirtio()¶
Setup virtio rsyslog logging.
- setup_remotelog(host, port)¶
- showwarning(message, category, filename, lineno, file=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>, line=None)¶
Make sure messages sent through python’s warnings module get logged.
The warnings mechanism is used by some libraries we use, notably pykickstart.
- updateRemote(remote_syslog)¶
Updates the location of remote rsyslogd to forward to.
Requires updating rsyslogd config and restarting rsyslog
- class pyanaconda.anaconda_log.AnacondaSocketHandler(host, port)¶
Bases: logging.handlers.SocketHandler
Initializes the handler with a specific host address and port.
When the attribute closeOnError is set to True - if a socket error occurs, the socket is silently closed and then reopened on the next logging call.
- makePickle(record)¶
- class pyanaconda.anaconda_log.AnacondaSyslogHandler(address=('localhost', 514), facility=1, tag='')¶
Bases: logging.handlers.SysLogHandler
- emit(record)¶
- levelMap = {'CRIT': 'critical', 'LOCK': 'debug', 'ERR': 'error'}¶
- mapPriority(level)¶
Map the priority level to a syslog level
- pyanaconda.anaconda_log.autoSetLevel(handler, value)¶
- pyanaconda.anaconda_log.init()¶
- pyanaconda.anaconda_log.setHandlersLevel(logr, level)¶
pyanaconda.bootloader module¶
- class pyanaconda.bootloader.Aarch64EFIGRUB¶
- class pyanaconda.bootloader.Arguments(iterable=None)¶
Bases: pyanaconda.orderedset.OrderedSet
- add(key)¶
- update(other)¶
- class pyanaconda.bootloader.BootLoader¶
Bases: builtins.object
- add_image(image)¶
Add a BootLoaderImage instance to the image list.
- boot_prefix¶
Prefix, if any, to paths in /boot.
- can_dual_boot = False¶
- can_update = False¶
- check()¶
Run additional bootloader checks
- clear_images()¶
Empty out the image list.
- config_file = None¶
- config_file_mode = 384¶
- default¶
The default image.
- device_description(device)¶
- device_descriptions¶
- disk_order¶
Potentially partial order for disks.
- disklabel_types¶
- encryption_support = False¶
- global_preserve_args = ['speakup_synth', 'apic', 'noapic', 'apm', 'ide', 'noht', 'acpi', 'video', 'pci', 'nodmraid', 'nompath', 'nomodeset', 'noiswmd', 'fips', 'selinux', 'biosdevname', 'ipv6.disable', 'net.ifnames']¶
- has_windows(devices)¶
- image_label(image)¶
Return the appropriate image label for this bootloader.
- image_label_attr = 'label'¶
- images¶
List of OS images that will be included in the configuration.
- install(args=None)¶
- is_valid_stage1_device(device, early=False)¶
Return True if the device is a valid stage1 target device.
Also collect lists of errors and warnings.
The criteria for being a valid stage1 target device vary from platform to platform. On some platforms a disk with an msdos disklabel is a valid stage1 target, while some platforms require a special device. Some examples of these special devices are EFI system partitions on EFI machines, PReP boot partitions on iSeries, and Apple bootstrap partitions on Mac.
The ‘early’ keyword argument is a boolean flag indicating whether or not this check is being performed at a point where the mountpoint cannot be expected to be set for things like EFI system partitions.
- is_valid_stage2_device(device, linux=True, non_linux=False)¶
Return True if the device is suitable as a stage2 target device.
Also collect lists of errors and warnings.
- name = 'Generic Bootloader'¶
- packages = []¶
- preserve_args = []¶
- reset()¶
Reset stage1 and stage2 values
- set_boot_args(*args, **kwargs)¶
Set up the boot command line.
Keyword Arguments:
storage - a blivet.Storage instanceAll other arguments are expected to have a dracutSetupArgs() method.
- set_disk_list(disks)¶
- set_preferred_stage1_type(preferred)¶
Set a preferred type of stage1 device.
- set_stage1_device(devices)¶
- stage2_bootable = False¶
- stage2_description = '/boot file system'¶
- stage2_device = None¶
- stage2_device_types = []¶
- stage2_format_types¶
- stage2_is_valid_stage1 = False¶
- stage2_max_end = Size('2 TiB')¶
- stage2_mountpoints = ['/boot', '/']¶
- stage2_must_be_primary = True¶
- stage2_raid_levels = []¶
- stage2_raid_member_types = []¶
- stage2_raid_metadata = []¶
- timeout¶
Bootloader timeout in seconds.
- trusted_boot¶
- update()¶
Update an existing bootloader configuration.
- update_only¶
- write()¶
Write the bootloader configuration and install the bootloader.
- write_config()¶
Write the bootloader configuration.
- write_config_console(config)¶
Write console-related configuration lines.
- write_config_header(config)¶
Write global configuration lines.
- write_config_images(config)¶
Write image configuration entries.
- write_config_password(config)¶
Write password-related configuration lines.
- write_config_post()¶
- exception pyanaconda.bootloader.BootLoaderError¶
Bases: builtins.Exception
- class pyanaconda.bootloader.BootLoaderImage(device=None, label=None, short=None)¶
Bases: builtins.object
Base class for bootloader images. Suitable for non-linux OS images.
- class pyanaconda.bootloader.EFIGRUB¶
Bases: pyanaconda.bootloader.GRUB2
- add_efi_boot_target()¶
- can_dual_boot = False¶
- check()¶
- efi_dir_as_efifs_dir¶
- efibootmgr(*args, **kwargs)¶
- install(args=None)¶
- packages = ['grub2-efi', 'efibootmgr', 'shim']¶
- remove_efi_boot_target()¶
- stage2_bootable = False¶
- stage2_is_valid_stage1 = False¶
- update()¶
- write()¶
Write the bootloader configuration and install the bootloader.
- class pyanaconda.bootloader.EXTLINUX¶
Bases: pyanaconda.bootloader.BootLoader
- boot_prefix¶
Prefix, if any, to paths in /boot.
- config_file¶
- install(args=None)¶
- name = 'EXTLINUX'¶
- packages = ['syslinux-extlinux']¶
- stage1_device_types = ['disk']¶
- stage2_bootable = True¶
- stage2_device_types = ['partition']¶
- stage2_format_types = ['ext4', 'ext3', 'ext2']¶
- write_config()¶
- write_config_console(config)¶
- write_config_header(config)¶
- write_config_images(config)¶
- write_config_password(config)¶
- write_config_post()¶
- class pyanaconda.bootloader.GRUB¶
Bases: pyanaconda.bootloader.BootLoader
- can_dual_boot = True¶
- can_update = True¶
- config_dir¶
Full path to configuration directory.
- config_file¶
Full path to configuration file.
- device_map_file¶
Full path to device.map file.
- grub_conf_device_line¶
- grub_config_dir¶
Config dir, adjusted for grub’s view of the world.
- grub_device_name(device)¶
Return a grub-friendly representation of device.
- has_serial_console¶
true if the console is a serial console.
- has_windows(devices)¶
Potential boot devices containing non-linux operating systems.
- install(args=None)¶
- install_targets¶
List of (stage1, stage2) tuples representing install targets.
- is_valid_stage2_device(device, linux=True, non_linux=False)¶
- name = 'GRUB'¶
- packages = ['grub']¶
- serial_command¶
- splash_dir¶
relative path to splash image directory.
- stage2_bootable = True¶
- stage2_device_types = ['partition', 'mdarray']¶
- stage2_is_valid_stage1 = True¶
- stage2_must_be_primary = False¶
- stage2_raid_levels = [<blivet.devicelibs.raid.RAID1 object at 0x7feabb86bfd0>]¶
- stage2_raid_member_types = ['partition']¶
- stage2_raid_metadata = ['0', '0.90', '1.0']¶
- update()¶
- write_config()¶
Write bootloader configuration to disk.
- write_config_console(config)¶
Write console-related configuration.
- write_config_header(config)¶
Write global configuration information.
- write_config_images(config)¶
Write image entries into configuration file.
- write_config_password(config)¶
Write password-related configuration.
- write_config_post()¶
Perform additional configuration after writing config file(s).
- write_device_map()¶
Write out a device map containing all supported devices.
- class pyanaconda.bootloader.GRUB2¶
Bases: pyanaconda.bootloader.GRUB
GRUBv2
- configuration
- password (insecure), password_pbkdf2
–users per-entry specifies which users can access, otherwise entry is unrestricted
/etc/grub/custom.cfg
how does grub resolve names of md arrays?
- disable automatic use of grub-mkconfig?
- on upgrades?
- BIOS boot partition (GPT)
- parted /dev/sda set <partition_number> bios_grub on
- can’t contain a file system
- 31KiB min, 1MiB recommended
- check()¶
When installing to the mbr of a disk grub2 needs enough space before the first partition in order to embed its core.img
Until we have a way to ask grub2 what the size is we check to make sure it starts >= 512K, otherwise return an error.
- defaults_file = '/etc/default/grub'¶
- grub_device_name(device)¶
Return a grub-friendly representation of device.
Disks and partitions use the (hdX,Y) notation, while lvm and md devices just use their names.
- install(args=None)¶
- name = 'GRUB2'¶
- packages = ['grub2']¶
- stage2_device_types = ['partition', 'mdarray', 'lvmlv']¶
- stage2_format_types¶
- stage2_max_end = None¶
- stage2_raid_levels = [<blivet.devicelibs.raid.RAID0 object at 0x7feabb86be10>, <blivet.devicelibs.raid.RAID1 object at 0x7feabb86bfd0>, <blivet.devicelibs.raid.RAID4 object at 0x7feabb8871d0>, <blivet.devicelibs.raid.RAID5 object at 0x7feabb887390>, <blivet.devicelibs.raid.RAID6 object at 0x7feabb887550>, <blivet.devicelibs.raid.RAID10 object at 0x7feabb887710>]¶
- stage2_raid_metadata = ['0', '0.90', '1.0', '1.2']¶
- terminal_type = 'console'¶
- write()¶
Write the bootloader configuration and install the bootloader.
- write_config()¶
- write_config_console(config)¶
- write_defaults()¶
- write_device_map()¶
Write out a device map containing all supported devices.
- write_password_config()¶
- class pyanaconda.bootloader.IPSeriesGRUB2¶
Bases: pyanaconda.bootloader.GRUB2
- install(args=None)¶
- stage2_bootable = False¶
- terminal_type = 'ofconsole'¶
- updateNVRAMBootList()¶
- write_defaults()¶
- class pyanaconda.bootloader.IPSeriesYaboot¶
Bases: pyanaconda.bootloader.Yaboot
- install(args=None)¶
- prog = 'mkofboot'¶
- updatePowerPCBootList()¶
- write_config_variant_header(config)¶
- class pyanaconda.bootloader.LinuxBootLoaderImage(device=None, label=None, short=None, version=None)¶
Bases: pyanaconda.bootloader.BootLoaderImage
- initrd¶
- kernel¶
- class pyanaconda.bootloader.MacEFIGRUB¶
Bases: pyanaconda.bootloader.EFIGRUB
- install(args=None)¶
- is_valid_stage1_device(device, early=False)¶
- mactel_config()¶
- class pyanaconda.bootloader.MacYaboot¶
Bases: pyanaconda.bootloader.Yaboot
- can_dual_boot = True¶
- prog = 'mkofboot'¶
- write_config_variant_header(config)¶
- class pyanaconda.bootloader.TbootLinuxBootLoaderImage(device=None, label=None, short=None, version=None)¶
Bases: pyanaconda.bootloader.LinuxBootLoaderImage
- args¶
- mbargs¶
- multiboot¶
- class pyanaconda.bootloader.Yaboot¶
Bases: pyanaconda.bootloader.YabootBase
- config_dir¶
- config_file¶
- image_label_attr = 'short_label'¶
- install(args=None)¶
- name = 'Yaboot'¶
- packages = ['yaboot']¶
- prog = 'ybin'¶
- stage2_device_raid_levels = [<blivet.devicelibs.raid.RAID1 object at 0x7feabb86bfd0>]¶
- stage2_device_types = ['partition', 'mdarray']¶
- write_config()¶
- write_config_header(config)¶
- write_config_post()¶
- write_config_variant_header(config)¶
- class pyanaconda.bootloader.YabootBase¶
Bases: pyanaconda.bootloader.BootLoader
- write_config_images(config)¶
- write_config_password(config)¶
- class pyanaconda.bootloader.ZIPL¶
Bases: pyanaconda.bootloader.BootLoader
- boot_dir¶
- config_file = '/etc/zipl.conf'¶
- image_label_attr = 'short_label'¶
- install(args=None)¶
- name = 'ZIPL'¶
- packages = ['s390utils-base']¶
- preserve_args = ['cio_ignore', 'rd.znet', 'rd_ZNET']¶
- stage2_device_types = ['partition']¶
- stage2_format_types¶
- write_config_header(config)¶
- write_config_images(config)¶
- pyanaconda.bootloader.get_boot_block(device, seek_blocks=0)¶
- pyanaconda.bootloader.get_bootloader()¶
- pyanaconda.bootloader.has_windows_boot_block(device)¶
- pyanaconda.bootloader.is_windows_boot_block(block)¶
- pyanaconda.bootloader.parse_serial_opt(arg)¶
Parse and split serial console options.
- Documentation/kernel-parameters.txt says:
- ttyS<n>[,options]
- Use the specified serial port. The options are of the form “bbbbpnf”, where “bbbb” is the baud rate, “p” is parity (“n”, “o”, or “e”), “n” is number of bits, and “f” is flow control (“r” for RTS or omit it). Default is “9600n8”.
but note that everything after the baud rate is optional, so these are all valid: 9600, 19200n, 38400n8, 9600e7r. Also note that the kernel assumes 1 stop bit; this can’t be changed.
- class pyanaconda.bootloader.serial_opts¶
Bases: builtins.object
- pyanaconda.bootloader.writeBootLoader(storage, payload, instClass, ksdata)¶
Write bootloader configuration to disk.
When we get here, the bootloader will already have a default linux image. We only have to add images for the non-default kernels and adjust the default to reflect whatever the default variant is.
- pyanaconda.bootloader.writeBootLoaderFinal(storage, payload, instClass, ksdata)¶
Do the final write of the bootloader.
- pyanaconda.bootloader.writeSysconfigKernel(storage, version, instClass)¶
pyanaconda.constants module¶
pyanaconda.constants_text module¶
- class pyanaconda.constants_text.Translator(button, check)¶
Bases: builtins.object
A simple class to facilitate on-the-fly translation for newt buttons
pyanaconda.desktop module¶
pyanaconda.errors module¶
- exception pyanaconda.errors.InvalidImageSizeError(message, filename)¶
Bases: builtins.Exception
- exception pyanaconda.errors.MissingImageError¶
Bases: builtins.Exception
- exception pyanaconda.errors.MediaUnmountError(device)¶
Bases: builtins.Exception
- exception pyanaconda.errors.MediaMountError(device)¶
Bases: builtins.Exception
- exception pyanaconda.errors.ScriptError(lineno, details)¶
Bases: builtins.Exception
- exception pyanaconda.errors.CmdlineError¶
Bases: builtins.Exception
pyanaconda.exception module¶
- class pyanaconda.exception.AnacondaExceptionHandler(confObj, intfClass, exnClass, tty_num, gui_lock, interactive)¶
Bases: meh.handler.ExceptionHandler
See: python-meh’s ExceptionHandler Parameters: tty_num – the number of tty the interface is running on - handleException(dump_info)¶
Our own handleException method doing some additional stuff before calling the original python-meh’s one.
See: python-meh’s ExceptionHandler.handleException
- postWriteHook(dump_info)¶
- runDebug(exc_info)¶
- pyanaconda.exception.initExceptionHandling(anaconda)¶
- pyanaconda.exception.journalctl_callback()¶
Callback to get logs from journalctl.
- pyanaconda.exception.list_addons_callback()¶
Callback to get info about the addons potentially affecting Anaconda’s behaviour.
- pyanaconda.exception.lsblk_callback()¶
Callback to get info about block devices.
- pyanaconda.exception.nmcli_dev_list_callback()¶
Callback to get info about network devices.
- pyanaconda.exception.test_exception_handling()¶
Function that can be used for testing exception handling in anaconda. It tries to prepare a worst case scenario designed from bugs seen so far.
pyanaconda.flags module¶
- class pyanaconda.flags.BootArgs(cmdline=None, files=None)¶
Bases: collections.OrderedDict
Hold boot arguments as an OrderedDict.
Create a BootArgs object. Reads each of the “files”, then parses “cmdline” if it was provided.
- getbool(arg, default=False)¶
Return the value of the given arg, as a boolean. The rules are: - “arg”, “arg=val”: True - “noarg”, “noarg=val”, “arg=[0|off|no]”: False
- read(filenames)¶
Read and parse a filename (or a list of filenames). Files that can’t be read are silently ignored. Returns a list of successfully read files. filenames can contain *, ?, and character ranges expressed with []
- readstr(cmdline)¶
- class pyanaconda.flags.Flags(read_cmdline=True)¶
Bases: builtins.object
- get(attr, val=None)¶
- read_cmdline()¶
- set_cmdline_bool(flag)¶
- pyanaconda.flags.can_touch_runtime_system(msg, touch_live=False)¶
Guard that should be used before doing actions that modify runtime system.
Parameters: Return type: bool
- pyanaconda.flags.eintr_retry_call(func, *args, **kwargs)¶
Retry an interruptible system call if interrupted.
pyanaconda.geoloc module¶
A GeoIP and WiFi location module - location detection based on IP address
How to use the geolocation module
First call init_geolocation() - this creates the LocationInfo singleton and you can also use it to set what geolocation provider should be used. To actually look up current position, call refresh() - this will trigger the actual online geolocation query, which runs in a thread. After the look-up thread finishes, the results are stored in the singleton and can be retrieved using the get_territory_code() and get_result() methods. If you call these methods without calling refresh() first or if the look-up is currently in progress, both return None.
Geolocation backends
This module currently supports three geolocation backends: * Fedora GeoIP API * Hostip GeoIP * Google WiFi
Fedora GeoIP backend This is the default backend. It queries the Fedora GeoIP API for location data based on current public IP address. The reply is JSON formated and contains the following fields: postal_code, latitude, longitude, region, city, country_code, country_name, time_zone, country_code3, area_code, metro_code, region_name and dma_code Anaconda currently uses just time_zone and country_code.
Hostip backend A GeoIP look-up backend that can be used to determine current country code from current public IP address. The public IP address is determined automatically when calling the API. GeoIP results from Hostip contain the current public IP and an approximate address. To get this detail location info, use the get_result() method to get an instance of the LocationResult class, used to wrap the result.
Google WiFi backend This backend is probably the most accurate one, at least as long as the computer has a working WiFi hardware and there are some WiFi APs nearby. It sends data about nearby APs (ssid, MAC address & signal strength) acquired from Network Manager to a Google API to get approximate geographic coordinates. If there are enough AP nearby (such as in a normal city) it can be very accurate, even up to currently determining which building is the computer currently in. But this only returns current geographic coordinates, to get country code the Nominatim reverse-geocoding API is called to convert the coordinates to an address, which includes a country code. While having many advantages, this backend also has some severe disadvantages: * needs working WiFi hardware * tells your public IP address & possibly quite precise geographic coordinates
to two external entities (Google and Nominatim)
This could have severe privacy issues and should be carefully considered before enabling it to be used by default. * the Google WiFi geolocation API seems to lack official documentation As a result its long-term stability might not be guarantied.
Possible issues with GeoIP
“I’m in Switzerland connected to corporate VPN and anaconda tells me I’m in Netherlands.” The public IP address is not directly mapped to the physical location of a computer. So while your world visible IP address is registered to an IP block assigned to an ISP in Netherlands, it is just the external address of the Internet gateway of your corporate network. As VPNs and proxies can connect two computers anywhere on Earth, this issue is unfortunately probably unsolvable.
Backends that could possibly be used in the future * GPS geolocation + doesn’t leak your coordinates to a third party (not entirely true for assisted GPS) - unassisted cold GPS startup can take tens of minutes to acquire a GPS fix + assisted GPS startup (as used in most smartphones) can acquire a fix in a couple seconds * cell tower geolocation
- class pyanaconda.geoloc.Coordinates(lat=None, lon=None)¶
Bases: builtins.object
A set of geographic coordinates.
Parameters: - latitude¶
- longitude¶
- class pyanaconda.geoloc.FedoraGeoIPProvider¶
Bases: pyanaconda.geoloc.GeolocationBackend
The Fedora GeoIP service provider
- API_URL = 'https://geoip.fedoraproject.org/city'¶
- get_name()¶
- class pyanaconda.geoloc.Geocoder(geocoder='geocoder_nominatim')¶
Bases: builtins.object
Provides online geocoding services (only reverse geocoding at the moment).
Parameters: geocoder – a constant selecting what geocoder to use - NOMINATIM_API_URL = 'http://open.mapquestapi.com/nominatim/v1/reverse.php?format=json'¶
- reverse_geocode_coords(coordinates)¶
Turn geographic coordinates to address
Parameters: coordinates (Coordinates) – Coordinates (geographic coordinates) Returns: GeocodingResult if the lookup succeeds or None if it fails
- class pyanaconda.geoloc.GeocodingResult(coordinates=None, territory_code=None, address=None)¶
Bases: builtins.object
A result from geocoding lookup
Parameters: - address¶
- coordinates¶
- territory_code¶
- class pyanaconda.geoloc.GeolocationBackend¶
Bases: builtins.object
Base class for GeoIP backends.
- get_name()¶
Get name of the backend
Returns: name of the backend Return type: string
- get_result()¶
Get current location
Returns: geolocation lookup result Return type: LocationResult
- exception pyanaconda.geoloc.GeolocationError¶
Bases: builtins.Exception
Exception class for geolocation related errors
- class pyanaconda.geoloc.GoogleWiFiLocationProvider¶
Bases: pyanaconda.geoloc.GeolocationBackend
The Google WiFi location service provider
- API_URL = 'https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true'¶
- get_name()¶
- class pyanaconda.geoloc.HostipGeoIPProvider¶
Bases: pyanaconda.geoloc.GeolocationBackend
The Hostip GeoIP service provider
- API_URL = 'http://api.hostip.info/get_json.php'¶
- get_name()¶
- class pyanaconda.geoloc.LocationInfo(provider_id='provider_fedora_geoip', refresh_now=False)¶
Bases: builtins.object
Determines current location based on IP address or nearby WiFi access points (depending on what backend is used)
Parameters: - provider_id – GeoIP provider id specified by module constant
- refresh_now – if a GeoIP information refresh should be done
once the class is initialized :type refresh_now: bool
- get_public_ip_address()¶
A convenience function for getting current public IP
Returns: current public IP or None if no results are available Return type: string or None
- get_result()¶
Get result from the provider
Returns: the result object or return None if no results are available Return type: LocationResult or None
- get_territory_code()¶
A convenience function for getting the current territory code
Returns: territory code or None if no results are available Return type: string or None
- get_timezone()¶
A convenience function for getting the current time zone
Returns: time zone or None if no results are available Return type: string or None
- refresh()¶
Refresh location info
- class pyanaconda.geoloc.LocationResult(territory_code=None, timezone=None, timezone_source='unknown', public_ip_address=None, city=None)¶
Bases: builtins.object
Encapsulates the result from GeoIP lookup.
Parameters: - city¶
- public_ip_address¶
- territory_code¶
- timezone¶
- class pyanaconda.geoloc.WiFiAccessPoint(bssid, ssid=None, rssi=None)¶
Bases: builtins.object
Encapsulates information about WiFi access point
Parameters: - bssid – MAC address of the access point
- ssid – name of the access point
- rssi – signal strength
- bssid¶
- rssi¶
- ssid¶
- class pyanaconda.geoloc.WifiScanner(scan_now=True)¶
Bases: builtins.object
Uses the Network Manager DBUS API to provide information about nearby WiFi access points
Parameters: scan_now (bool) – if an initial scan should be done - NETWORK_MANAGER_DEVICE_TYPE_WIFI = 2¶
- get_results()¶
Returns: a list of WiFiAccessPoint objects or an empty list if no APs were found or the scan failed
- scan()¶
Scan for WiFi access points
- pyanaconda.geoloc.get_provider_id_from_option(option_string)¶
Get a valid provider id from a string This function is used to parse command line arguments/boot options for the geolocation module.
Parameters: option_string (string) – option specifying the provider Returns: provider id
- pyanaconda.geoloc.get_result(wait=False)¶
Returns the current geolocation result wrapper or None, if: - no results were found - the refresh is still in progress - the geolocation module was not activated (init & refresh were not called)
- this is for example the case during image and directory installs
Parameters: wait – wait for lookup in progress to finish False - don’t wait True - wait for default period number - wait for up to number seconds :type wait: bool or number :return: LocationResult instance or None if location is unknown :rtype: LocationResult or None
- pyanaconda.geoloc.get_territory_code(wait=False)¶
This function returns the current country code or None, if: - no results were found - the lookup is still in progress - the geolocation module was not activated (init & refresh were not called)
- this is for example the case during image and directory installs
Parameters: wait – wait for lookup in progress to finish False - don’t wait True - wait for default period number - wait for up to number seconds :type wait: bool or number :return: current country code or None if not known :rtype: string or None
- pyanaconda.geoloc.get_timezone(wait=False)¶
This function returns the current time zone or None, if: - no timezone was found - the lookup is still in progress - the geolocation module was not activated (init & refresh were not called)
- this is for example the case during image and directory installs
Parameters: wait – wait for lookup in progress to finish False - don’t wait True - wait for default period number - wait for up to number seconds :type wait: bool or number :return: current timezone or None if not known :rtype: string or None
- pyanaconda.geoloc.init_geolocation(provider_id='provider_fedora_geoip')¶
Prepare the geolocation module for handling geolocation queries. This method sets-up the GeoLocation instance with the given geolocation_provider (or using the default one if no provider is given. Please note that calling this method doesn’t actually execute any queries by itself, you need to call refresh() to do that.
Parameters: provider_id – specifies what geolocation backend to use
- pyanaconda.geoloc.refresh()¶
Refresh information about current location using the currently specified geolocation provider.
pyanaconda.i18n module¶
- pyanaconda.i18n.N_(x)¶
- pyanaconda.i18n.P_(x, y, z)¶
- pyanaconda.i18n.C_(msgctxt, msgid)¶
- pyanaconda.i18n.CN_(c, x)¶
- pyanaconda.i18n.CP_(msgctxt, msgid, msgid_plural, n)¶
pyanaconda.ihelp module¶
Anaconda built-in help module
- pyanaconda.ihelp.get_help_path(help_file, instclass)¶
Return the full path for the given help file name, if the help file path does not exist a fallback path is returned. There are actually two possible fallback paths that might be returned: * first we try to return path to the main page of the installation guide
(if it exists)- if we can’t find the main page of the installation page, path to a “no help found” placeholder bundled with Anaconda is returned
Regarding help l10n, we try to respect the current locale as defined by the “LANG” environmental variable, but fallback to English if localized content is not available.
Parameters: - help_file (str or NoneType) – help file name
- instclass – current install class instance
Return str: full path to the help file requested or to a placeholder
- pyanaconda.ihelp.kill_yelp()¶
Try to kill any existing yelp processes
- pyanaconda.ihelp.start_yelp(help_path)¶
Start a new yelp process and make sure to kill any existing ones
Parameters: help_path (str or NoneType) – path to the help file yelp should load
pyanaconda.image module¶
- pyanaconda.image.findFirstIsoImage(path)¶
Find the first iso image in path This also supports specifying a specific .iso image
Returns the basename of the image
- pyanaconda.image.getMediaId(path)¶
- pyanaconda.image.mountImage(isodir, tree)¶
- pyanaconda.image.mountImageDirectory(method, storage)¶
- pyanaconda.image.opticalInstallMedia(devicetree)¶
- pyanaconda.image.potentialHdisoSources(devicetree)¶
- pyanaconda.image.umountImage(tree)¶
- pyanaconda.image.verifyMedia(tree, timestamp=None)¶
pyanaconda.install module¶
- pyanaconda.install.doConfiguration(storage, payload, ksdata, instClass)¶
- pyanaconda.install.doInstall(storage, payload, ksdata, instClass)¶
Perform an installation. This method takes the ksdata as prepared by the UI (the first hub, in graphical mode) and applies it to the disk. The two main tasks for this are putting filesystems onto disks and installing packages onto those filesystems.
pyanaconda.installclass module¶
- class pyanaconda.installclass.BaseInstallClass¶
Bases: builtins.object
- bootloaderExtraArgs = []¶
- bootloaderTimeoutDefault = None¶
- configure(anaconda)¶
- defaultFS = None¶
- defaultPackageEnvironment = None¶
- getBackend()¶
- help_folder = '/usr/share/anaconda/help'¶
- help_main_page = 'Installation_Guide.xml'¶
- help_placeholder = None¶
- help_placeholder_with_links = None¶
- ignoredPackages = []¶
- installUpdates = True¶
- l10n_domain¶
- name = 'base'¶
- setDefaultPartitioning(storage)¶
- setNetworkOnbootDefault(ksdata)¶
- setPackageSelection(anaconda)¶
- stylesheet = None¶
- class pyanaconda.installclass.DefaultInstall¶
Bases: fedora.FedoraBaseInstallClass
- pyanaconda.installclass.availableClasses(showHidden=False)¶
- pyanaconda.installclass.getBaseInstallClass()¶
pyanaconda.installinterfacebase module¶
- class pyanaconda.installinterfacebase.InstallInterfaceBase¶
Bases: builtins.object
- detailedMessageWindow(title, text, longText=None, ty='ok', default=None, custom_icon=None, custom_buttons=None, expanded=False)¶
- messageWindow(title, text, ty='ok', default=None, custom_buttons=None, custom_icon=None)¶
pyanaconda.iutil module¶
- class pyanaconda.iutil.DataHolder(**kwargs)¶
Bases: builtins.dict
A dict that lets you also access keys using dot notation.
kwargs are set as keys for the dict.
- copy()¶
- exception pyanaconda.iutil.ExitError¶
Bases: builtins.RuntimeError
- class pyanaconda.iutil.ProxyString(url=None, protocol='http://', host=None, port='3128', username=None, password=None)¶
Bases: builtins.object
Handle a proxy url
Initialize with either url ([protocol://][username[:password]@]host[:port]) or pass host and optionally:
protocol http, https, ftp host hostname without protocol port port number (defaults to 3128) username username password password
The str() of the object is the full proxy url
ProxyString.url is the full url including username:password@ ProxyString.noauth_url is the url without username:password@
- dict¶
return a dict of all the elements of the proxy string url, noauth_url, protocol, host, port, username, password
- parse_components()¶
Parse the components of a proxy url into url and noauth_url
- parse_url()¶
Parse the proxy url into its component pieces
- exception pyanaconda.iutil.ProxyStringError¶
Bases: builtins.Exception
- pyanaconda.iutil.add_po_path(directory)¶
Looks to see what translations are under a given path and tells the gettext module to use that path as the base dir
- pyanaconda.iutil.augmentEnv()¶
- pyanaconda.iutil.chown_dir_tree(root, uid, gid, from_uid_only=None, from_gid_only=None)¶
Change owner (uid and gid) of the files and directories under the given directory tree (recursively).
Parameters: - root (str) – root of the directory tree that should be chown’ed
- uid (int) – UID that should be set as the owner
- gid (int) – GID that should be set as the owner
- from_uid_only (int or None) – if given, the owner is changed only for the files and directories owned by that UID
- from_gid_only (int or None) – if given, the owner is changed only for the files and directories owned by that GID
- pyanaconda.iutil.cmp_obj_attrs(obj1, obj2, attr_list)¶
Compare attributes of 2 objects for changes
Missing attrs are considered a mismatch
Parameters: - obj1 (Any object) – First object to compare
- obj2 (Any object) – Second object to compare
- attr_list (list or tuple of strings) – List of attributes to compare
Returns: True if the attrs all match
Return type: bool
- pyanaconda.iutil.dir_tree_map(root, func, files=True, dirs=True)¶
Apply the given function to all files and directories in the directory tree under the given root directory.
Parameters: TODO: allow using globs and thus more trees?
- pyanaconda.iutil.dracut_eject(device)¶
Use dracut shutdown hook to eject media after the system is shutdown. This is needed because we are running from the squashfs.img on the media so ejecting too early will crash the installer.
- pyanaconda.iutil.eintr_ignore(func, *args, **kwargs)¶
Call a function and ignore EINTR.
This is useful for calls to close() and dup2(), which can return EINTR but which should not be retried, since by the time they return the file descriptor is already closed.
- pyanaconda.iutil.eintr_retry_call(func, *args, **kwargs)¶
Retry an interruptible system call if interrupted.
- pyanaconda.iutil.ensure_str(str_or_bytes, keep_none=True)¶
Returns a str instance for given string or None if requested to keep it.
Parameters: - str_or_bytes (str or bytes) – string to be kept or converted to str type
- keep_none (bool) – whether to keep None as it is or raise ValueError if None is passed
Raises ValueError: if applied on an object not being of type bytes nor str (nor NoneType if :param:`keep_none` is False)
- pyanaconda.iutil.execConsole()¶
- pyanaconda.iutil.execInSysroot(command, argv, stdin=None)¶
Run an external program in the target root. :param command: The command to run :param argv: The argument list :param stdin: The file object to read stdin from. :return: The return code of the command
- pyanaconda.iutil.execReadlines(command, argv, stdin=None, root='/', env_prune=None, filter_stderr=False)¶
Execute an external command and return the line output of the command in real-time.
This method assumes that there is a reasonably low delay between the end of output and the process exiting. If the child process closes stdout and then keeps on truckin’ there will be problems.
- NOTE/WARNING: UnicodeDecodeError will be raised if the output of the
- external command can’t be decoded as UTF-8.
Parameters: - command – The command to run
- argv – The argument list
- stdin – The file object to read stdin from.
- stdout – Optional file object to redirect stdout and stderr to.
- root – The directory to chroot to before running command.
- env_prune – environment variable to remove before execution
- filter_stderr – Whether stderr should be excluded from the returned output
Output from the file is not logged to program.log This returns an iterator with the lines from the command until it has finished
- pyanaconda.iutil.execWithCapture(command, argv, stdin=None, root='/', log_output=True, filter_stderr=False)¶
Run an external program and capture standard out and err. :param command: The command to run :param argv: The argument list :param stdin: The file object to read stdin from. :param root: The directory to chroot to before running command. :param log_output: Whether to log the output of command :param filter_stderr: Whether stderr should be excluded from the returned output :return: The output of the command
- pyanaconda.iutil.execWithCaptureBinary(command, argv, stdin=None, root='/', log_output=False, filter_stderr=False)¶
Run an external program and capture standard out and err as binary data. The binary data output is not logged by default but logging can be enabled. :param command: The command to run :param argv: The argument list :param stdin: The file object to read stdin from. :param root: The directory to chroot to before running command. :param log_output: Whether to log the binary output of the command :param filter_stderr: Whether stderr should be excluded from the returned output :return: The output of the command
- pyanaconda.iutil.execWithRedirect(command, argv, stdin=None, stdout=None, root='/', env_prune=None, log_output=True, binary_output=False)¶
Run an external program and redirect the output to a file. :param command: The command to run :param argv: The argument list :param stdin: The file object to read stdin from. :param stdout: Optional file object to redirect stdout and stderr to. :param root: The directory to chroot to before running command. :param env_prune: environment variable to remove before execution :param log_output: whether to log the output of command :param binary_output: whether to treat the output of command as binary data :return: The return code of the command
- pyanaconda.iutil.getDirSize(directory)¶
Get the size of a directory and all its subdirectories. :param dir: The name of the directory to find the size of. :return: The size of the directory in kilobytes.
- pyanaconda.iutil.getSysroot()¶
Returns the path to the target OS installation.
For ordinary package-based installations, this is the same as the target root.
- pyanaconda.iutil.getTargetPhysicalRoot()¶
Returns the path to the “physical” storage root, traditionally /mnt/sysimage.
This may be distinct from the sysroot, which could be a chroot-type subdirectory of the physical root. This is used for example by all OSTree-based installations.
- pyanaconda.iutil.get_active_console(dev='console')¶
Find the active console device.
Some tty devices (/dev/console, /dev/tty0) aren’t actual devices; they just redirect input and output to the real console device(s).
These ‘fake’ ttys have an ‘active’ sysfs attribute, which lists the real console device(s). (If there’s more than one, the last one in the list is the primary console.)
- pyanaconda.iutil.get_mount_paths(devnode)¶
given a device node, return a list of all active mountpoints.
- pyanaconda.iutil.get_platform_groupid()¶
Return a platform group id string
This runs systemd-detect-virt and if the result is not ‘none’ it prefixes the lower case result with “platform-” for use as a group id.
Returns: Empty string or a group id for the detected platform Return type: str
- pyanaconda.iutil.getdeepattr(obj, name)¶
This behaves as the standard getattr, but supports composite (containing dots) attribute names.
As an example:
>>> import os >>> from os.path import split >>> getdeepattr(os, "path.split") == split True
- pyanaconda.iutil.have_word_match(str1, str2)¶
Tells if all words from str1 exist in str2 or not.
- pyanaconda.iutil.ipmi_report(event)¶
- pyanaconda.iutil.isConsoleOnVirtualTerminal(dev='console')¶
- pyanaconda.iutil.is_unsupported_hw()¶
Check to see if the hardware is supported or not.
Returns: True if this is unsupported hardware, False otherwise Return type: bool
- pyanaconda.iutil.lowerASCII(s)¶
Convert a string to lowercase using only ASCII character definitions.
The returned string will contain only ASCII characters. This function is locale-independent.
- pyanaconda.iutil.mkdirChain(directory)¶
Parameters: dir – The directory path to create
- pyanaconda.iutil.open(*args, **kwargs)¶
Open a file, and retry on EINTR.
The arguments are the same as those to python’s builtin open.
This is equivalent to eintr_retry_call(open, ...). Some other high-level languages handle this for you, like C’s fopen.
- pyanaconda.iutil.parent_dir(directory)¶
Return the parent’s path
- pyanaconda.iutil.parseNfsUrl(nfsurl)¶
- pyanaconda.iutil.persistent_root_image()¶
Returns: whether we are running from a persistent (not in RAM) root.img
- pyanaconda.iutil.reIPL(ipldev)¶
- pyanaconda.iutil.requests_session()¶
Return a requests.Session object with file and ftp support.
- pyanaconda.iutil.resetRpmDb()¶
- pyanaconda.iutil.restart_service(service)¶
- pyanaconda.iutil.service_running(service)¶
- pyanaconda.iutil.setSysroot(path)¶
- Change the OS root path.
param path: The new OS root path
This should only be used by Payload subclasses which install operating systems to non-default roots.
- pyanaconda.iutil.setTargetPhysicalRoot(path)¶
Change the physical root path
Parameters: path (string) – Path to use instead of /mnt/sysimage/
- pyanaconda.iutil.setdeepattr(obj, name, value)¶
This behaves as the standard setattr, but supports composite (containing dots) attribute names.
As an example:
>>> class O: >>> pass >>> a = O() >>> a.b = O() >>> a.b.c = O() >>> setdeepattr(a, "b.c.d", True) >>> a.b.c.d True
- pyanaconda.iutil.setenv(name, value)¶
Set an environment variable to be used by child processes.
This method does not modify os.environ for the running process, which is not thread-safe. If setenv has already been called for a particular variable name, the old value is overwritten.
Parameters:
- pyanaconda.iutil.setup_translations()¶
- pyanaconda.iutil.startProgram(argv, root='/', stdin=None, stdout=-1, stderr=-2, env_prune=None, env_add=None, reset_handlers=True, reset_lang=True, **kwargs)¶
Start an external program and return the Popen object.
The root and reset_handlers arguments are handled by passing a preexec_fn argument to subprocess.Popen, but an additional preexec_fn can still be specified and will be run. The user preexec_fn will be run last.
Parameters: - argv – The command to run and argument
- root – The directory to chroot to before running command.
- stdin – The file object to read stdin from.
- stdout – The file object to write stdout to.
- stderr – The file object to write stderr to.
- env_prune – environment variables to remove before execution
- env_add – environment variables to add before execution
- reset_handlers – whether to reset to SIG_DFL any signal handlers set to SIG_IGN
- reset_lang – whether to set the locale of the child process to C
- kwargs – Additional parameters to pass to subprocess.Popen
Returns: A Popen object for the running command.
- pyanaconda.iutil.startX(argv, output_redirect=None)¶
Start X and return once X is ready to accept connections.
X11, if SIGUSR1 is set to SIG_IGN, will send SIGUSR1 to the parent process once it is ready to accept client connections. This method sets that up and waits for the signal or bombs out if nothing happens for a minute. The process will also be added to the list of watched processes.
Parameters: - argv – The command line to run, as a list
- output_redirect – file or file descriptor to redirect stdout and stderr to
- pyanaconda.iutil.start_service(service)¶
- pyanaconda.iutil.stop_service(service)¶
- pyanaconda.iutil.strip_accents(s)¶
This function takes arbitrary unicode string and returns it with all the diacritics removed.
Parameters: s (str) – arbitrary string Returns: s with diacritics removed Return type: str
- pyanaconda.iutil.unwatchAllProcesses()¶
Clear the watched process list.
- pyanaconda.iutil.unwatchProcess(proc)¶
Unwatch a process watched by watchProcess.
Parameters: proc – The Popen object for the process.
- pyanaconda.iutil.upcase_first_letter(text)¶
Helper function that upcases the first letter of the string. Python’s standard string.capitalize() not only upcases the first letter but also lowercases all the others. string.title() capitalizes all words in the string.
Returns: the given text with the first letter upcased Return type: str
- pyanaconda.iutil.upperASCII(s)¶
Convert a string to uppercase using only ASCII character definitions.
The returned string will contain only ASCII characters. This function is locale-independent.
- pyanaconda.iutil.vtActivate(num)¶
Try to switch to tty number $num.
Returns: whether the switch was successful or not Return type: bool
- pyanaconda.iutil.watchProcess(proc, name)¶
Watch for a process exit, and raise a ExitError when it does.
This method installs a SIGCHLD signal handler and thus interferes the child_watch_add methods in GLib. Use watchProcessGLib to convert to GLib mode if using a GLib main loop.
Since the SIGCHLD handler calls wait() on the watched process, this call cannot be combined with Popen.wait() or Popen.communicate, and also doing so wouldn’t make a whole lot of sense.
Parameters: - proc – The Popen object for the process
- name – The name of the process
- pyanaconda.iutil.watchProcessGLib()¶
Convert process watching to GLib mode.
This allows anaconda modes that use GLib main loops to use GLib.child_watch_add and continue to watch processes started before the main loop.
pyanaconda.kexec module¶
- exception pyanaconda.kexec.GrubbyInfoError¶
Bases: builtins.Exception
- pyanaconda.kexec.run_grubby(args=None)¶
Run grubby and retrieve the kernel, initrd and boot arguments
Parameters: args (list) – Arguments to pass to grubby. Returns: kernel path, initrd path, root device, kernel cmdline args. Return type: namedtuple Raises: some error on failure - The returned namedtuple contains the following attributes:
- kernel, initrd, root, args
- pyanaconda.kexec.setup_kexec(extra_args=None)¶
Setup kexec to use the new kernel and default bootloader entry
Parameters: extra_args (list) – Extra arguments to pass to kexec This uses grubby to determine the bootloader arguments from the default entry, and then sets up kexec so that reboot will use the new kernel and initrd instead of doing a full reboot.
Note
Once kexec is called there is nothing else to do, the reboot code already handles having kexec setup.
pyanaconda.keyboard module¶
This module provides functions for dealing with keyboard layouts/keymaps in Anaconda and the LocaledWrapper class with methods for setting, getting and mutually converting X layouts and VConsole keymaps.
- exception pyanaconda.keyboard.InvalidLayoutVariantSpec¶
Bases: builtins.Exception
Exception class for errors related to parsing layout and variant specification strings.
- exception pyanaconda.keyboard.KeyboardConfigError¶
Bases: builtins.Exception
Exception class for keyboard configuration related problems
- class pyanaconda.keyboard.LocaledWrapper¶
Bases: builtins.object
Class wrapping systemd-localed daemon functionality. By using safe_dbus module it tries to prevent failures related to threads and main loops.
- convert_keymap(keymap)¶
Method that returns X11 layouts and variants that (systemd-localed thinks) match given keymap best.
Parameters: keymap (str) – VConsole keymap Returns: X11 layouts and variants that (systemd-localed thinks) match given keymap best Return type: str
- convert_layout(layout_variant)¶
Method that returns VConsole keymap that (systemd-localed thinks) matches given layout and variant best.
Parameters: layout_variant (str) – ‘layout (variant)’ or ‘layout’ specification Returns: a keymap matching layout and variant best Return type: string
- keymap¶
- layouts_variants¶
- options¶
- set_and_convert_keymap(keymap)¶
Method that sets VConsole keymap and returns X11 layouts and variants that (systemd-localed thinks) match given keymap best.
Returns: string containing comma-separated “layout (variant)” or “layout” layout specifications Return type: string
- set_and_convert_layout(layout_variant)¶
Method that sets X11 layout and variant (for later X sessions) and returns VConsole keymap that (systemd-localed thinks) matches given layout and variant best.
Returns: a keymap matching layout and variant best Return type: string
- set_keymap(keymap, convert=False)¶
Method that sets VConsole keymap via systemd-localed’s DBus API.
Parameters:
- set_layouts(layouts_variants, options=None, convert=False)¶
Method that sets X11 layouts and variants (for later X sessions) via systemd-localed’s DBus API.
Parameters: - layout_variant (list of strings) – list of ‘layout (variant)’ or ‘layout’ specifications of layouts and variants
- options (list of strings) – list of X11 options that should be set
- convert (bool) – whether the keymap should be converted to a X11 layout (see set_and_convert_keymap)
- exception pyanaconda.keyboard.LocaledWrapperError¶
Bases: pyanaconda.keyboard.KeyboardConfigError
Exception class for reporting Localed-related problems
- pyanaconda.keyboard.activate_keyboard(keyboard)¶
Try to setup VConsole keymap and X11 layouts as specified in kickstart.
Parameters: keyboard (ksdata.keyboard object) – ksdata.keyboard object
- pyanaconda.keyboard.join_layout_variant(layout, variant='')¶
Join layout and variant to form the commonly used ‘layout (variant)’ or ‘layout’ (if variant is missing) format.
Returns: ‘layout (variant)’ or ‘layout’ string Return type: string
- pyanaconda.keyboard.normalize_layout_variant(layout_str)¶
Normalize keyboard layout and variant specification given as a single string. E.g. for a ‘layout(variant) string missing the space between the left parenthesis return ‘layout (variant)’ which is a proper layout and variant specification we use.
Parameters: layout_str (string) – a string specifying keyboard layout and its variant
- pyanaconda.keyboard.parse_layout_variant(layout_variant_str)¶
Parse layout and variant from the string that may look like ‘layout’ or ‘layout (variant)’.
Parameters: layout_variant_str (str) – keyboard layout and variant string specification Returns: the (layout, variant) pair, where variant can be “” Return type: tuple Raises InvalidLayoutVariantSpec: if the given string isn’t a valid layout and variant specification string
- pyanaconda.keyboard.populate_missing_items(keyboard)¶
Function that populates keyboard.vc_keymap and keyboard.x_layouts if they are missing. By invoking LocaledWrapper’s methods this function READS AND WRITES CONFIGURATION FILES (but tries to keep their content unchanged).
- pyanaconda.keyboard.write_keyboard_config(keyboard, root, convert=True)¶
Function that writes files with layouts configuration to $root/etc/X11/xorg.conf.d/01-anaconda-layouts.conf and $root/etc/vconsole.conf.
Parameters: - keyboard – ksdata.keyboard object
- root – path to the root of the installed system
- convert – whether to convert specified values to get the missing ones
- weight – weight (prefix) of the xorg.conf file written out
pyanaconda.kickstart module¶
- class pyanaconda.kickstart.AnacondaInternalScript(*args, **kwargs)¶
- class pyanaconda.kickstart.AnacondaKSHandler(addon_paths=None, commandUpdates=None, dataUpdates=None)¶
Bases: f23.F23Handler
- AddonClassType¶
alias of AddonData
- class pyanaconda.kickstart.AnacondaKSParser(handler, followIncludes=True, errorsAreFatal=True, missingIncludeIsFatal=True, scriptClass=<class 'pyanaconda.kickstart.AnacondaKSScript'>)¶
Bases: pykickstart.parser.KickstartParser
- handleCommand(lineno, args)¶
- setupSections()¶
- class pyanaconda.kickstart.AnacondaKSScript(script, *args, **kwargs)¶
Bases: pykickstart.parser.Script
Execute a kickstart script
This will write the script to a file named /tmp/ks-script- before execution. Output is logged by the program logger, the path specified by –log or to /tmp/ks-script-*.log
Create a new Script instance. Instance attributes:
- errorOnFail – If execution of the script fails, should anaconda
- stop, display an error, and then reboot without running any other scripts?
- inChroot – Does the script execute in anaconda’s chroot
- environment or not?
- interp – The program that should be used to interpret this
- script.
lineno – The line number this script starts on. logfile – Where all messages from the script should be logged. script – A string containing all the lines of the script. type – The type of the script, which can be KS_SCRIPT_* from
pykickstart.constants.- run(chroot)¶
Run the kickstart script @param chroot directory path to chroot into before execution
- class pyanaconda.kickstart.AnacondaPreParser(handler, followIncludes=True, errorsAreFatal=True, missingIncludeIsFatal=True)¶
Bases: pykickstart.parser.KickstartParser
- handleCommand(lineno, args)¶
- setupSections()¶
- class pyanaconda.kickstart.AnacondaSection(*args, **kwargs)¶
Bases: pykickstart.sections.Section
A section for anaconda specific commands.
- finalize()¶
Let %anaconda know no additional data will come.
- handleHeader(lineno, args)¶
Process the arguments to the %anaconda header.
- handleLine(line)¶
- sectionOpen = '%anaconda'¶
- class pyanaconda.kickstart.AnacondaSectionHandler¶
Bases: pykickstart.base.BaseHandler
A handler for only the anaconda ection’s commands.
- commandMap = {'pwpolicy': <class 'pyanaconda.pwpolicy.F22_PwPolicy'>}¶
- dataMap = {'PwPolicyData': <class 'pyanaconda.pwpolicy.F22_PwPolicyData'>}¶
- class pyanaconda.kickstart.Authconfig(*args, **kwargs)¶
Bases: pykickstart.commands.authconfig.FC3_Authconfig
- execute(*args)¶
- setup()¶
- class pyanaconda.kickstart.AutoPart(writePriority=100, *args, **kwargs)¶
Bases: pykickstart.commands.autopart.F21_AutoPart
- execute(storage, ksdata, instClass)¶
- parse(args)¶
- class pyanaconda.kickstart.BTRFS(writePriority=132, *args, **kwargs)¶
Bases: pykickstart.commands.btrfs.F23_BTRFS
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.BTRFSData(*args, **kwargs)¶
Bases: pykickstart.commands.btrfs.F23_BTRFSData
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.Bootloader(*args, **kwargs)¶
Bases: pykickstart.commands.bootloader.F21_Bootloader
- execute(storage, ksdata, instClass)¶
- parse(args)¶
- class pyanaconda.kickstart.ClearPart(*args, **kwargs)¶
Bases: pykickstart.commands.clearpart.F21_ClearPart
- execute(storage, ksdata, instClass)¶
- parse(args)¶
- class pyanaconda.kickstart.DmRaid(writePriority=60, *args, **kwargs)¶
Bases: pykickstart.commands.dmraid.FC6_DmRaid
- parse(args)¶
- class pyanaconda.kickstart.Fcoe(writePriority=71, *args, **kwargs)¶
Bases: pykickstart.commands.fcoe.F13_Fcoe
- parse(args)¶
- class pyanaconda.kickstart.Firewall(*args, **kwargs)¶
Bases: pykickstart.commands.firewall.F20_Firewall
- execute(storage, ksdata, instClass)¶
- setup()¶
- class pyanaconda.kickstart.Firstboot(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.firstboot.FC3_Firstboot
- execute(*args)¶
- setup(*args)¶
- class pyanaconda.kickstart.Group(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.group.F12_Group
- execute(storage, ksdata, instClass, users)¶
- class pyanaconda.kickstart.IgnoreDisk(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.ignoredisk.RHEL6_IgnoreDisk
- parse(args)¶
- class pyanaconda.kickstart.Iscsi(writePriority=71, *args, **kwargs)¶
Bases: pykickstart.commands.iscsi.F17_Iscsi
- parse(args)¶
- class pyanaconda.kickstart.IscsiName(writePriority=70, *args, **kwargs)¶
Bases: pykickstart.commands.iscsiname.FC6_IscsiName
- parse(args)¶
- class pyanaconda.kickstart.Keyboard(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.keyboard.F18_Keyboard
- execute(*args)¶
- class pyanaconda.kickstart.Lang(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.lang.F19_Lang
- execute(*args, **kwargs)¶
- class pyanaconda.kickstart.LogVol(writePriority=133, *args, **kwargs)¶
Bases: pykickstart.commands.logvol.F23_LogVol
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.LogVolData(*args, **kwargs)¶
Bases: pykickstart.commands.logvol.F23_LogVolData
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.Logging(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.logging.FC6_Logging
- execute(*args)¶
- class pyanaconda.kickstart.MultiPath(writePriority=50, *args, **kwargs)¶
Bases: pykickstart.commands.multipath.FC6_MultiPath
- parse(args)¶
- class pyanaconda.kickstart.Network(*args, **kwargs)¶
Bases: pykickstart.commands.network.F22_Network
- execute(storage, ksdata, instClass)¶
- setup()¶
- class pyanaconda.kickstart.Partition(writePriority=130, *args, **kwargs)¶
Bases: pykickstart.commands.partition.F23_Partition
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.PartitionData(*args, **kwargs)¶
Bases: pykickstart.commands.partition.F23_PartData
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.Raid(writePriority=131, *args, **kwargs)¶
Bases: pykickstart.commands.raid.F23_Raid
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.RaidData(*args, **kwargs)¶
Bases: pykickstart.commands.raid.F23_RaidData
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.Realm(*args)¶
Bases: pykickstart.commands.realm.F19_Realm
- execute(*args)¶
- setup()¶
- class pyanaconda.kickstart.RepoData(*args, **kwargs)¶
Bases: pykickstart.commands.repo.F21_RepoData
Add enabled kwarg
Parameters: enabled (bool) – The repo has been enabled
- class pyanaconda.kickstart.ReqPart(writePriority=100, *args, **kwargs)¶
Bases: pykickstart.commands.reqpart.F23_ReqPart
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.RootPw(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.rootpw.F18_RootPw
- execute(storage, ksdata, instClass, users)¶
- class pyanaconda.kickstart.SELinux(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.selinux.FC3_SELinux
- execute(*args)¶
- class pyanaconda.kickstart.Services(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.services.FC6_Services
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.SkipX(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.skipx.FC3_SkipX
- execute(*args)¶
- class pyanaconda.kickstart.SshKey(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.sshkey.F22_SshKey
- execute(storage, ksdata, instClass, users)¶
- class pyanaconda.kickstart.Timezone(*args)¶
Bases: pykickstart.commands.timezone.F23_Timezone
- execute(*args)¶
- setup(ksdata)¶
- class pyanaconda.kickstart.User(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.user.F19_User
- execute(storage, ksdata, instClass, users)¶
- class pyanaconda.kickstart.VolGroup(writePriority=132, *args, **kwargs)¶
Bases: pykickstart.commands.volgroup.F21_VolGroup
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.VolGroupData(*args, **kwargs)¶
Bases: pykickstart.commands.volgroup.F21_VolGroupData
- execute(storage, ksdata, instClass)¶
- class pyanaconda.kickstart.XConfig(writePriority=0, *args, **kwargs)¶
Bases: pykickstart.commands.xconfig.F14_XConfig
- execute(*args)¶
- class pyanaconda.kickstart.ZFCP(*args, **kwargs)¶
Bases: pykickstart.commands.zfcp.F14_ZFCP
- parse(args)¶
- pyanaconda.kickstart.appendPostScripts(ksdata)¶
- pyanaconda.kickstart.deviceMatches(spec, devicetree=None)¶
Return names of block devices matching the provided specification.
Parameters: - spec (str) – a device identifier (name, UUID=<uuid>, &c)
- devicetree (blivet.DeviceTree) – device tree to look up devices in (optional)
Returns: names of matching devices
Return type: list of str
parse methods will not have access to a devicetree, while execute methods will. The devicetree is superior in that it can resolve md array names and in that it reflects scheduled device removals, but for normal local disks udev.resolve_devspec should suffice.
- pyanaconda.kickstart.doKickstartStorage(storage, ksdata, instClass)¶
Setup storage state from the kickstart data
- pyanaconda.kickstart.getAvailableDiskSpace(storage)¶
Get overall disk space available on disks we may use.
Parameters: storage – blivet.Blivet instance Returns: overall disk space available Return type: blivet.size.Size
- pyanaconda.kickstart.getEscrowCertificate(escrowCerts, url)¶
- pyanaconda.kickstart.lookupAlias(devicetree, alias)¶
- pyanaconda.kickstart.parseKickstart(f)¶
- pyanaconda.kickstart.preScriptPass(f)¶
- pyanaconda.kickstart.refreshAutoSwapSize(storage)¶
Refresh size of the auto partitioning request for swap device according to the current state of the storage configuration.
Parameters: storage – blivet.Blivet instance
- pyanaconda.kickstart.removeExistingFormat(device, storage)¶
- pyanaconda.kickstart.resetCustomStorageData(ksdata)¶
- pyanaconda.kickstart.runPostScripts(scripts)¶
- pyanaconda.kickstart.runPreInstallScripts(scripts)¶
- pyanaconda.kickstart.runPreScripts(scripts)¶
- pyanaconda.kickstart.runTracebackScripts(scripts)¶
pyanaconda.localization module¶
- exception pyanaconda.localization.InvalidLocaleSpec¶
Bases: pyanaconda.localization.LocalizationConfigError
Exception class for the errors related to invalid locale specs
- exception pyanaconda.localization.LocalizationConfigError¶
Bases: builtins.Exception
Exception class for localization configuration related problems
- pyanaconda.localization.find_best_locale_match(locale, langcodes)¶
Find the best match for the locale in a list of langcodes. This is useful when e.g. pt_BR is a locale and there are possibilities to choose an item (e.g. rnote) for a list containing both pt and pt_BR or even also pt_PT.
Parameters: - locale (str) – a valid locale (e.g. en_US.UTF-8 or sr_RS.UTF-8@latin, etc.)
- langcodes (list(str) or generator(str)) – a list or generator of langcodes (e.g. en, en_US, en_US@latin, etc.)
Returns: the best matching langcode from the list of None if none matches
Return type: str or None
- pyanaconda.localization.get_available_translations(localedir=None)¶
Method that generates (i.e. returns a generator) available translations for the installer in the given localedir.
Returns: generator yielding available translations (languages) Return type: generator yielding strings
- pyanaconda.localization.get_english_name(locale)¶
Function returning english name for the given locale.
Parameters: locale (str) – locale to return english name for Returns: english name for the locale or empty string if unknown Return type: st Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_language_locales(lang)¶
Function returning all locales available for the given language.
Parameters: lang (str) – language to get available locales for Returns: a list of available locales Return type: list of strings Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_locale_keyboards(locale)¶
Function returning preferred keyboard layouts for the given locale.
Parameters: locale (str) – locale string (see LANGCODE_RE) Returns: list of preferred keyboard layouts Return type: list of strings Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_locale_territory(locale)¶
Function returning locale’s territory.
Parameters: locale (str) – locale string (see LANGCODE_RE) Returns: territory or None Return type: str or None Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_locale_timezones(locale)¶
Function returning preferred timezones for the given locale.
Parameters: locale (str) – locale string (see LANGCODE_RE) Returns: list of preferred timezones Return type: list of strings Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_native_name(locale)¶
Function returning native name for the given locale.
Parameters: locale (str) – locale to return native name for Returns: english name for the locale or empty string if unknown Return type: st Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.get_territory_locales(territory)¶
Function returning list of locales for the given territory. The list is sorted from the most probable locale to the least probable one (based on langtable’s ranking.
Parameters: territory (str) – territory to return locales for Returns: list of locales Return type: list of strings
- pyanaconda.localization.get_xlated_timezone(tz_spec_part)¶
Function returning translated name of a region, city or complete timezone name according to the current value of the $LANG variable.
Parameters: tz_spec_part (str) – a region, city or complete timezone name Returns: translated name of the given region, city or timezone Return type: str
- pyanaconda.localization.is_supported_locale(locale)¶
Function that tells if the given locale is supported by the Anaconda or not. We consider locales supported by the langtable as supported by the Anaconda.
Parameters: locale (str) – locale to test Returns: whether the given locale is supported or not Return type: bool Raises InvalidLocaleSpec: if an invalid locale is given (see LANGCODE_RE)
- pyanaconda.localization.langcode_matches_locale(langcode, locale)¶
Function that tells if the given langcode matches the given locale. I.e. if all parts of appearing in the langcode (language, territory, script and encoding) are the same as the matching parts of the locale.
Parameters: - langcode (str) – a langcode (e.g. en, en_US, en_US@latin, etc.)
- locale (str) – a valid locale (e.g. en_US.UTF-8 or sr_RS.UTF-8@latin, etc.)
Returns: whether the given langcode matches the given locale or not
Return type: bool
- pyanaconda.localization.load_firmware_language(lang)¶
Procedure that loads firmware language information (if any). It stores the information in the given ksdata.lang object and sets the $LANG environment variable.
This method must be run before any other threads are started.
Parameters: lang – ksdata.lang object Returns: None Return type: None
- pyanaconda.localization.parse_langcode(langcode)¶
For a given langcode (e.g. 'SR_RS.UTF-8@latin‘) returns a dictionary with the following keys and example values:
‘language’ : ‘SR’ ‘territory’ : ‘RS’ ‘encoding’ : ‘UTF-8’ ‘script’ : ‘latin’
or None if the given string doesn’t match the LANGCODE_RE.
- pyanaconda.localization.resolve_date_format(year, month, day, fail_safe=True)¶
Puts the year, month and day objects in the right order according to the currently set locale and provides format specification for each of the fields.
Parameters: Returns: a pair where the first field contains a tuple with the year, month and day objects/values put in the right order and where the second field contains a tuple with three _DateFieldSpec objects specifying formats respectively to the first (year, month, day) field, e.g. ((year, month, day), (y_fmt, m_fmt, d_fmt))
Return type: tuple
Raises ValueError: in case currently set locale has unsupported date format and fail_safe is set to False
- pyanaconda.localization.setup_locale(locale, lang=None)¶
Procedure setting the system to use the given locale and store it in to the ksdata.lang object (if given). DOES NOT PERFORM ANY CHECKS OF THE GIVEN LOCALE.
$LANG must be set by the caller in order to set the language used by gettext. Doing this in a thread-safe way is up to the caller.
Parameters: - locale (str) – locale to setup
- lang – ksdata.lang object or None
Returns: None
Return type: None
- pyanaconda.localization.write_language_configuration(lang, root)¶
Write language configuration to the $root/etc/locale.conf file.
Parameters: - lang – ksdata.lang object
- root – path to the root of the installed system
pyanaconda.network module¶
- class pyanaconda.network.IfcfgFile(filename)¶
Bases: pyanaconda.simpleconfig.SimpleConfigFile
- read(filename=None)¶
- set(*args)¶
- unset(*args)¶
- write(filename=None, use_tmp=False)¶
- pyanaconda.network.add_connection_for_ksdata(networkdata, devname)¶
- pyanaconda.network.apply_kickstart(ksdata)¶
- pyanaconda.network.autostartFCoEDevices(rootpath, storage, ksdata)¶
- pyanaconda.network.bond_options_ksdata_to_dbus(opts_str)¶
- pyanaconda.network.check_ip_address(address, version=None)¶
- pyanaconda.network.copyDhclientConfFiles(destPath)¶
- pyanaconda.network.copyFileToPath(fileName, destPath='', overwrite=False)¶
- pyanaconda.network.copyIfcfgFiles(destPath)¶
- pyanaconda.network.default_ks_vlan_interface_name(parent, vlanid)¶
- pyanaconda.network.default_route_device(family='inet')¶
- pyanaconda.network.disableIPV6(rootpath)¶
- pyanaconda.network.disableNMForStorageDevices(rootpath, storage)¶
- pyanaconda.network.dracutBootArguments(devname, ifcfg, storage_ipaddr, hostname=None)¶
- pyanaconda.network.dracutSetupArgs(networkStorageDevice)¶
- pyanaconda.network.dumpMissingDefaultIfcfgs()¶
Dump missing default ifcfg file for wired devices. For default auto connections created by NM upon start - which happens in case of missing ifcfg file - rename the connection using device name and dump its ifcfg file. (For server, default auto connections will be turned off in NetworkManager.conf.) The connection id (and consequently ifcfg file) is set to device name. Returns list of devices for which ifcfg file was dumped.
- pyanaconda.network.find_ifcfg_file(values, root_path='')¶
- pyanaconda.network.find_ifcfg_file_of_device(devname, root_path='')¶
- pyanaconda.network.getFirstRealIP()¶
- pyanaconda.network.getHostname()¶
- pyanaconda.network.getIPs()¶
- pyanaconda.network.get_device_name(network_data)¶
Find the first network device which matches the kickstart specification.
Parameters: network_data – A pykickstart NetworkData object Returns: a string naming a physical device, or “” meaning none matched Return type: str
- pyanaconda.network.get_slaves_from_ifcfgs(master_option, master_specs)¶
List of slaves of master specified by master_specs in master_option.
master_option is ifcfg option containing spec of master master_specs is a list containing device name of master (dracut) and/or master’s connection uuid
- pyanaconda.network.get_team_slaves(master_specs)¶
List of slaves of master specified by master_specs (name, opts).
master_specs is a list containing device name of master (dracut) and/or master’s connection uuid
- pyanaconda.network.has_some_wired_autoconnect_device()¶
Is there a wired network device with autoconnect?
- pyanaconda.network.hostname_ksdata(hostname)¶
- pyanaconda.network.ifaceForHostIP(host)¶
- pyanaconda.network.ifcfg_to_ksdata(ifcfg, devname)¶
- pyanaconda.network.is_using_team_device()¶
- pyanaconda.network.ks_spec_to_device_name(ksspec='')¶
Find the first network device which matches the kickstart specification. Will not match derived types such as bonds and vlans.
Parameters: ksspec – kickstart-specified device name Returns: a string naming a physical device, or “” meaning none matched Return type: str
- pyanaconda.network.ksdata_from_ifcfg(devname, uuid=None)¶
- pyanaconda.network.logIfcfgFile(path, message='')¶
- pyanaconda.network.logIfcfgFiles(message='')¶
- pyanaconda.network.netmask2prefix(netmask)¶
- pyanaconda.network.networkInitialize(ksdata)¶
- pyanaconda.network.prefix2netmask(prefix)¶
Convert prefix (CIDR bits) to netmask
- pyanaconda.network.sanityCheckHostname(hostname)¶
Check if the given string is (syntactically) a valid hostname.
Parameters: hostname – a string to check Returns: a pair containing boolean value (valid or invalid) and an error message (if applicable) Return type: (bool, str)
- pyanaconda.network.setOnboot(ksdata)¶
- pyanaconda.network.set_hostname(hn)¶
- pyanaconda.network.setup_ifcfg_log()¶
- pyanaconda.network.status_message()¶
A short string describing which devices are connected.
- pyanaconda.network.update_hostname_data(ksdata, hostname)¶
- pyanaconda.network.update_onboot_value(devname, value, ksdata)¶
Update onboot value in ifcfg files and ksdata
- pyanaconda.network.update_settings_with_ksdata(devname, networkdata)¶
- pyanaconda.network.usedByFCoE(iface, storage)¶
- pyanaconda.network.usedByRootOnISCSI(iface, storage)¶
- pyanaconda.network.wait_for_connecting_NM_thread(ksdata)¶
This function is called from a thread which is run at startup to wait for Network Manager to connect.
- pyanaconda.network.wait_for_connectivity(timeout=45)¶
Wait for network connectivty to become available
Parameters: timeout – how long to wait in seconds
- pyanaconda.network.wait_for_network_devices(devices, timeout=45)¶
- pyanaconda.network.write_hostname(rootpath, ksdata, overwrite=False)¶
- pyanaconda.network.write_network_config(storage, ksdata, instClass, rootpath)¶
- pyanaconda.network.write_sysconfig_network(rootpath, overwrite=False)¶
pyanaconda.nm module¶
- exception pyanaconda.nm.AddConnectionError¶
Bases: builtins.Exception
Connection is not available for the device
- exception pyanaconda.nm.BondOptionsError¶
- exception pyanaconda.nm.DeviceNotActiveError¶
Bases: builtins.Exception
Device of specified name is not active
- exception pyanaconda.nm.PropertyNotFoundError¶
Bases: builtins.ValueError
Property of NM object was not found
- exception pyanaconda.nm.SettingsNotFoundError¶
Bases: builtins.ValueError
Settings NMRemoteConnection object was not found
- exception pyanaconda.nm.UnknownConnectionError¶
Bases: builtins.Exception
Connection is not available for the device
- exception pyanaconda.nm.UnknownDeviceError¶
Bases: builtins.ValueError
Device of specified name was not found by NM
- exception pyanaconda.nm.UnknownMethodGetError¶
Bases: builtins.Exception
Object does not have Get, most probably being invalid
- exception pyanaconda.nm.UnmanagedDeviceError¶
Bases: builtins.Exception
Device of specified name is not managed by NM or unavailable
- pyanaconda.nm.nm_activate_device_connection(dev_name, con_uuid)¶
Activate device with specified connection.
Parameters: - dev_name (str or None) – name of device or None for virtual devices
- con_uuid (str) – uuid of connection to be activated on device
Raises: - UnknownDeviceError – if device is not found
- UnmanagedDeviceError – if device is not managed by NM or unavailable
- SettingsNotFoundError – if conneciton with given uuid was not found
- UnknownConnectionError – if connection is not available for the device
- pyanaconda.nm.nm_activated_devices()¶
Return names of activated network devices.
Returns: names of activated network devices Return type: list of strings
- pyanaconda.nm.nm_add_connection(values)¶
Add new connection specified by values.
Parameters: values ([[key1, key2, value, type_str], ...] key1: str key2: str value: object type_str: str) – list of settings with new values and its types [[key1, key2, value, type_str], ...] key1: first-level key of setting (eg “connection”) key2: second-level key of setting (eg “uuid”) value: new value type_str: dbus type of new value (eg “ay”)
- pyanaconda.nm.nm_ap_setting_value(ssid, key1, key2)¶
Return value of ap’s setting specified by key1 and key2.
Parameters: Returns: value of setting or None if the setting was not found which means it does not exist or default value is used by NM
Return type: unpacked GDBus variant or None
Raises SettingsNotFoundError: if settings were not found (eg for “wlan0”)
- pyanaconda.nm.nm_dbus_ay_to_ipv6(bytelist)¶
Convert ipv6 address from list of bytes (dbus ‘ay’) to string.
Parameters: address (list of bytes - dbus ‘ay’) – IPv6 address as list of bytes returned by dbus (‘ay’) Returns: IPv6 address Return type: str
- pyanaconda.nm.nm_dbus_int_to_ipv4(address)¶
Convert ipv4 address from dus int ‘u’ (switched endianess) to string.
Parameters: address (integer - dbus ‘u’) – IPv4 address as integer returned by dbus (‘u’) Returns: IPv6 address Return type: str
- pyanaconda.nm.nm_delete_connection(uuid)¶
Delete connection specified by uuid.
Parameters: uuid (str) – uuid of connection to be deleted Returns: True if connection was deleted, False if it was not found Return type: bool
- pyanaconda.nm.nm_device_active_con_uuid(name)¶
Return uuid of device’s active connection
Exceptions: UnknownDeviceError if device is not found
- pyanaconda.nm.nm_device_active_ssid(name)¶
Return ssid of device’s active access point.
Parameters: name (str) – name of device :return ssid of active access point, None if device has no active AP :rtype: str :raise UnknownDeviceError: if device is not found
- pyanaconda.nm.nm_device_carrier(name)¶
Return whether physical carrier of device is found. (‘Carrier’ property)
Parameters: name (str) – name of device
Returns: True if physical carrier is found, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if ‘Carrier’ property is not found
- pyanaconda.nm.nm_device_hwaddress(name)¶
Return active hardware address of device (‘HwAddress’ property)
Parameters: name (str) – name of device
Returns: active hardware address of device (‘HwAddress’ property)
Return type: str
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if ‘HwAddress’ property is not found
- pyanaconda.nm.nm_device_ip_addresses(name, version=4)¶
Return IP addresses of device in ACTIVATED state.
Parameters: Returns: IP addresses of device, empty list if device is not in ACTIVATED state
Return type: list of strings
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if IP configuration is not found
- pyanaconda.nm.nm_device_ip_config(name, version=4)¶
Return IP configurations of device in ACTIVATED state.
Parameters: Returns: IP configuration of device, empty list if device is not in ACTIVATED state
Return type: - [[[address1, prefix1, gateway1], [address2, prefix2, gateway2], ...],
[nameserver1, nameserver2]]
addressX, gatewayX: string prefixX: int
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if ip configuration is not found
- pyanaconda.nm.nm_device_is_slave(name)¶
Is the device a slave?
Exceptions: UnknownDeviceError if device is not found
- pyanaconda.nm.nm_device_perm_hwaddress(name)¶
Return active hardware address of device (‘PermHwAddress’ property)
Parameters: name (str) – name of device
Returns: active hardware address of device (‘PermHwAddress’ property)
Return type: str
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if ‘PermHwAddress’ property is not found
- pyanaconda.nm.nm_device_property(name, prop)¶
Return value of device NM property
Parameters: - name (str) – name of device
- prop – property
Returns: value of device’s property
Return type: unpacked GDBus value
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_setting_value(name, key1, key2)¶
Return value of device’s setting specified by key1 and key2.
Parameters: Returns: value of setting or None if the setting was not found which means it does not exist or default value is used by NM
Return type: unpacked GDBus variant or None
Raises: - UnknownDeviceError – if device is not found
- SettingsNotFoundError – if settings were not found (eg for “wlan0”)
- pyanaconda.nm.nm_device_slaves(name)¶
Return slaves of device.
Parameters: name (str) – name of device Returns: names of slaves of device or None if device has no ‘Slaves’ property Return type: list of strings or None Raises UnknownDeviceError: if device is not found
- pyanaconda.nm.nm_device_type(name)¶
Return device’s type (‘DeviceType’ property).
Parameters: name (str) – name of device
Returns: device type
Return type: integer
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if ‘DeviceType’ property is not found
- pyanaconda.nm.nm_device_type_is_bond(name)¶
Is the type of device bond?
Parameters: name (str) – name of device
Returns: True if type of device is BOND, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_type_is_bridge(name)¶
Is the type of device bridge?
Parameters: name (str) – name of device
Returns: True if type of device is BRIDGE, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_type_is_ethernet(name)¶
Is the type of device ethernet?
Parameters: name (str) – name of device
Returns: True if type of device is ETHERNET, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_type_is_infiniband(name)¶
Is the type of device infiniband?
Exceptions: UnknownDeviceError if device is not found PropertyNotFoundError if type is not found
- pyanaconda.nm.nm_device_type_is_team(name)¶
Is the type of device team?
Parameters: name (str) – name of device
Returns: True if type of device is TEAM, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_type_is_vlan(name)¶
Is the type of device vlan?
Parameters: name (str) – name of device
Returns: True if type of device is VLAN, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_type_is_wifi(name)¶
Is the type of device wifi?
Parameters: name (str) – name of device
Returns: True if type of device is WIFI, False otherwise
Return type: bool
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_device_valid_hwaddress(name)¶
Return valid hardware address of device depending on type of the device (‘PermHwAddress’ property or ‘HwAddress’ property for infiniband)
Parameters: name (str) – name of device
Returns: active hardware address of device (‘HwAddress’ or ‘PermHwAddress’ property)
Return type: str
Raises: - UnknownDeviceError – if device is not found
- PropertyNotFoundError – if property is not found
- pyanaconda.nm.nm_devices()¶
Return names of network devices supported in installer.
Returns: names of network devices supported in installer Return type: list of strings
- pyanaconda.nm.nm_disconnect_device(name)¶
Disconnect the device.
Raises UnknownDeviceError: if device is not found
- pyanaconda.nm.nm_get_all_settings()¶
Return all settings for logging.
- pyanaconda.nm.nm_get_settings(value, key1, key2, format_value=<function <lambda> at 0x7feab3f96a60>)¶
Return settings having given value of key1, key2 setting
Returns list of settings(dicts) , None if settings were not found.
- pyanaconda.nm.nm_hwaddr_to_device_name(hwaddr)¶
Return device name of interface with given hardware address.
Parameters: hwaddr (str) – hardware address Returns: device name of interface having hwaddr Return type: str
- pyanaconda.nm.nm_ipv4_to_dbus_int(address)¶
Convert ipv4 address from string to int for dbus (switched endianess).
Parameters: address (str) – IPv4 address Returns: IPv4 address as an integer ‘u’ for NM dbus setting Return type: integer
- pyanaconda.nm.nm_ipv6_to_dbus_ay(address)¶
Convert ipv6 address from string to list of bytes ‘ay’ for dbus
Parameters: address (str) – IPv6 address Returns: address in format ‘ay’ for NM dbus setting Return type: list of bytes
- pyanaconda.nm.nm_is_connected()¶
Is NetworkManager connected?
Returns: True if NM is connected, False otherwise. Return type: bool
- pyanaconda.nm.nm_is_connecting()¶
Is NetworkManager connecting?
Returns: True if NM is in CONNECTING state, False otherwise. Return type: bool
- pyanaconda.nm.nm_ntp_servers_from_dhcp()¶
Return NTP servers obtained by DHCP.
return: NTP servers obtained by DHCP rtype: list of str
- pyanaconda.nm.nm_state()¶
Return state of NetworkManager
Returns: state of NetworkManager Return type: integer
- pyanaconda.nm.nm_update_settings_of_device(name, new_values)¶
Update setting of device.
The type of value is determined from existing settings of device. If setting for key1, key2 does not exist, default_type_str is used or if None, the type is inferred from the value supplied (string and bool only).
Parameters: - name (str) – name of device
- new_values ([[key1, key2, value, default_type_str], ...]
key1: str
key2: str
value:
default_type_str: str) –
list of settings with new values and its types [[key1, key2, value, default_type_str]] key1: first-level key of setting (eg “connection”) key2: second-level key of setting (eg “uuid”) value: new value default_type_str: dbus type of new value to be used
if the setting does not already exist; if None, the type is inferred from value (string and bool only)
Raises: - UnknownDeviceError – if device is not found
- SettingsNotFoundError – if settings were not found (eg for “wlan0”)
- pyanaconda.nm.test()¶
pyanaconda.ntp module¶
Module facilitating the work with NTP servers and NTP daemon’s configuration
- exception pyanaconda.ntp.NTPconfigError¶
Bases: builtins.Exception
Exception class for NTP related problems
- pyanaconda.ntp.get_servers_from_config(conf_file_path='/etc/chrony.conf', srv_regexp=re.compile('^\\s*(server|pool)\\s*([-a-zA-Z.0-9]+)\\s*[a-zA-Z]+\\s*$'))¶
Goes through the chronyd’s configuration file looking for lines starting with ‘server’.
Returns: servers found in the chronyd’s configuration Return type: list
- pyanaconda.ntp.internal_to_pools_and_servers(pools_servers)¶
- pyanaconda.ntp.ntp_server_working(server)¶
Tries to do an NTP request to the $server (timeout may take some time).
Parameters: server (string) – hostname or IP address of an NTP server Returns: True if the given server is reachable and working, False otherwise Return type: bool
- pyanaconda.ntp.one_time_sync(server, callback=None)¶
Synchronize the system time with a given NTP server. Note that this function is blocking and will not return until the time gets synced or querying server fails (may take some time before timeouting).
Parameters: - server – NTP server
- callback (a function taking one boolean argument (success)) – callback function to run after sync or failure
Returns: True if the sync was successful, False otherwise
- pyanaconda.ntp.one_time_sync_async(server, callback=None)¶
Asynchronously synchronize the system time with a given NTP server. This function is non-blocking it starts a new thread for synchronization and returns. Use callback argument to specify the function called when the new thread finishes if needed.
Parameters: - server – NTP server
- callback (a function taking one boolean argument (success)) – callback function to run after sync or failure
- pyanaconda.ntp.pools_servers_to_internal(pools, servers)¶
- pyanaconda.ntp.save_servers_to_config(pools, servers, conf_file_path='/etc/chrony.conf', srv_regexp=re.compile('^\\s*(server|pool)\\s*([-a-zA-Z.0-9]+)\\s*[a-zA-Z]+\\s*$'), out_file_path=None)¶
Replaces the pools and servers defined in the chronyd’s configuration file with the given ones. If the out_file is not None, then it is used for the resulting config.
Parameters: out_file_path – path to the file used for the resulting config
pyanaconda.orderedset module¶
- class pyanaconda.orderedset.OrderedSet(iterable=None)¶
Bases: collections.abc.MutableSet
- add(key)¶
- discard(key)¶
- pop(last=True)¶
pyanaconda.product module¶
- pyanaconda.product.distributionText()¶
- pyanaconda.product.translated_new_install_name()¶
pyanaconda.progress module¶
- pyanaconda.progress.progress_complete()¶
- pyanaconda.progress.progress_init(steps)¶
- pyanaconda.progress.progress_message(message)¶
- pyanaconda.progress.progress_report(message)¶
- pyanaconda.progress.progress_step(message)¶
pyanaconda.pwpolicy module¶
pyanaconda.queuefactory module¶
- class pyanaconda.queuefactory.QueueFactory(name)¶
Bases: builtins.object
Constructs a new object wrapping a Queue.Queue, complete with constants and sending functions for each type of message that can be put into the queue.
Creating a new object using this class is done like so:
q = QueueFactory(“progress”)And then adding messages to it is done like so:
q.addMessage(“init”, 0) q.addMessage(“step”, 1)The first call will create a new constant named PROGRESS_CODE_INIT and a method named send_init that takes zero arguments. The second call will create a new constant named PROGRESS_CODE_STEP and a method named send_step that takes one argument.
Reusing names within the same class is not allowed.
- addMessage(name, argc)¶
pyanaconda.regexes module¶
pyanaconda.rescue module¶
- class pyanaconda.rescue.RescueInterface¶
Bases: pyanaconda.installinterfacebase.InstallInterfaceBase
- detailedMessageWindow(title, text, longText=None, ty='ok', default=None, custom_icon=None, custom_buttons=None, expanded=False)¶
- meh_interface¶
- messageWindow(title, text, ty='ok', default=None, custom_icon=None, custom_buttons=None)¶
- passphraseEntryWindow(device)¶
- progressWindow(title, text, total, updpct=0.05, pulse=False)¶
- resume()¶
- shutdown()¶
- suspend()¶
- tty_num¶
- waitWindow(title, text)¶
- pyanaconda.rescue.doRescue(intf, rescue_mount, ksdata)¶
- pyanaconda.rescue.makeFStab(instPath='')¶
- pyanaconda.rescue.makeResolvConf(instPath)¶
- pyanaconda.rescue.runShell(screen=None, msg='')¶
pyanaconda.safe_dbus module¶
Module providing thread-safe and mainloop-safe DBus operations.
- exception pyanaconda.safe_dbus.DBusCallError¶
Bases: pyanaconda.safe_dbus.SafeDBusError
Class for the errors related to calling methods over DBus.
- exception pyanaconda.safe_dbus.DBusPropertyError¶
Bases: pyanaconda.safe_dbus.DBusCallError
Class for the errors related to getting property values over DBus.
- exception pyanaconda.safe_dbus.SafeDBusError¶
Bases: builtins.Exception
Class for exceptions defined in this module.
- pyanaconda.safe_dbus.call_sync(service, obj_path, iface, method, args, connection=None)¶
Safely call a given method on a given object of a given service over DBus passing given arguments. If a connection is given, it is used, otherwise a new connection is established. Safely means that it is a synchronous, thread-safe call not using any main loop.
Parameters: - service (str) – DBus service to use
- obj_path (str) – object path of the object to call method on
- iface (str) – interface to use
- method (str) – name of the method to call
- args (GVariant) – arguments to pass to the method
- connection (Gio.DBusConnection) – connection to use (if None, a new connection is established)
Returns: unpacked value returned by the method
Return type: tuple with elements that depend on the method
Raises DBusCallError: if some DBus related error appears
- pyanaconda.safe_dbus.get_new_session_connection()¶
Get a connection handle for the per-user-login-session message bus.
!!! RUN THIS EARLY !!! like, before any other threads start. Connections to the session bus must be made with the effective UID of the login user, which in live installs is not the UID of anaconda. This means we need to call seteuid in this method, and doing that after threads have started will probably do something weird.
Live installs use consolehelper to run as root, which sets the original UID in $USERHELPER_UID.
Returns: the session connection handle
Return type: Gio.DBusConnection
Raises: - DBusCallError – if some DBus related error appears
- OSError – if unable to set the effective UID
- pyanaconda.safe_dbus.get_new_system_connection()¶
Return a new connection to the system bus.
- pyanaconda.safe_dbus.get_property_sync(service, obj_path, iface, prop_name, connection=None)¶
Get value of a given property of a given object provided by a given service.
Parameters: Returns: unpacked value of the property
Return type: tuple with elements that depend on the type of the property
Raises: - DBusCallError – when the internal dbus_call_safe_sync invocation raises an exception
- DBusPropertyError – when the given object doesn’t have the given property
pyanaconda.screensaver module¶
- pyanaconda.screensaver.inhibit_screensaver(connection)¶
Inhibit the screensaver idle timer.
Parameters: connection (Gio.DBusConnection) – A handle for the session message bus Returns: The inhibit ID or None Return type: int or None
pyanaconda.simpleconfig module¶
- class pyanaconda.simpleconfig.SimpleConfigFile(filename=None, read_unquote=True, write_quote=True, always_quote=False)¶
Bases: builtins.object
Edit values in a configuration file without changing comments. Supports KEY=VALUE lines and ignores everything else. Supports adding new keys. Supports deleting keys. Preserves comment, blank lines and comments on KEY lines Does not support duplicate key entries.
- get(key)¶
- read(filename=None)¶
passing filename will override the filename passed to init.
save the lines into self._lines and the key/value pairs into self.info
- reset()¶
- set(*args)¶
- unset(*keys)¶
- write(filename=None, use_tmp=True)¶
passing filename will override the filename passed to init.
- pyanaconda.simpleconfig.find_comment(s)¶
Look for a # comment outside of a quoted string. If there are no quotes, find the last # in the string.
Parameters: s (str) – string to check for comment and quotes Returns: index of comment or None Return type: int or None Handles comments inside quotes and quotes inside quotes.
- pyanaconda.simpleconfig.quote(s, always=False)¶
If always is set it returns a quoted value
- pyanaconda.simpleconfig.unquote(s)¶
pyanaconda.startup_utils module¶
- pyanaconda.startup_utils.get_anaconda_version_string()¶
Return a string describing current Anaconda version. If the current version can’t be determined the string “unknown” will be returned.
Returns: string describing Anaconda version Return type: str
- pyanaconda.startup_utils.module_exists(module_path)¶
Report is a given module exists in the current module import pth or not. Supports checking bot modules (“foo”) os submodules (“foo.bar.baz”)
Parameters: module_path (str) – (sub)module identifier Returns: True if (sub)module exists in path, False if not Return type: bool
pyanaconda.storage_utils module¶
UI-independent storage utility functions
- exception pyanaconda.storage_utils.LUKSDeviceWithoutKeyError¶
- exception pyanaconda.storage_utils.SanityError¶
- exception pyanaconda.storage_utils.SanityException¶
Bases: builtins.Exception
- exception pyanaconda.storage_utils.SanityWarning¶
- class pyanaconda.storage_utils.UIStorageFilter(name='')¶
Bases: logging.Filter
Logging filter for UI storage events
Initialize a filter.
Initialize with the name of the logger which, together with its children, will have its events allowed through the filter. If no name is specified, allow every event.
- filter(record)¶
- pyanaconda.storage_utils.bound_size(size, device, old_size)¶
Returns a size bounded by the maximum and minimum size for the device.
Parameters: - size (blivet.size.Size) – the candidate size
- device (blivet.devices.StorageDevice) – the device being displayed
- old_size (blivet.size.Size) – the fallback size
Returns: a size to which to set the device
Return type: blivet.size.Size
If size is 0, interpreted as set size to maximum possible. If no maximum size is available, reset size to old_size, but log a warning.
- pyanaconda.storage_utils.device_type_from_autopart(autopart_type)¶
Get device type matching the given autopart type.
- pyanaconda.storage_utils.sanity_check(storage, min_ram=320)¶
Run a series of tests to verify the storage configuration.
This function is called at the end of partitioning so that we can make sure you don’t have anything silly (like no /, a really small /, etc).
Parameters: - storage – an instance of the blivet.Blivet class to check
- min_ram – minimum RAM (in MiB) needed for the installation with swap space available
Return type: a list of SanityExceptions
Returns: a list of accumulated errors and warnings
- pyanaconda.storage_utils.size_from_input(input_str, units=None)¶
Get a Size object from an input string.
Parameters: - input_str (str) – a string forming some representation of a size
- units (str or NoneType) – use these units if none specified in input_str
Returns: a Size object corresponding to input_str
Return type: blivet.size.Size or NoneType
Units default to bytes if no units in input_str or units.
- pyanaconda.storage_utils.ui_storage_logger()¶
Context manager that applies the UIStorageFilter for its block
- pyanaconda.storage_utils.verify_LUKS_devices_have_key(storage)¶
Verify that all non-existant LUKS devices have some way of obtaining a key.
Note: LUKS device creation will fail without a key.
Return type: generator of str Returns: a generator of error messages, may yield no error messages
pyanaconda.text module¶
pyanaconda.threads module¶
- class pyanaconda.threads.AnacondaThread(*args, **kwargs)¶
Bases: threading.Thread
A threading.Thread subclass that exists only for a couple purposes:
- Make exceptions that happen in a thread invoke our exception handling code as well. Otherwise, threads will silently die and we are doing a lot of complicated code in them now.
- Remove themselves from the thread manager when completed.
- All created threads are made daemonic, which means anaconda will quit when the main process is killed.
- run(*args, **kwargs)¶
- class pyanaconda.threads.ThreadManager¶
Bases: builtins.object
A singleton class for managing threads and processes.
Notes: THE INSTANCE HAS TO BE CREATED IN THE MAIN THREAD!
This manager makes one assumption that contradicts python’s threading module documentation. In this class, we assume that thread names are unique and meaningful. This is an okay assumption for us to make given that anaconda is only ever going to have a handful of special purpose threads.
- add(obj)¶
Given a Thread or Process object, add it to the list of known objects and start it. It is assumed that obj.name is unique and descriptive.
- any_errors¶
Return True of there have been any errors in any threads
- exists(name)¶
Determine if a thread or process exists with the given name.
- get(name)¶
Given an object name, see if it exists and return the object. Return None if no such object exists. Additionally, this method will re-raise any uncaught exception in the thread.
- get_error(name)¶
Get the error data for a thread using its name
- in_main_thread()¶
Return True if it is run in the main thread.
- names¶
Return the names of the running threads.
Returns: list of thread names Return type: list of strings
- raise_if_error(name)¶
If a thread has failed due to an exception, raise it into the main thread and remove it from errors.
- remove(name)¶
Removes a thread from the list of known objects. This should only be called when a thread exits, or there will be no way to get a handle on it.
- running¶
Return the number of running threads.
Returns: number of running threads Return type: int
- set_error(name, *exc_info)¶
Set the error data for a thread
The exception data is expected to be the tuple from sys.exc_info()
- wait(name)¶
Wait for the thread to exit and if the thread exited with an error re-raise it here.
- wait_all()¶
Wait for all threads to exit and if there was an error re-raise it.
- wait_for_error_threads()¶
Waits for all threads that caused exceptions. In other words, waits for exception handling (possibly interactive) to be finished.
- pyanaconda.threads.initThreading()¶
Set up threading for anaconda’s use. This method must be called before any GTK or threading code is called, or else threads will only run when an event is triggered in the GTK main loop. And IT HAS TO BE CALLED IN THE MAIN THREAD.
pyanaconda.timezone module¶
Module providing functions for getting the list of timezones, writing timezone configuration, valid timezones recognition etc.
- exception pyanaconda.timezone.TimezoneConfigError¶
Bases: builtins.Exception
Exception class for timezone configuration related problems
- pyanaconda.timezone.get_all_regions_and_timezones()¶
Get a dictionary mapping the regions to the list of their timezones.
Return type: dict
- pyanaconda.timezone.get_preferred_timezone(territory)¶
Get the preferred timezone for a given territory. Note that this function simply returns the first timezone in the list of timezones for a given territory.
Parameters: territory (str) – territory to get preferred timezone for Returns: preferred timezone for the given territory or None if no found Return type: str or None
- pyanaconda.timezone.get_timezone(timezone)¶
Return a tzinfo object for a given timezone name.
Parameters: timezone (str) – the timezone name Return type: datetime.tzinfo
- pyanaconda.timezone.is_valid_timezone(timezone)¶
Check if a given string is an existing timezone.
Return type: bool
- pyanaconda.timezone.save_hw_clock(timezone)¶
Save system time to HW clock.
Parameters: timezone – ksdata.timezone object
- pyanaconda.timezone.time_initialize(timezone, storage, bootloader)¶
Try to guess if RTC uses UTC time or not, set timezone.isUtc properly and set system time from RTC using the UTC guess. Guess is done by searching for bootable ntfs devices.
Parameters: - timezone – ksdata.timezone object
- storage – blivet.Blivet instance
- bootloader – bootloader.Bootloader instance
- pyanaconda.timezone.write_timezone_config(timezone, root)¶
Write timezone configuration for the system specified by root.
Parameters: - timezone – ksdata.timezone object
- root – path to the root
Raise: TimezoneConfigError
pyanaconda.users module¶
- class pyanaconda.users.Users¶
Bases: builtins.object
- checkUserExists(username, root=None)¶
- createGroup(group_name, **kwargs)¶
Create a new user on the system with the given name. Optional kwargs:
- gid – The GID for the new user. If none is given, the next
- available one is used.
- root – The directory of the system to create the new user
- in. homedir will be interpreted relative to this. Defaults to /mnt/sysimage.
- createUser(user_name, *args, **kwargs)¶
Create a new user on the system with the given name. Optional kwargs:
- algo – The password algorithm to use in case isCrypted=True.
- If none is given, the cryptPassword default is used.
- gecos – The GECOS information (full name, office, phone, etc.).
- Defaults to “”.
- groups – A list of existing group names the user should be
- added to. Defaults to [].
- homedir – The home directory for the new user. Defaults to
- /home/<name>.
- isCrypted – Is the password kwargs already encrypted? Defaults
- to False.
- lock – Is the new account locked by default? Defaults to
- False.
- password – The password. See isCrypted for how this is interpreted.
- If the password is “” then the account is created with a blank password. If None or False the account will be left in its initial state (locked)
- root – The directory of the system to create the new user
- in. homedir will be interpreted relative to this. Defaults to /mnt/sysimage.
- shell – The shell for the new user. If none is given, the
- libuser default is used.
- uid – The UID for the new user. If none is given, the next
- available one is used.
- gid – The GID for the new user. If none is given, the next
- available one is used.
- setRootPassword(password, isCrypted=False, isLocked=False, algo=None)¶
- setUserPassword(username, password, isCrypted, lock, algo=None)¶
- setUserSshKey(username, key, **kwargs)¶
- pyanaconda.users.createLuserConf(instPath, algoname='sha512')¶
Writes a libuser.conf for instPath.
This must be called before User() is instantiated the first time so that libuser.admin will use the temporary config file.
- pyanaconda.users.cryptPassword(password, algo=None)¶
- pyanaconda.users.getPassAlgo(authconfigStr)¶
Reads the auth string and returns a string indicating our desired password encoding algorithm.
- pyanaconda.users.guess_username(fullname)¶
- pyanaconda.users.validatePassword(pw, user='root', settings=None, minlen=None)¶
Check the quality of a password.
This function does three things: given a password and an optional username, it will tell if this password can be used at all, how strong the password is on a scale of 1-100, and, if the password is unusable, why it is unusuable.
This function uses libpwquality to check the password strength. pwquality will raise a PWQError on a weak password, which, honestly, is kind of dumb behavior. A weak password isn’t exceptional, it’s what we’re asking about! Anyway, this function does not raise PWQError. If the password fails the PWQSettings conditions, the first member of the return tuple will be False and the second member of the tuple will be 0.
Parameters: - pw (string) – the password to check
- user (string) – the username for which the password is being set. If no username is provided, “root” will be used. Use user=None to disable the username check.
- settings (pwquality.PWQSettings) – an optional PWQSettings object
- minlen (int) – Minimum acceptable password length. If not passed, use the default length from PASSWORD_MIN_LEN
Returns: A tuple containing (bool(valid), int(score), str(message))
Return type: tuple
pyanaconda.version module¶
pyanaconda.vnc module¶
- class pyanaconda.vnc.VncServer(root='/', ip=None, name=None, password='', vncconnecthost='', vncconnectport='', log_file='/tmp/vncserver.log', pw_file='/tmp/vncpassword')¶
Bases: builtins.object
- VNCListen()¶
Put the server in listening mode.
We dont really have to do anything for the server to listen :)
- changeVNCPasswdWindow()¶
Change the password to a sane parameter.
We ask user to input a password that (len(password) > 6 and len(password) <= 8) or password == ‘’.
- connectToView()¶
Attempt to connect to self.vncconnecthost
- initialize()¶
Here is were all the relative vars get initialized.
- openlogfile()¶
- setVNCPassword()¶
Set the vnc server password. Output to file.
- startServer()¶
- startVncConfig()¶
Attempt to start vncconfig
- pyanaconda.vnc.shutdownServer()¶
Try to shutdown any running XVNC server
Why is this function on the module level and not in the VncServer class ?
As the server needs to be killed from the exit handler, it would have to somehow get to the VncServer instance. Like this, it can just kill it by calling a function of the vnc module.