nrvr.distros.common.kickstart
index
/usr/lib/python2.7/site-packages/nrvr/distros/common/kickstart.py

nrvr.distros.common.kickstart - Create and manipulate Linux distribution kickstart files
 
Classes provided by this module include
DistroIsoImage
KickstartFileSection
DistroKickstartFileContent
 
To be improved as needed.
 
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
 
Contributor - Nora Baschy
 
Public repository - https://github.com/srguiwiz/nrvr-commander
 
Copyright (c) Nirvana Research 2006-2015.
Simplified BSD License

 
Modules
       
nrvr
re

 
Classes
       
__builtin__.object
DistroKickstartFileContent
KickstartFileSection
nrvr.diskimage.isoimage.IsoImage(__builtin__.object)
DistroIsoImage

 
class DistroIsoImage(nrvr.diskimage.isoimage.IsoImage)
    A Linux distribution .iso ISO CD-ROM or DVD-ROM disk image.
 
 
Method resolution order:
DistroIsoImage
nrvr.diskimage.isoimage.IsoImage
__builtin__.object

Methods defined here:
__init__(self, isoImagePath)
Create new Linux distribution DistroIsoImage descriptor.
 
A descriptor can describe an .iso image that does or doesn't yet exist on the host disk.
cloneWithAutoBootingKickstart(self, _kickstartFileContent, modifications=[], cloneIsoImagePath=None, ignoreJoliet=True)
Clone with kickstart file added and modified to automatically boot with it.
 
For more on behavior see documentation of class IsoImage method cloneWithModifications.
 
For details of modifications see method modificationsIncludingKickstartFile,
which is expected to be different per distro specific subclass.
 
_kickstartFileContent
    A DistroKickstartFileContent object.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
genisoimageOptions(self, bootImage='isolinux/isolinux.bin', bootCatalog='isolinux/boot.cat', label=None, udf=False, ignoreJoliet=True)
Auxiliary method, called by cloneWithModifications.
 
As implemented calls superclass method genisoimageOptions and extends the returned list.
 
Could be improved in the future.
Could be overridden for a subclass.
modificationsIncludingKickstartFile(self, _kickstartFileContent)
Construct and return a list of modifications to be passed to method cloneWithModifications.
 
This method is called by method cloneWithAutoBootingKickstart, which takes the returned list
and passes it to method cloneWithModifications.
 
Subclasses should provide substantial implementations of this method.
Expected to be different per distro specific subclass.
This class implementation only returns an empty list [].
 
_kickstartFileContent
    A DistroKickstartFileContent object.
 
Return a list of modifications which will be passed to method cloneWithModifications.

Methods inherited from nrvr.diskimage.isoimage.IsoImage:
cloneWithModifications(self, modifications=[], cloneIsoImagePath=None, udf=False, ignoreJoliet=True, pause=False)
Clone with any number of instances of IsoImageModification applied.
 
A temporary assembly directory in the same directory as cloneIsoImagePath needs disk space,
but it is removed automatically upon completion of cloning.
 
modifications
    a list of IsoImageModification instances.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
cloneWithModificationsUsingMount(self, modifications=[], cloneIsoImagePath=None, udf=False, ignoreJoliet=True, pause=False)
Clone with any number of instances of IsoImageModification applied.
 
This is an older implementation which regrettably because of the mount command requires
having superuser privileges.
It is still here in case a newer implementation doesn't work right, which could be for any
of a number of reasons, for example for symbolic links.
 
A temporary assembly directory in the same directory as cloneIsoImagePath needs disk space,
but it is removed automatically upon completion of cloning.
 
modifications
    a list of IsoImageModification instances.
 
cloneIsoImagePath
    if not given then in same directory with a timestamp in the filename.
 
return
    IsoImage(cloneIsoImagePath).
copyToDirectory(self, copyDirectory, udf=False, ignoreJoliet=True, tolerance=0.0)
Copy all files into a directory.
 
Not using mount command, no need to run as root.
exists(self)
Return True if .iso image exists on the host disk.
mount(self, mountDir, udf=False)
Mount .iso image.
remove(self)
Remove (delete) .iso image from the host disk.
unmount(self)
Unmount .iso image.

Class methods inherited from nrvr.diskimage.isoimage.IsoImage:
commandsUsedInImplementation(cls) from __builtin__.type
Return a list to be passed to SystemRequirements.commandsRequired().
 
This class can be passed to SystemRequirements.commandsRequiredByImplementations().

Data descriptors inherited from nrvr.diskimage.isoimage.IsoImage:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
isoImagePath
Path of the .iso image.

 
class DistroKickstartFileContent(__builtin__.object)
    The text content of an Anaconda kickstart file for use with a Linux distribution.
 
  Methods defined here:
__init__(self, string)
Create new kickstart file content container.
 
Documentation is at http://fedoraproject.org/wiki/Anaconda/Kickstart .
 
Documentation apparently says a kickstart file is an ASCII file.
 
Nevertheless, this constructor does unicode(string), as befits the 21st century.
Just don't put anything into it that is not in the ASCII range.
addPackage(self, package)
Add package or package group to %packages section.
 
return
    self, for daisychaining.
removeAllPackages(self)
Remove all packages and package groups from %packages section.
 
return
    self, for daisychaining.
removePackage(self, package)
Remove package or package group from %packages section.
 
return
    self, for daisychaining.
replaceAllPackages(self, packages)
Replace all packages and package groups in %packages section.
 
packages
    a list of packages and package groups.
 
return
    self, for daisychaining.
replaceLang(self, lang)
Replace lang option.
 
lang
    e.g. "de_DE.UTF-8" to replace "en_US.UTF-8".
    
    As implemented does not do any sanity checking.
 
return
    self, for daisychaining.
replaceRootpw(self, pwd)
Replace rootpw option.
 
pwd
    pwd will be encrypted.  If starting with $ it is assumed to be encrypted already.
 
return
    self, for daisychaining.
sectionByName(self, name)
Return section by name.
 
Return a KickstartFileSection, or None.
 
Setting a returned KickstartFileSection's string modifies the DistroKickstartFileContent.
 
If more than one section with same name returns first.
sectionsByName(self, name)
Return sections by name.
 
Return a list of KickstartFileSection, or empty list [].
 
Setting a returned KickstartFileSection's string modifies the DistroKickstartFileContent.
setSwappiness(self, swappiness)
Set swappiness.
 
swappiness
    an int between 0 and 100.
 
return
    self, for daisychaining.

Class methods defined here:
cryptedPwd(cls, plainPwd) from __builtin__.type
Encrypt in a format acceptable for kickstart.
parseIntoSections(cls, whole) from __builtin__.type
Return sections as list of KickstartFileSection objects.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
sections
string
The whole content.
 
As implemented this is dynamically built, but it is
for the sake of correctness and maintainability.

Data and other attributes defined here:
firstWordOfLineRegex = <_sre.SRE_Pattern object>

 
class KickstartFileSection(__builtin__.object)
    The name and text content of a section of an Anaconda kickstart file for use with a Linux distribution.
 
  Methods defined here:
__init__(self, name, string)
Create new kickstart file content section container.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)
string
Getter.