libioc.Config.Jail.File.Fstab module¶
Manage fstab files.
-
class
libioc.Config.Jail.File.Fstab.Fstab(logger=None, host=None, file='/etc/fstab')[source]¶ Bases:
collections.abc.MutableSequenceFstab configuration file wrapper.
This object allows to read, programatically edit and write fstab files. Bound to an iocage resource, the location of the /etc/fstab file is relative to the resource’s root_dataset <resource>/root.
-
AUTO_COMMENT_IDENTIFIER= 'iocage-auto'¶
-
add_line(line, skip_existing=False, replace=False, auto_create_destination=False, auto_mount_jail=True)[source]¶ Directly append a FstabLine type.
Use save() to write changes to the fstab file.
- Return type
Union[FstabLine,FstabCommentLine,FstabAutoPlaceholderLine]
-
index(line, start=None, end=None)[source]¶ Find the index position of a FstabLine in the Fstab instance.
- Return type
int
-
insert(index, value)[source]¶ Insert a line at a given position.
- Parameters
index (
int) – The numeric line insertion positionvalue (
Union[FstabLine,FstabCommentLine,FstabAutoPlaceholderLine]) – A FstabLine, Comment or Placeholder
- Return type
None
-
new_line(source, destination, type='nullfs', options='ro', freq=0, passno=0, comment=None, replace=False, auto_create_destination=False, auto_mount_jail=True)[source]¶ Append a new line to the fstab file.
Use save() to write changes to the fstab file.
- Return type
Union[FstabLine,FstabCommentLine,FstabAutoPlaceholderLine]
-
parse_lines(input_text, ignore_auto_created=True, skip_destinations=[])[source]¶ Parse the content of a fstab file.
- Parameters
input_text (
str) – The text content of an existing fstab fileignore_auto_created (
bool) – Skips reading entries that were created by iocageexclude_destinations – List of destination strings that is skipped
- Return type
None
-
property
path¶ Absolute fstab file path.
This is the file read from and written to.
- Return type
str
-
-
class
libioc.Config.Jail.File.Fstab.FstabAutoPlaceholderLine(data={})[source]¶ Bases:
dictA placeholder for auto-created fstab lines.
-
class
libioc.Config.Jail.File.Fstab.FstabBasejailLine(data)[source]¶ Bases:
libioc.Config.Jail.File.Fstab.FstabLineModel a fstab line automatically created by a NullFS basejail.
-
class
libioc.Config.Jail.File.Fstab.FstabCommentLine(data)[source]¶ Bases:
dictModel a fstab comment line (beginning with #).
-
class
libioc.Config.Jail.File.Fstab.FstabFsSpec(sequence)[source]¶ Bases:
libioc.Types.AbsolutePathEnforces an AbsolutePath or special device name.
-
PATTERN= re.compile('^[A-Za-z][A-Za-z0-9]*$')¶
-
-
class
libioc.Config.Jail.File.Fstab.FstabLine(data)[source]¶ Bases:
dictModel a line of an fstab file.
-
class
libioc.Config.Jail.File.Fstab.FstabMaintenanceLine(data)[source]¶ Bases:
libioc.Config.Jail.File.Fstab.FstabLineModel a fstab line automatically created for jail launch scripts.
-
class
libioc.Config.Jail.File.Fstab.JailFstab(jail, logger=None, host=None, file='fstab')[source]¶ Bases:
libioc.Config.Jail.File.Fstab.FstabFstab file abstraction of a Jails fstab file.
The jails fstab file is stored in its main dataset.
-
add_line(line, skip_existing=False, replace=False, auto_create_destination=False, auto_mount_jail=True)[source]¶ Directly append a FstabLine type.
Use save() to write changes to the fstab file.
- Return type
Union[FstabLine,FstabCommentLine,FstabAutoPlaceholderLine]
-
mount(event_scope=None)[source]¶ Mount all fstab entries to the jail.
- Return type
Generator[MountFstab,None,None]
-
parse_lines(input_text, ignore_auto_created=True, skip_destinations=[])[source]¶ Parse the content of a fstab file.
- Parameters
input_text (
str) – The text content of an existing fstab fileignore_auto_created (
bool) – Skips reading entries that were created by iocageexclude_destinations – List of destination strings that is skipped
- Return type
None
-
property
path¶ Absolute fstab file path.
This is the file read from and written to.
When the path begins with a / it is assumed to be absolute, so that the jails dataset mountpoint is not used as path prefix. This is useful when moving around jail backups.
- Return type
str
-
unmount(event_scope=None)[source]¶ Unmount all fstab entries from the jail.
- Return type
Generator[MountFstab,None,None]
-