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

nrvr.distros.el.kickstart - Create and manipulate Enterprise Linux kickstart files
 
Classes provided by this module include
ElIsoImage
ElKickstartFileContent
 
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
       
nrvr.distros.common.kickstart.DistroIsoImage(nrvr.diskimage.isoimage.IsoImage)
ElIsoImage
nrvr.distros.common.kickstart.DistroKickstartFileContent(__builtin__.object)
ElKickstartFileContent

 
class ElIsoImage(nrvr.distros.common.kickstart.DistroIsoImage)
    An Enterprise Linux .iso ISO CD-ROM or DVD-ROM disk image.
 
 
Method resolution order:
ElIsoImage
nrvr.distros.common.kickstart.DistroIsoImage
nrvr.diskimage.isoimage.IsoImage
__builtin__.object

Methods defined here:
__init__(self, isoImagePath)
Create new Enterprise Linux ElIsoImage descriptor.
 
A descriptor can describe an .iso image that does or doesn't yet exist on the host disk.
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.
 
As implemented known to support Scientific Linux 6.1 and 6.4.
As implemented tested for i386 and x86_64.
Good chance it will work with other brand Enterprise Linux distributions.
Good chance it will work with newer versions distributions.
 
_kickstartFileContent
    An ElKickstartFileContent object.
 
Return a list of modifications which will be passed to method cloneWithModifications.

Methods inherited from nrvr.distros.common.kickstart.DistroIsoImage:
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.

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 ElKickstartFileContent(nrvr.distros.common.kickstart.DistroKickstartFileContent)
    The text content of an Anaconda kickstart file for Enterprise Linux.
 
 
Method resolution order:
ElKickstartFileContent
nrvr.distros.common.kickstart.DistroKickstartFileContent
__builtin__.object

Methods defined here:
__init__(self, string)
Create new kickstart file content container.
elActivateGraphicalLogin(self)
Boot into graphical login on the installed system.
 
Do not use in a kickstart that does not install the X Window System.
 
return
    self, for daisychaining.
elAddNetworkConfigurationWithDhcp(self, device)
Add an additional network device with DHCP.
 
device
    a string, e.g. "eth1".
    
    Should be increased past "eth1" if adding more than one additional configuration.
    
    Pre-existing network configurations are moved up by one device each, if there would be a conflict.
    E.g. adding for "eth0" when for "eth0" already exists causes the pre-existing for "eth0" to become for "eth1".
 
return
    self, for daisychaining.
elAddUser(self, username, pwd=None)
Add user.
 
username
    username to add.
 
pwd
    pwd will be encrypted.  If starting with $ it is assumed to be encrypted already.
 
return
    self, for daisychaining.
elReplaceHostname(self, hostname)
Replace hostname option in network option.
 
hostname
    new hostname.
 
return
    self, for daisychaining.
elReplaceStaticIP(self, ipaddress, netmask='255.255.255.0', gateway=None, nameservers=None)
Replace static IP options in network option.
 
As implemented only supports IPv4.
 
ipaddress
    IP address.
 
netmask
    netmask.
    Defaults to 255.255.255.0.
 
gateway
    gateway.
    If None then default to ip.1.
 
nameservers
    one nameserver or a list of nameservers.
    If None then default to gateway.
    If empty list then remove option.
 
return
    self, for daisychaining.

Methods inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
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 inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
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 inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
__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 inherited from nrvr.distros.common.kickstart.DistroKickstartFileContent:
firstWordOfLineRegex = <_sre.SRE_Pattern object>