7.1.7.1.4. cobbler.modules.managers package

7.1.7.1.4.1. Submodules

7.1.7.1.4.2. cobbler.modules.managers.bind module

This is some of the code behind ‘cobbler sync’.

class cobbler.modules.managers.bind.MetadataZoneHelper(forward_zones: List[str], reverse_zones: List[Tuple[str, str]], zone_include: str)[source]

Bases: object

Helper class to hold data for template rendering of named config files.

cobbler.modules.managers.bind.get_manager(api: CobblerAPI) _BindManager[source]

This returns the object to manage a BIND server located locally on the Cobbler server.

Parameters:

api – The API to resolve all information with.

Returns:

The BindManger object to manage bind with.

cobbler.modules.managers.bind.register() str[source]

The mandatory Cobbler module registration hook.

7.1.7.1.4.3. cobbler.modules.managers.dnsmasq module

This is some of the code behind ‘cobbler sync’.

cobbler.modules.managers.dnsmasq.get_manager(api: CobblerAPI) _DnsmasqManager[source]

Creates a manager object to manage a dnsmasq server.

Parameters:

api – The API to resolve all information with.

Returns:

The object generated from the class.

cobbler.modules.managers.dnsmasq.register() str[source]

The mandatory Cobbler modules registration hook.

Returns:

Always “manage”.

7.1.7.1.4.4. cobbler.modules.managers.genders module

Cobbler Module that manages the cluster configuration tool from CHAOS. For more information please see: GitHub - chaos/genders

cobbler.modules.managers.genders.register() str[source]

We should run anytime something inside of Cobbler changes.

Returns:

