libioc.Release module

ioc release module.

class libioc.Release.Release(name, dataset=None, dataset_name=None, config_type='auto', config_file=None, root_datasets_name=None, host=None, zfs=None, logger=None, check_hashes=True, check_eol=True)[source]

Bases: libioc.Release.ReleaseGenerator

Release with synchronous interfaces.

destroy(force=False, event_scope=None)[source]

Delete a release.

Return type

List[IocEvent]

fetch(update=False, fetch_updates=False, event_scope=None)[source]

Fetch the release from the remote synchronously.

Return type

List[IocEvent]

class libioc.Release.ReleaseGenerator(name, dataset=None, dataset_name=None, config_type='auto', config_file=None, root_datasets_name=None, host=None, zfs=None, logger=None, check_hashes=True, check_eol=True)[source]

Bases: libioc.Release.ReleaseResource

Release with generator interfaces.

DEFAULT_PERIODIC_CONF = {'daily_clean_hoststat_enable': False, 'daily_status_include_submit_mailq': False, 'daily_status_mail_rejects_enable': False, 'daily_submit_queuerun': False}
DEFAULT_RC_CONF = {'cron_flags': "-m ''", 'netif_enable': False, 'sendmail_enable': False, 'sendmail_msp_queue_enable': False, 'sendmail_outbound_enable': False, 'sendmail_submit_enable': False, 'syslogd_flags': '-ss'}
DEFAULT_SYSCTL_CONF = {'net.inet.ip.fw.enable': 0}
property annotated_name

Return the release name with annotations.

Annotations inform whether a release is newer then the host or EOL.

Return type

str

property assets

Return a list of release assets.

Return type

List[str]

property available

Return True if the release is available on the remote mirror.

Return type

bool

property current_snapshot

Return the manually configured or the latest release snapshot.

Return type

ZFSSnapshot

property current_snapshot_patchlevel

Return the currently chosen patchlevel number or the latest.

Return type

int

destroy(force=False, event_scope=None)[source]

Delete a release.

Return type

Generator[IocEvent, None, None]

property download_directory

Return the download directory.

Return type

str

property eol

Return whether the release is EOL or checks are disabled.

When check_eol is disabled, None is returned, True when the release name was found in the distributions eol_list.

Return type

Optional[bool]

fetch(update=False, fetch_updates=False, event_scope=None, update_base=None)[source]

Fetch the release from the remote.

Parameters
  • update (bool) –

    (default=False)

    When enabled, updates are applied to the release, unless fetching updates was without success.

  • fetch_updates (bool) –

    (default=False)

    When enabled, updates are fetched. Disabling this option has no impact on applying updates.

  • event_scope (libioc.events.Scope) –

    (optional)

    Pass on the IocEvent stack for use in higher order functions.

  • update_base (bool) –

    (optional)

    When unset, the sysrc config ioc_legacy_support is taken into account to determine whether ZFS basejail datasets should be updated in case the release was created or modified. Those ZFS basejail datasets are required to start basejails created with iocage_legacy. A boolean value overrides the configuration from /etc/rc.conf.

Return type

Generator[IocEvent, None, None]

property fetched

Return True if the release is fetched locally.

Return type

bool

property full_name

Return the release name including the patchlevel.

Return type

str

property hashes

Return the releases asset hashes.

Return type

Dict[str, str]

property hbds_release_branch

Translate the release into a HardenedBSD release git branch name.

Return type

str

property latest_snapshot

Return or create the latest version snapshot.

When no snapshot was taken before p0 is automatically created.

Return type

ZFSSnapshot

property mirror_url

Return the distributions release mirror URL.

Return type

str

property name

Return the releases identifier.

Return type

str

property newer_than_host

Return True if the release is newer than the host.

Return type

bool

read_hashes()[source]

Read the release asset hashes.

Return type

Dict[str, str]

property real_name

Map the release name on HardenedBSD.

Return type

str

property releases_folder

Return the mountpoint of the iocage/releases dataset.

Return type

str

property remote_url

Return the releases full mirror URL.

Return type

str

property resource

Return the releases resource.

Return type

Resource

property root_dir

Return the main directory of the release.

Return type

str

snapshot(identifier, force=False)[source]

Create a ZFS snapshot of the release.

Parameters
  • identifier (str) – This string specifies the snapshots name

  • force (bool) – (default=False) Enabling this option forces re-creation of a snapshot in case it already exists for the given identifier

Returns

The ZFS snapshot object found or created

Return type

libzfs.ZFSSnapshot

update_base_release()[source]

Update the ZFS basejail release dataset.

Return type

None

property version_number

Return the numeric release version number or 0 for CURRENT.

Return type

float

property version_snapshots

Return the sorted list of taken version snapshots (e.g. p3).

Return type

List[ZFSSnapshot]

property zfs_pool

Return the releases ZFS pool.

Return type

ZFSPool

class libioc.Release.ReleaseResource(dataset=None, dataset_name=None, config_type='auto', config_file=None, logger=None, zfs=None, host=None, release=None, root_datasets_name=None)[source]

Bases: libioc.LaunchableResource.LaunchableResource

Resource that represents an iocage release.

property base_dataset

Return the ZFS basejail dataset belonging to the release.

base datasets are created from releases. They are required to start zfs-basejails.

Return type

ZFSDataset

property base_dataset_name

Return the ZFS basejail datasets name belonging to the release.

Return type

str

property dataset_name

Return the name of the releases ZFS dataset.

If the resource has no dataset or dataset_name assigned yet, the release id is used to find name the dataset

Return type

str

property full_name

Return the full identifier of a jail.

When more than one root dataset is managed by iocage, the full source and name are returned. Otherwise just the name.

For example mydataset/jailname or just jailname.

Return type

str

property release

Return the release instance that belongs to the resource.

Usually the resource becomes inherited from the Release itself. It can still be used linked to a foreign ReleaseGenerator by passing release as named attribute to the __init__ function

Return type

ReleaseGenerator

property source

Return the name of the releases source root datasets.

Return type

str

property source_dataset

Return the releases source root dataset.

iocage can manage multiple source datasets (on different ZFS pools for instance). This property returns the RootDatasets instance that belongs to the release.

Return type

RootDatasets