8.1.1. cobbler.actions package

8.1.1.1. Submodules

8.1.1.2. cobbler.actions.acl module

Configures acls for various users/groups so they can access the cobbler command line as non-root. Now that CLI is largely remoted (XMLRPC) this is largely just useful for not having to log in (access to shared-secret) file but also grants access to hand-edit various cobbler_collections files and other useful things.

class cobbler.actions.acl.AclConfig(collection_mgr, logger=None)[source]

Bases: object

modacl(isadd, isuser, who)[source]
run(adduser=None, addgroup=None, removeuser=None, removegroup=None)[source]

Automate setfacl commands

8.1.1.3. cobbler.actions.buildiso module

Builds bootable CD images that have PXE-equivalent behavior for all Cobbler distros/profiles/systems currently in memory.

class cobbler.actions.buildiso.BuildIso(collection_mgr, verbose=False, logger=None)[source]

Bases: object

Handles conversion of internal state to the isolinux tree layout

add_remaining_kopts(koptdict)[source]

Add remaining kernel_options to append_line

copy_boot_files(distro, destdir, prefix=None)[source]

Copy kernel/initrd to destdir with (optional) newfile prefix

filter_systems_or_profiles(selected_items, list_type)[source]

Return a list of valid profile or system objects selected from all profiles or systems by name, or everything if selected_items is empty

generate_netboot_iso(imagesdir, isolinuxdir, profiles=None, systems=None, exclude_dns=None)[source]

Create bootable CD image to be used for network installations

generate_standalone_iso(imagesdir, isolinuxdir, distname, filesource, airgapped, profiles)[source]

Create bootable CD image to be used for handsoff CD installtions

make_shorter(distname)[source]

Return a short distro identifier

run(iso=None, buildisodir=None, profiles=None, systems=None, distro=None, standalone=None, airgapped=None, source=None, exclude_dns=None, mkisofs_opts=None)[source]

8.1.1.4. cobbler.actions.check module

class cobbler.actions.check.CobblerCheck(collection_mgr, logger=None)[source]

Bases: object

Validates whether the system is reasonably well configured for serving up content. This is the code behind ‘cobbler check’.

check_bind_bin(status)[source]

Check if bind is installed.

check_bootloaders(status)[source]

Check if network bootloaders are installed

check_ctftpd_dir(status)[source]

Check if cobbler.conf’s tftpboot directory exists

check_debmirror(status)[source]
check_dhcpd_bin(status)[source]

Check if dhcpd is installed

check_dhcpd_conf(status)[source]

NOTE: this code only applies if cobbler is NOT set to generate a dhcp.conf file

Check that dhcpd appears to be configured for pxe booting. We can’t assure file correctness. Since a cobbler user might have dhcp on another server, it’s okay if it’s not there and/or not configured correctly according to automated scans.

check_dnsmasq_bin(status)[source]

Check if dnsmasq is installed

check_for_cman(status)[source]
check_for_default_password(status)[source]
check_for_ksvalidator(status)[source]
check_for_unreferenced_repos(status)[source]
check_for_unsynced_repos(status)[source]
check_for_wget_curl(status)[source]

Check to make sure wget or curl is installed

check_iptables(status)[source]
check_name(status)[source]

If the server name in the config file is still set to localhost automatic installations run from koan will not have proper kernel line parameters.

check_rsync_conf(status)[source]

Check that rsync is enabled to autostart

check_selinux(status)[source]

Suggests various SELinux rules changes to run Cobbler happily with SELinux in enforcing mode. FIXME: this method could use some refactoring in the future.

check_service(status, which, notes='')[source]
check_tftpd_dir(status)[source]

Check if cobbler.conf’s tftpboot directory exists

check_yum(status)[source]
run()[source]

Returns None if there are no errors, otherwise returns a list of things to correct prior to running application ‘for real’. (The CLI usage is “cobbler check” before “cobbler sync”)

8.1.1.5. cobbler.actions.dlcontent module

Downloads bootloader content for all arches for when the user doesn’t want to supply their own.

class cobbler.actions.dlcontent.ContentDownloader(collection_mgr, logger=None)[source]

Bases: object

run(force=False)[source]

Download bootloader content for all of the latest bootloaders, since the user has chosen to not supply their own. You may ask “why not get this from yum”, we also want this to be able to work on Debian and further do not want folks to have to install a cross compiler. For those that don’t like this approach they can still source their cross-arch bootloader content manually.

8.1.1.7. cobbler.actions.litesync module

Running small pieces of cobbler sync when certain actions are taken, such that we don’t need a time consuming sync when adding new systems if nothing has changed for systems that have already been created.

class cobbler.actions.litesync.CobblerLiteSync(collection_mgr, verbose=False, logger=None)[source]

Bases: object

Handles conversion of internal state to the tftpboot tree layout

add_single_distro(name)[source]
add_single_image(name)[source]
add_single_profile(name, rebuild_menu=True)[source]
add_single_system(name)[source]
remove_single_distro(name)[source]
remove_single_image(name)[source]
remove_single_profile(name, rebuild_menu=True)[source]
remove_single_system(name)[source]
update_system_netboot_status(name)[source]

8.1.1.8. cobbler.actions.log module

class cobbler.actions.log.LogTool(collection_mgr, system, api, logger=None)[source]

Bases: object

Helpers for dealing with System logs, anamon, etc..

clear()[source]

Clears the system logs

8.1.1.9. cobbler.actions.replicate module

Replicate from a cobbler master.

class cobbler.actions.replicate.Replicate(collection_mgr, logger=None)[source]