Always /var/lib/cobbler/triggers/change/*

cobbler.modules.managers.genders.run(api: CobblerAPI, args: Any) int[source]

Mandatory Cobbler trigger hook.

Parameters:
  • api – The api to resolve information with.

  • args – For this implementation unused.

Returns:

0 or 1, depending on the outcome of the operation.

cobbler.modules.managers.genders.write_genders_file(config: CobblerAPI, profiles_genders: Dict[str, str], distros_genders: Dict[str, str], mgmtcls_genders: Dict[str, str])[source]

Genders file is over-written when manage_genders is set in our settings.

Parameters:
  • config – The API instance to template the data with.

  • profiles_genders – The profiles which should be included.

  • distros_genders – The distros which should be included.

  • mgmtcls_genders – The management classes which should be included.

Raises:

OSError – Raised in case the template could not be read.

7.1.7.1.4.5. cobbler.modules.managers.import_signatures module

7.1.7.1.4.6. cobbler.modules.managers.in_tftpd module

This is some of the code behind ‘cobbler sync’.

cobbler.modules.managers.in_tftpd.get_manager(api: CobblerAPI) _InTftpdManager[source]

Creates a manager object to manage an in_tftp server.

Parameters:

api – The API which holds all information in the current Cobbler instance.

Returns:

The object to manage the server with.

cobbler.modules.managers.in_tftpd.register() str[source]

The mandatory Cobbler module registration hook.

7.1.7.1.4.7. cobbler.modules.managers.isc module

This is some of the code behind ‘cobbler sync’.

cobbler.modules.managers.isc.get_manager(api: CobblerAPI) _IscManager[source]

Creates a manager object to manage an isc dhcp server.

Parameters:

api – The API which holds all information in the current Cobbler instance.

Returns:

The object to manage the server with.

cobbler.modules.managers.isc.register() str[source]

The mandatory Cobbler module registration hook.

7.1.7.1.4.8. cobbler.modules.managers.ndjbdns module

This is some of the code behind ‘cobbler sync’.

cobbler.modules.managers.ndjbdns.get_manager(api: CobblerAPI) _NDjbDnsManager[source]

Creates a manager object to manage an isc dhcp server.

Parameters:

api – The API which holds all information in the current Cobbler instance.

Returns:

The object to manage the server with.

cobbler.modules.managers.ndjbdns.register() str[source]

The mandatory Cobbler module registration hook.

7.1.7.1.4.9. Module contents

This module contains extensions for services Cobbler is managing. The services are restarted via the service command or alternatively through the server executables directly. Cobbler does not announce the restarts but is expecting to be allowed to do this on its own at any given time. Thus all services managed by Cobbler should not be touched by any other tool or administrator.

class cobbler.modules.managers.DhcpManagerModule(api: CobblerAPI)[source]

Bases: ManagerModule

Abstract base class for DHCP manager modules.

Defines the interface for DHCP-specific service management in Cobbler.

abstractmethod sync_dhcp() None[source]

Synchronize DHCP configuration and restart the DHCP service.

This method should be implemented by subclasses to write DHCP-specific configuration files and ensure the DHCP service is restarted to apply changes.

class cobbler.modules.managers.DnsManagerModule(api: CobblerAPI)[source]

Bases: ManagerModule

Abstract base class for DNS manager modules.

Defines the interface for DNS-specific service management in Cobbler.

add_single_hosts_entry(system: System) None[source]

This method adds a single system to the host file. DNS manager modules can implement this method to improve performance. Otherwise, this method defaults to a full host regeneration.

Parameters:

system – A system to be added.

abstractmethod regen_hosts() None[source]

Regenerate the hosts file for all managed systems.

This method should be implemented by subclasses to update the hosts file based on the current state of managed systems.

remove_single_hosts_entry(system: System) None[source]

This method removes a single system from the host file. DNS manager modules can implement this method to improve performance. Otherwise, this method defaults to a full host regeneration.

Parameters:

system – A system to be removed.

class cobbler.modules.managers.ManagerModule(api: CobblerAPI)[source]

Bases: object

Base class for Manager modules located in modules/manager/*.py

These are typically but not necessarily used to manage systemd services. Enabling can be done via settings manage_* (e.g. manage_dhcp) and restart_* (e.g. restart_dhcp). Different modules could manage the same functionality as dhcp can be managed via isc.py or dnsmasq.py (compare with /etc/cobbler/modules.py).

regen_ethers() None[source]

ISC/BIND doesn’t use this. It is there for compatibility reasons with other managers.

remove_single_system(system_obj: System) None[source]

This method removes a single system.

restart_service() int[source]

Write module specific config files. E.g. dhcp manager would write /etc/dhcpd.conf here

sync() int[source]

This syncs the manager’s server (systemd service) with it’s new config files. Basically this restarts the service to apply the changes.

Returns:

Integer return value of restart_service - 0 on success

sync_single_system(system: System) int[source]

This synchronizes data for a single system. The default implementation is to trigger full synchronization. Manager modules can overwrite this method to improve performance.

Parameters:

system – A system to be added.

static what() str[source]

Static method to identify the manager module. Must be overwritten by the inheriting class

write_configs() None[source]

Write module specific config files. E.g. dhcp manager would write /etc/dhcpd.conf here

class cobbler.modules.managers.TftpManagerModule(api: CobblerAPI)[source]

Bases: ManagerModule

Abstract base class for TFTP manager modules.

Defines the interface for TFTP-specific service management in Cobbler.

abstractmethod add_single_distro(distro: Distro) None[source]

Add a single distribution to the TFTP configuration.

This method should be implemented by subclasses to update TFTP boot files and configuration for the specified distribution.

Parameters:

distro – The distribution object to add.

abstractmethod sync_systems(systems: List[str], verbose: bool = True) None[source]

Synchronize TFTP configuration for the specified systems.

This method should be implemented by subclasses to update TFTP boot files and configuration for the given list of systems.

Parameters:
  • systems – List of system identifiers to synchronize.

  • verbose – If True, provide detailed output during synchronization.

abstractmethod write_boot_files() int[source]

Write all necessary TFTP boot files for managed systems.

This method should be implemented by subclasses to generate and write boot files required for network booting.

Returns:

Integer status code (0 for success, non-zero for failure).