Bases: object

add_objects_not_on_local(obj_type)[source]
generate_include_map()[source]
remove_objects_not_on_master(obj_type)[source]
replace_objects_newer_on_remote(obj_type)[source]
replicate_data()[source]
rsync_it(from_path, to_path, type=None)[source]
run(cobbler_master=None, port='80', distro_patterns=None, profile_patterns=None, system_patterns=None, repo_patterns=None, image_patterns=None, mgmtclass_patterns=None, package_patterns=None, file_patterns=None, prune=False, omit_data=False, sync_all=False, use_ssl=False)[source]

Get remote profiles and distros and sync them locally

8.1.1.10. cobbler.actions.report module

Report from a cobbler master. FIXME: reinstante functionality for 2.0

class cobbler.actions.report.Report(collection_mgr, logger=None)[source]

Bases: object

fielder(structure, fields_list)[source]

Return data from a subset of fields of some item

print_formatted_data(data, order, report_type, noheaders)[source]

Used for picking the correct format to output data as

reporting_csv(info, order, noheaders)[source]

Formats data on ‘info’ for csv output

reporting_doku(info, order, noheaders)[source]

Formats data on ‘info’ for doku wiki table output

reporting_list_names2(collection, name)[source]

Prints a specific object in a collection.

reporting_mediawiki(info, order, noheaders)[source]

Formats data on ‘info’ for mediawiki table output

reporting_print_all_fields(collection, report_name, report_type, report_noheaders)[source]

Prints all fields in a collection as a table given the report type

reporting_print_sorted(collection)[source]

Prints all objects in a collection sorted by name

reporting_print_x_fields(collection, report_name, report_type, report_fields, report_noheaders)[source]

Prints specific fields in a collection as a table given the report type

reporting_sorter(a, b)[source]

Used for sorting cobbler objects for report commands

reporting_trac(info, order, noheaders)[source]

Formats data on ‘info’ for trac wiki table output

run(report_what=None, report_name=None, report_type=None, report_fields=None, report_noheaders=None)[source]

Get remote profiles and distros and sync them locally

  1. Handles original report output

  2. Handles all fields of report outputs as table given a format

  3. Handles specific fields of report outputs as table given a format

8.1.1.11. cobbler.actions.reposync module

Builds out and synchronizes yum repo mirrors. Initial support for rsync, perhaps reposync coming later.

class cobbler.actions.reposync.RepoSync(collection_mgr, tries=1, nofail=False, logger=None)[source]

Bases: object

Handles conversion of internal state to the tftpboot tree layout

apt_sync(repo)[source]

Handle copying of http:// and ftp:// debian repos.

create_local_file(dest_path, repo, output=True)[source]

Creates Yum config files for use by reposync

Two uses: (A) output=True, Create local files that can be used with yum on provisioned clients to make use of this mirror. (B) output=False, Create a temporary file for yum to feed into yum for mirroring

createrepo_walker(repo, dirname, fnames)[source]

Used to run createrepo on a copied Yum mirror.

gen_urlgrab_ssl_opts(yumopts)[source]
reposync_cmd()[source]

Determine reposync command

rhn_sync(repo)[source]

Handle mirroring of RHN repos.

rsync_sync(repo)[source]

Handle copying of rsync:// and rsync-over-ssh repos.

run(name=None, verbose=True)[source]

Syncs the current repo configuration file with the filesystem.

sync(repo)[source]

Conditionally sync a repo, based on type.

update_permissions(repo_path)[source]

Verifies that permissions and contexts after an rsync are as expected. Sending proper rsync flags should prevent the need for this, though this is largely a safeguard.

wget_sync(repo)[source]

Handle mirroring of directories using wget

yum_sync(repo)[source]

Handle copying of http:// and ftp:// yum repos.

cobbler.actions.reposync.repo_walker(top, func, arg)[source]

Directory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding ‘.’ and ‘..’), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding ‘.’ and ‘..’). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.

8.1.1.12. cobbler.actions.status module

Reports on automatic installation activity by examining the logs in /var/log/cobbler.

class cobbler.actions.status.CobblerStatusReport(collection_mgr, mode, logger=None)[source]

Bases: object

catalog(profile_or_system, name, ip, start_or_stop, ts)[source]
get_printable_results()[source]
process_results()[source]
run()[source]

Calculate and print a automatic installation status report.

scan_logfiles()[source]

Scan the install log-files - starting with the oldest file. :return:

8.1.1.13. cobbler.actions.sync module

Builds out filesystem trees/data based on the object tree. This is the code behind ‘cobbler sync’.

class cobbler.actions.sync.CobblerSync(collection_mgr, verbose=True, dhcp=None, dns=None, logger=None, tftpd=None)[source]

Bases: object

Handles conversion of internal state to the tftpboot tree layout

clean_trees()[source]

Delete any previously built pxelinux.cfg tree and virt tree info and then create directories.

Note: for SELinux reasons, some information goes in /tftpboot, some in /var/www/cobbler and some must be duplicated in both. This is because PXE needs tftp, and automatic installation and Virt operations need http. Only the kernel and initrd images are duplicated, which is unfortunate, though SELinux won’t let me give them two contexts, so symlinks are not a solution. Otherwise duplication is minimal.

make_tftpboot()[source]

Make directories for tftpboot images

rsync_gen()[source]

Generate rsync modules of all repositories and distributions

run()[source]

Syncs the current configuration file with the config tree. Using the Check().run_ functions previously is recommended

sync_dhcp()[source]
write_dhcp()[source]

8.1.1.14. Module contents