7. cobbler package
7.1. Subpackages
- 7.1.1. cobbler.actions package
- 7.1.1.1. Subpackages
- 7.1.1.2. Submodules
- 7.1.1.3. cobbler.actions.acl module
- 7.1.1.4. cobbler.actions.check module
CobblerCheckCobblerCheck.check_bind_bin()CobblerCheck.check_bootloaders()CobblerCheck.check_ctftpd_dir()CobblerCheck.check_debmirror()CobblerCheck.check_dhcpd_bin()CobblerCheck.check_dhcpd_conf()CobblerCheck.check_dnsmasq_bin()CobblerCheck.check_for_cman()CobblerCheck.check_for_default_password()CobblerCheck.check_for_ksvalidator()CobblerCheck.check_for_unreferenced_repos()CobblerCheck.check_for_unsynced_repos()CobblerCheck.check_for_wget_curl()CobblerCheck.check_iptables()CobblerCheck.check_name()CobblerCheck.check_rsync_conf()CobblerCheck.check_selinux()CobblerCheck.check_service()CobblerCheck.check_tftpd_dir()CobblerCheck.check_yum()CobblerCheck.run()
- 7.1.1.5. cobbler.actions.hardlink module
- 7.1.1.6. cobbler.actions.importer module
- 7.1.1.7. cobbler.actions.log module
- 7.1.1.8. cobbler.actions.mkloaders module
- 7.1.1.9. cobbler.actions.replicate module
- 7.1.1.10. cobbler.actions.reposync module
RepoSyncRepoSync.apt_sync()RepoSync.create_local_file()RepoSync.createrepo_walker()RepoSync.gen_urlgrab_ssl_opts()RepoSync.librepo_getinfo()RepoSync.reposync_cmd()RepoSync.rhn_sync()RepoSync.rsync_sync()RepoSync.run()RepoSync.sync()RepoSync.update_permissions()RepoSync.wget_sync()RepoSync.yum_sync()
repo_walker()
- 7.1.1.11. cobbler.actions.status module
- 7.1.1.12. cobbler.actions.sync module
CobblerSyncCobblerSync.add_single_distro()CobblerSync.add_single_image()CobblerSync.add_single_profile()CobblerSync.add_single_system()CobblerSync.clean_link_cache()CobblerSync.clean_trees()CobblerSync.remove_single_distro()CobblerSync.remove_single_image()CobblerSync.remove_single_menu()CobblerSync.remove_single_profile()CobblerSync.remove_single_system()CobblerSync.rsync_gen()CobblerSync.run()CobblerSync.run_sync_systems()CobblerSync.sync_dhcp()CobblerSync.update_system_netboot_status()CobblerSync.write_dhcp()
- 7.1.1.13. Module contents
- 7.1.2. cobbler.autoinstall package
- 7.1.2.1. Subpackages
- 7.1.2.1.1. cobbler.autoinstall.generate package
- 7.1.2.1.1.1. Submodules
- 7.1.2.1.1.2. cobbler.autoinstall.generate.agama module
- 7.1.2.1.1.3. cobbler.autoinstall.generate.autoyast module
- 7.1.2.1.1.4. cobbler.autoinstall.generate.base module
- 7.1.2.1.1.5. cobbler.autoinstall.generate.cloud_init module
- 7.1.2.1.1.6. cobbler.autoinstall.generate.kickstart module
- 7.1.2.1.1.7. cobbler.autoinstall.generate.legacy module
- 7.1.2.1.1.8. cobbler.autoinstall.generate.preseed module
- 7.1.2.1.1.9. cobbler.autoinstall.generate.windows module
- 7.1.2.1.1.10. Module contents
- 7.1.2.1.1. cobbler.autoinstall.generate package
- 7.1.2.2. Submodules
- 7.1.2.3. cobbler.autoinstall.manager module
- 7.1.2.4. Module contents
- 7.1.2.1. Subpackages
- 7.1.3. cobbler.cobbler_collections package
- 7.1.3.1. Submodules
- 7.1.3.2. cobbler.cobbler_collections.collection module
CollectionCollection.SEARCH_REKEYCollection.add()Collection.add_quick_pxe_sync()Collection.add_single_index_value()Collection.add_to_indexes()Collection.check_for_duplicate_names()Collection.collection_type()Collection.collection_types()Collection.copy()Collection.deserialize_runningCollection.factory_produce()Collection.find()Collection.find_by_indexes()Collection.from_list()Collection.get()Collection.index_helper()Collection.init_indexes()Collection.inmemoryCollection.lite_syncCollection.remove()Collection.remove_from_indexes()Collection.remove_quick_pxe_sync()Collection.remove_single_index_value()Collection.rename()Collection.to_list()Collection.update_index_value()
- 7.1.3.3. cobbler.cobbler_collections.distro_group module
- 7.1.3.4. cobbler.cobbler_collections.distros module
- 7.1.3.5. cobbler.cobbler_collections.images module
- 7.1.3.6. cobbler.cobbler_collections.manager module
CollectionManagerCollectionManager.deserialize()CollectionManager.deserialize_one_item()CollectionManager.distro_groups()CollectionManager.distros()CollectionManager.get_items()CollectionManager.has_loadedCollectionManager.images()CollectionManager.menus()CollectionManager.network_interfaces()CollectionManager.profile_groups()CollectionManager.profiles()CollectionManager.repos()CollectionManager.serialize()CollectionManager.serialize_delete()CollectionManager.serialize_delete_one_item()CollectionManager.serialize_item()CollectionManager.serialize_one_item()CollectionManager.settings()CollectionManager.system_groups()CollectionManager.systems()CollectionManager.templates()
- 7.1.3.7. cobbler.cobbler_collections.menus module
- 7.1.3.8. cobbler.cobbler_collections.network_interfaces module
- 7.1.3.9. cobbler.cobbler_collections.profile_group module
- 7.1.3.10. cobbler.cobbler_collections.profiles module
- 7.1.3.11. cobbler.cobbler_collections.repos module
- 7.1.3.12. cobbler.cobbler_collections.system_group module
- 7.1.3.13. cobbler.cobbler_collections.systems module
- 7.1.3.14. cobbler.cobbler_collections.templates module
- 7.1.3.15. Module contents
- 7.1.4. cobbler.cobblerd package
- 7.1.4.1. Submodules
- 7.1.4.2. cobbler.cobblerd.cli module
- 7.1.4.3. cobbler.cobblerd.daemon module
- 7.1.4.4. cobbler.cobblerd.distro_options module
DistroOptionsDistroOptions.bind_zonefilesDistroOptions.completion_pathDistroOptions.datapathDistroOptions.defaultpathDistroOptions.docpathDistroOptions.etcpathDistroOptions.grub_mod_folderDistroOptions.httpd_groupDistroOptions.httpd_serviceDistroOptions.httpd_userDistroOptions.ipxe_folderDistroOptions.libpathDistroOptions.logpathDistroOptions.memdisk_folderDistroOptions.pxelinux_folderDistroOptions.secure_grub_fileDistroOptions.secure_grub_folderDistroOptions.shim_fileDistroOptions.shim_folderDistroOptions.syslinux_dirDistroOptions.systemd_dirDistroOptions.tftprootDistroOptions.to_context()DistroOptions.webconfigDistroOptions.webrootDistroOptions.webrootconfig
get_distro_options()
- 7.1.4.5. cobbler.cobblerd.setup module
- 7.1.4.6. Module contents
- 7.1.5. cobbler.data package
- 7.1.6. cobbler.items package
- 7.1.6.1. Subpackages
- 7.1.6.1.1. cobbler.items.abstract package
- 7.1.6.1.1.1. Submodules
- 7.1.6.1.1.2. cobbler.items.abstract.base_item module
- 7.1.6.1.1.3. cobbler.items.abstract.bootable_item module
- 7.1.6.1.1.4. cobbler.items.abstract.inheritable_item module
- 7.1.6.1.1.5. cobbler.items.abstract.item_cache module
- 7.1.6.1.1.6. cobbler.items.abstract.item_group module
- 7.1.6.1.1.7. Module contents
- 7.1.6.1.2. cobbler.items.options package
- 7.1.6.1.2.1. Submodules
- 7.1.6.1.2.2. cobbler.items.options.base module
- 7.1.6.1.2.3. cobbler.items.options.dns module
- 7.1.6.1.2.4. cobbler.items.options.ip module
- 7.1.6.1.2.5. cobbler.items.options.package module
- 7.1.6.1.2.6. cobbler.items.options.power module
- 7.1.6.1.2.7. cobbler.items.options.tftp module
- 7.1.6.1.2.8. cobbler.items.options.uri module
- 7.1.6.1.2.9. cobbler.items.options.virt module
- 7.1.6.1.2.10. Module contents
- 7.1.6.1.1. cobbler.items.abstract package
- 7.1.6.2. Submodules
- 7.1.6.3. cobbler.items.distro module
DistroDistro.COLLECTION_TYPEDistro.TYPE_NAMEDistro.archDistro.boot_loadersDistro.breedDistro.check_if_valid()Distro.distro_groupsDistro.find_distro_path()Distro.initrdDistro.kernelDistro.link_distro()Distro.make_clone()Distro.os_versionDistro.parentDistro.redhat_management_keyDistro.redhat_management_orgDistro.redhat_management_passwordDistro.redhat_management_userDistro.remote_boot_initrdDistro.remote_boot_kernelDistro.remote_grub_initrdDistro.remote_grub_kernelDistro.source_reposDistro.supported_boot_loadersDistro.tree_build_time
- 7.1.6.4. cobbler.items.distro_group module
- 7.1.6.5. cobbler.items.image module
- 7.1.6.6. cobbler.items.menu module
- 7.1.6.7. cobbler.items.network_interface module
NetworkInterfaceNetworkInterface.COLLECTION_TYPENetworkInterface.TYPE_NAMENetworkInterface.bonding_optsNetworkInterface.bridge_optsNetworkInterface.check_if_valid()NetworkInterface.connected_modeNetworkInterface.dhcp_tagNetworkInterface.dnsNetworkInterface.if_gatewayNetworkInterface.interface_masterNetworkInterface.interface_typeNetworkInterface.ipv4NetworkInterface.ipv6NetworkInterface.ipv6_default_gatewayNetworkInterface.ipv6_static_routesNetworkInterface.mac_addressNetworkInterface.make_clone()NetworkInterface.managementNetworkInterface.staticNetworkInterface.systemNetworkInterface.system_nameNetworkInterface.system_uidNetworkInterface.virt_bridge
- 7.1.6.8. cobbler.items.profile module
ProfileProfile.COLLECTION_TYPEProfile.TYPE_NAMEProfile.archProfile.autoinstallProfile.boot_loadersProfile.check_if_valid()Profile.dhcp_tagProfile.display_nameProfile.distroProfile.dnsProfile.enable_ipxeProfile.enable_menuProfile.filenameProfile.find_match_single_key()Profile.make_clone()Profile.menuProfile.profile_groupsProfile.proxyProfile.redhat_management_keyProfile.redhat_management_orgProfile.redhat_management_passwordProfile.redhat_management_userProfile.reposProfile.serverProfile.tftpProfile.virtProfile.virt_bridge
- 7.1.6.9. cobbler.items.profile_group module
- 7.1.6.10. cobbler.items.repo module
- 7.1.6.11. cobbler.items.system module
SystemSystem.COLLECTION_TYPESystem.TYPE_NAMESystem.autoinstallSystem.boot_loadersSystem.check_if_valid()System.display_nameSystem.dnsSystem.enable_ipxeSystem.filenameSystem.gatewaySystem.get_config_filename()System.get_ip_address()System.get_mac_address()System.get_mac_addressesSystem.hostnameSystem.imageSystem.interfacesSystem.ipv6_autoconfigurationSystem.ipv6_default_deviceSystem.is_management_supported()System.make_clone()System.netboot_enabledSystem.powerSystem.profileSystem.proxySystem.redhat_management_keySystem.redhat_management_orgSystem.redhat_management_passwordSystem.redhat_management_userSystem.repos_enabledSystem.serial_baud_rateSystem.serial_deviceSystem.serverSystem.statusSystem.system_groupsSystem.tftpSystem.virt
- 7.1.6.12. cobbler.items.system_group module
- 7.1.6.13. cobbler.items.template module
- 7.1.6.14. Module contents
- 7.1.6.1. Subpackages
- 7.1.7. cobbler.modules package
- 7.1.7.1. Subpackages
- 7.1.7.1.1. cobbler.modules.authentication package
- 7.1.7.1.1.1. Submodules
- 7.1.7.1.1.2. cobbler.modules.authentication.configfile module
- 7.1.7.1.1.3. cobbler.modules.authentication.denyall module
- 7.1.7.1.1.4. cobbler.modules.authentication.ldap module
- 7.1.7.1.1.5. cobbler.modules.authentication.pam module
- 7.1.7.1.1.6. cobbler.modules.authentication.passthru module
- 7.1.7.1.1.7. cobbler.modules.authentication.spacewalk module
- 7.1.7.1.1.8. Module contents
- 7.1.7.1.2. cobbler.modules.authorization package
- 7.1.7.1.3. cobbler.modules.installation package
- 7.1.7.1.3.1. Submodules
- 7.1.7.1.3.2. cobbler.modules.installation.post_log module
- 7.1.7.1.3.3. cobbler.modules.installation.post_power module
- 7.1.7.1.3.4. cobbler.modules.installation.post_puppet module
- 7.1.7.1.3.5. cobbler.modules.installation.post_report module
- 7.1.7.1.3.6. cobbler.modules.installation.pre_clear_anamon_logs module
- 7.1.7.1.3.7. cobbler.modules.installation.pre_log module
- 7.1.7.1.3.8. cobbler.modules.installation.pre_puppet module
- 7.1.7.1.3.9. Module contents
- 7.1.7.1.4. cobbler.modules.managers package
- 7.1.7.1.4.1. Submodules
- 7.1.7.1.4.2. cobbler.modules.managers.bind module
- 7.1.7.1.4.3. cobbler.modules.managers.dnsmasq module
- 7.1.7.1.4.4. cobbler.modules.managers.genders module
- 7.1.7.1.4.5. cobbler.modules.managers.import_signatures module
- 7.1.7.1.4.6. cobbler.modules.managers.in_tftpd module
- 7.1.7.1.4.7. cobbler.modules.managers.isc module
- 7.1.7.1.4.8. cobbler.modules.managers.ndjbdns module
- 7.1.7.1.4.9. Module contents
- 7.1.7.1.5. cobbler.modules.serializers package
- 7.1.7.1.1. cobbler.modules.authentication package
- 7.1.7.2. Submodules
- 7.1.7.3. cobbler.modules.nsupdate_add_system_post module
- 7.1.7.4. cobbler.modules.nsupdate_delete_system_pre module
- 7.1.7.5. cobbler.modules.scm_track module
- 7.1.7.6. cobbler.modules.sync_post_restart_services module
- 7.1.7.7. cobbler.modules.sync_post_wingen module
- 7.1.7.8. Module contents
- 7.1.7.1. Subpackages
- 7.1.8. cobbler.settings package
- 7.1.8.1. Subpackages
- 7.1.8.1.1. cobbler.settings.migrations package
- 7.1.8.1.1.1. Submodules
- 7.1.8.1.1.2. cobbler.settings.migrations.V2_8_5 module
- 7.1.8.1.1.3. cobbler.settings.migrations.V3_0_0 module
- 7.1.8.1.1.4. cobbler.settings.migrations.V3_0_1 module
- 7.1.8.1.1.5. cobbler.settings.migrations.V3_1_0 module
- 7.1.8.1.1.6. cobbler.settings.migrations.V3_1_1 module
- 7.1.8.1.1.7. cobbler.settings.migrations.V3_1_2 module
- 7.1.8.1.1.8. cobbler.settings.migrations.V3_2_0 module
- 7.1.8.1.1.9. cobbler.settings.migrations.V3_2_1 module
- 7.1.8.1.1.10. cobbler.settings.migrations.V3_3_0 module
- 7.1.8.1.1.11. cobbler.settings.migrations.V3_3_1 module
- 7.1.8.1.1.12. cobbler.settings.migrations.V3_3_2 module
- 7.1.8.1.1.13. cobbler.settings.migrations.V3_3_3 module
- 7.1.8.1.1.14. cobbler.settings.migrations.V3_3_4 module
- 7.1.8.1.1.15. cobbler.settings.migrations.V3_3_5 module
- 7.1.8.1.1.16. cobbler.settings.migrations.V3_3_6 module
- 7.1.8.1.1.17. cobbler.settings.migrations.V3_3_7 module
- 7.1.8.1.1.18. cobbler.settings.migrations.V3_4_0 module
- 7.1.8.1.1.19. cobbler.settings.migrations.helper module
- 7.1.8.1.1.20. Module contents
- 7.1.8.1.1. cobbler.settings.migrations package
- 7.1.8.2. Submodules
- 7.1.8.3. cobbler.settings.cli module
- 7.1.8.4. Module contents
- 7.1.8.1. Subpackages
- 7.1.9. cobbler.templates package
- 7.1.10. cobbler.utils package
- 7.1.10.1. Submodules
- 7.1.10.2. cobbler.utils.event module
- 7.1.10.3. cobbler.utils.filesystem_helpers module
cachefile()copyfile()copyfileimage()copyremotefile()create_json_database_dirs()create_tftpboot_dirs()create_trigger_dirs()create_web_dirs()hashfile()is_safe_to_hardlink()linkfile()mkdir()mkdirimage()path_tail()rmfile()rmglob_files()rmtree()rmtree_contents()safe_filter()sha1_file()
- 7.1.10.4. cobbler.utils.input_converters module
- 7.1.10.5. cobbler.utils.kernel_command_line module
- 7.1.10.6. cobbler.utils.mtab module
- 7.1.10.7. cobbler.utils.process_management module
- 7.1.10.8. cobbler.utils.signatures module
- 7.1.10.9. cobbler.utils.thread module
- 7.1.10.10. Module contents
blender()cheetah_exc()command_existing()compare_versions_gt()create_files_if_not_existing()dhcp_service_name()dhcpconf_location()dict_annihilate()dict_to_string()die()file_is_remote()filelock()find_highest_files()find_initrd()find_kernel()find_matching_files()flatten()get_exc()get_family()get_host_ip()get_random_mac()get_shared_secret()get_supported_system_boot_loaders()is_ip()is_selinux_enabled()is_str_float()is_str_int()kernel_options_to_string()kopts_overwrite()local_get_cobbler_api_url()local_get_cobbler_xmlrpc_url()lod_sort_by_key()lod_to_dod()log_exc()merge_dicts_recursive()named_service_name()namedconf_location()os_release()pretty_hex()read_file_contents()remote_file_exists()remove_lines_in_file()remove_yum_olddata()revert_strip_none()rsync_files()run_triggers()strip_none()subprocess_call()subprocess_get()subprocess_sp()uniquify()
7.2. Submodules
7.3. cobbler.api module
This module represents the Cobbler Python API. It is used by the XML-RPC API and can be used by external consumers.
Changelog:
Schema: From -> To
Current Schema: Please refer to the documentation visible of the individual methods.
- V4.0.0 (unreleased)
- Added:
Create, Read, Update & Delete methods for the NetworkInterface class
clean_items_cachenew_itemdeserialize_iteminput_string_or_list_no_inheritinput_string_or_listinput_string_or_dictinput_string_or_dict_no_inheritinput_booleaninput_int
- Changed:
new_*: Accepts kwargs as a last argument now (so a dict) that makes it possible to seed an object
- Removed:
Unused reporter module
- V3.3.4 (unreleased)
No changes
- V3.3.3
- Added:
get_item_resolved_valueset_item_resolved_value
- Changed:
dump_vars: Added boolean parameterremove_dictsas a new last argument
- V3.3.2
No changes
- V3.3.1
- Changes:
add_system: Parametercheck_for_duplicate_netinfowas removedbuild_iso: Replaced defaultNonearguments with typed argumentscreate_grub_images: Renamed tomkloaders
- V3.3.0
- Added:
menuscopy_menuremove_menurename_menunew_menuadd_menufind_menuget_menus_sincesync_systemssync_dnsget_valid_obj_boot_loaderscreate_grub_images
- Changed:
Constructor: Added
settingsfile_locationandexecute_settings_automigrationas parametersfind_items: Accept an emptystrforwhatif the argumentnameis given.dump_vars: Parameterformatwas renamed toformatted_outputgenerate_gpxe: Renamed togenerate_ipxe; The second parameter is nowimageand accepts the name of one.sync: Accepts a new parameter calledwhatwhich is aList[str]that signals what should be synced. An empty list signals a full sync.sync_dhcp: Parameterverbosewas removed
- Removed:
The
loggerarugment was removed from all methodsdlcontent
- V3.2.2
No changes
- V3.2.1
Added primitive type annotations for all parameters of all methods
- V3.2.0
No changes
- V3.1.2
No changes
- V3.1.1
No changes
- V3.1.0
No changes
- V3.0.1
No changes
- V3.0.0
- Added:
power_system: Replaces power_on, power_off, reboot, power_status
- Changed:
import_tree:
kickstart_fileis now calledautoinstall_file
- Removed:
updatecleardeserialize_rawdeserialize_item_rawpower_on- Replaced by power_systempower_off- Replaced by power_systemreboot- Replaced by power_systempower_status- Replaced by power_system
- V2.8.5
Inital tracking of changes.
- class cobbler.api.CobblerAPI(is_cobblerd: bool = False, settingsfile_location: str = '/etc/cobbler/settings.yaml', execute_settings_automigration: bool = False)[source]
Bases:
objectPython API module for Cobbler. See source for cobbler.py, or pydoc, for example usage. Cli apps and daemons should import api.py, and no other Cobbler code.
- acl_config(adduser: str | None = None, addgroup: str | None = None, removeuser: str | None = None, removegroup: str | None = None) None[source]
Configures users/groups to run the Cobbler CLI as non-root. Pass in only one option at a time. Powers
cobbler aclconfig.- Parameters:
adduser
addgroup
removeuser
removegroup
- add_distro(ref: Distro, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a distribution to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_distro_group(ref: DistroGroup, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a distro group to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_image(ref: Image, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add an image to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_item(what: str, ref: BaseItem, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add an abstract item to a collection of its specific items. This is not meant for external use. Please reefer to one of the specific methods
add_<type>.- Parameters:
what – The item type.
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
Add a submenu to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_network_interface(ref: NetworkInterface, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a Network Interface to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_profile(ref: Profile, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a profile to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_profile_group(ref: ProfileGroup, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a profile group to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_remove_items(items: List[TransactionTuple]) None[source]
Add or remove multiple items. 1. Checks for external modifications using mtime 2. Processes deletions first (deepest dependencies first) 3. Processes additions and modifications 4. Rebuilds the PXE configuration
- Parameters:
items – The list of items.
- add_repo(ref: Repo, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a repository to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_system(ref: System, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a system to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_system_group(ref: SystemGroup, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a system group to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- add_template(ref: Template, check_for_duplicate_names: bool = False, save: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Add a Template to Cobbler.
- Parameters:
ref – The identifier for the object to add to a collection.
check_for_duplicate_names – If the name should be unique or can be present multiple times.
save – If the item should be persisted.
with_triggers – If triggers should be run when the object is added.
with_sync – In case a Cobbler Sync should be executed after the action.
- authenticate(user: str, password: str) bool[source]
(Remote) access control. This depends on the chosen authentication module. Cobbler internal use only.
- Parameters:
user – The username to check for authentication.
password – The password to check for authentication.
- Returns:
Whether the action succeeded or not.
- authorize(user: str, resource: str, arg1: str | None = None, arg2: Any = None) int[source]
(Remote) access control. This depends on the chosen authorization module. Cobbler internal use only.
- Parameters:
user – The username to check for authorization.
resource – The type of resource which should be checked for access from the supplied user.
arg1 – The actual resource to check for authorization.
arg2 – Not known what this parameter does exactly.
- Returns:
The return code of the action.
- auto_add_repos() None[source]
Import any repos this server knows about and mirror them. Run
cobbler reposyncto apply the changes. Credit: Seth Vidal.:raises ImportError
- build_iso(iso: str = 'autoinst.iso', profiles: List[str] | None = None, systems: List[str] | None = None, buildisodir: str = '', distro_name: str | None = None, standalone: bool = False, airgapped: bool = False, source: str = '', exclude_dns: bool = False, exclude_systems: bool = False, xorrisofs_opts: str = '', esp: str | None = None) None[source]
Build an iso image which may be network bootable or not.
- Parameters:
iso – The name of the ISO. Defaults to
autoinst.iso.profiles – Use these profiles only
systems – Use these systems only
buildisodir – This overwrites the directory from the settings in which the iso is built in.
distro_name – Use this distro architecture. If not used, autodetected from profiles or systems.
standalone – This means that no network connection is needed to install the generated iso.
airgapped – This option implies
standalone=True.source – If the iso should be offline available this is the path to the sources of the image.
exclude_dns – Whether the repositories have to be locally available or the internet is reachable.
exclude_systems – Whether system entries should be skipped or generated.
xorrisofs_opts –
xorrisofsoptions to include additionally.esp – location of the ESP partition, e.g. for secure boot.
- check() List[str][source]
See if all preqs for network booting are valid. This returns a list of strings containing instructions on things to correct. An empty list means there is nothing to correct, but that still doesn’t mean there are configuration errors. This is mainly useful for human admins, who may, for instance, forget to properly set up their TFTP servers for PXE, etc.
- Returns:
A list of things to address.
- clean_items_cache(obj: Settings | Dict[str, Any])[source]
Items cache invalidation in case of settings or singatures changes. Cobbler internal use only.
- clear_logs(system: System) None[source]
Clears console and anamon logs for system
- Parameters:
system – The system to clear logs of.
- copy_distro(ref: Distro, newname: str) None[source]
This method copies a distro which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_distro_group(ref: DistroGroup, newname: str) None[source]
This method copies a distro group which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_image(ref: Image, newname: str) None[source]
This method copies an image which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_item(what: str, ref: BaseItem, newname: str) None[source]
General copy method which is called by the specific methods.
- Parameters:
what – The collection type which gets copied.
ref – The object itself which gets copied.
newname – The new name of the newly created object.
This method copies a file which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_network_interface(ref: NetworkInterface, newname: str) None[source]
This method copies a network interface which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_profile(ref: Profile, newname: str) None[source]
This method copies a profile which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_profile_group(ref: ProfileGroup, newname: str) None[source]
This method copies a profile group which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_repo(ref: Repo, newname: str) None[source]
This method copies a repository which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_system(ref: System, newname: str) None[source]
This method copies a system which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_system_group(ref: SystemGroup, newname: str) None[source]
This method copies a system group which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- copy_template(ref: Template, newname: str) None[source]
This method copies a template which is just different in the name of the object.
- Parameters:
ref – The object itself which gets copied.
newname – The new name of the newly created object.
- deserialize_item(obj: BaseItem) Dict[str, Any][source]
Load cobbler item from disk. Cobbler internal use only.
- distro_groups() DistroGroups[source]
Return the current list of distro groups
- dump_vars(obj: BootableItem, formatted_output: bool = False, remove_dicts: bool = False) Dict[str, Any] | str[source]
Dump all known variables related to that object.
- Parameters:
obj – The object for which the variables should be dumped.
formatted_output – If True the values will align in one column and be pretty printed for cli example.
remove_dicts – If True the dictionaries will be put into str form.
- Returns:
A dictionary with all the information which could be collected.
- find_distro(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[distro.Distro] | distro.Distro | None[source]
Find a distribution via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_distro_group(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[distro_group.DistroGroup] | distro_group.DistroGroup | None[source]
Find a distro group via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_image(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[image_module.Image] | image_module.Image | None[source]
Find an image via a name or keys specified in the
**kwargs.- Parameters:
name – The name to search for.
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_items(what: str = '', criteria: Dict[Any, Any] | None = None, return_list: bool = True, no_errors: bool = False) BootableItem | List[BootableItem] | None[source]
This is the abstract base method for finding object int the api. It should not be used by external resources. Please refer to the specific implementations of this method called
find_<object type>.- Parameters:
what – The object type of the item to search for.
criteria – The dictionary with the key-value pairs to find objects with.
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
- Returns:
The list of items witch match the search criteria.
Find a menu via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_network_interface(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[network_interface.NetworkInterface] | network_interface.NetworkInterface | None[source]
Find a network interface via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Additional key-value pairs which may help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_profile(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[profile_module.Profile] | profile_module.Profile | None[source]
Find a profile via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_profile_group(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[profile_group.ProfileGroup] | profile_group.ProfileGroup | None[source]
Find a profile group via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_repo(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[repo.Repo] | repo.Repo | None[source]
Find a repository via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_system(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[system_module.System] | system_module.System | None[source]
Find a system via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_system_group(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[system_group.SystemGroup] | system_group.SystemGroup | None[source]
Find a system group via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Key-value pairs which help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- find_template(return_list: bool = False, no_errors: bool = False, **kwargs: FIND_KWARGS) List[template.Template] | template.Template | None[source]
Find a network interface via a name or keys specified in the
**kwargs.- Parameters:
return_list – If only the first result or all results should be returned.
no_errors – Silence some errors which would raise if this turned to False.
kwargs – Additional key-value pairs which may help in finding the desired objects.
- Returns:
A single object or a list of all search results.
- generate_autoinstall(obj: BootableItem, autoinstall_template: Template, autoinstaller_subfile: str = '') str[source]
Generate the auto-installation file and return it.
- Parameters:
obj – The profile to generate the file for.
autoinstall_template – TODO
autoinstaller_subfile – TODO
- Returns:
The str representation of the file.
- generate_bootcfg(profile: str = '', system: str = '') str[source]
Generate a boot configuration. The system wins over the profile.
- Parameters:
profile – The profile to return the configuration for.
system – The system to return the configuration for.
- Returns:
The generated configuration file.
- generate_ipxe(profile: str, image: str, system: str) str[source]
Generate the ipxe configuration files. The system wins over the profile. Profile and System win over Image.
- Parameters:
profile – The profile to return the configuration for.
image – The image to return the configuration for.
system – The system to return the configuration for.
- Returns:
The generated configuration file.
- generate_pxe_file(filename: str | None, system: System, profile: Profile, distro: Distro, arch: Archs, image: Image | None = None, metadata: Dict[str, Any] | None = None, bootloader_format: BootLoader = BootLoader.PXE)[source]
See also
- generate_script(profile: str | None, system: str | None, name: str) str[source]
Generate an autoinstall script for the specified profile or system. The system wins over the profile.
- Parameters:
profile – The profile name to generate the script for.
system – The system name to generate the script for.
name – The name of the script which should be generated. Must only contain alphanumeric characters, dots and underscores.
- Returns:
The generated script or an error message.
- get_config_data(hostname: str) str[source]
Encodes configuration data for Koan as a JSON.
- Parameters:
hostname – The hostname ot encode the configuration data for.
- Returns:
A string with JSON data.
- get_distro_groups_since(mtime: float, collapse: bool = False) List[DistroGroup][source]
Return distro groups modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of distro groups which are newer then the given timestamp.
- get_distros_since(mtime: float, collapse: bool = False) List[Distro][source]
Returns distros modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – collapse=True specifies returning a dict instead of objects.
- Returns:
The list of distros which are newer then the given timestamp.
- get_images_since(mtime: float, collapse: bool = False) List[Image][source]
Return images modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of images which are newer then the given timestamp.
- get_item(what: str, name: str) BootableItem | None[source]
Get a general item.
- Parameters:
what – The item type to retrieve from the internal database.
name – The name of the item to retrieve.
- Returns:
An item of the desired type.
- get_item_resolved_value(item_uuid: str, attribute_path: List[str]) Any[source]
This method helps non Python API consumers to retrieve the final data of a field with inheritance.
This does not help with network interfaces because they don’t have a UUID at the moment and thus can’t be queried via their UUID.
- Parameters:
item_uuid – The UUID of the item that should be retrieved.
attribute_path – The attribute that should be retrieved.
- Raises:
ValueError – In case a value given was either malformed or the desired item did not exist.
TypeError – In case the type of the method arguments do have the wrong type.
AttributeError – In case the attribute specified is not available on the given item (type).
- Returns:
The attribute value. Since this might be of type NetworkInterface we cannot yet set this explicitly.
- get_items(what: str) Collection[BaseItem][source]
Get all items of a collection.
- Parameters:
what – The collection to query.
- Returns:
The items which were queried. May return no items.
Return files modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of files which are newer then the given timestamp.
- get_module_by_name(module_name: str) ModuleType | None[source]
Returns a loaded Cobbler module named ‘name’, if one exists, else None. Cobbler internal use only.
- Parameters:
module_name
- Returns:
- get_module_from_file(section: str, name: str, fallback: str | None = None) ModuleType[source]
Looks in
/etc/cobbler/settings.yamlfor a section called ‘section’ and a key called ‘name’, and then returns the module that corresponds to the value of that key. Cobbler internal use only.- Parameters:
section – The section to look at.
name – The name of the module to retrieve
fallback – The default module in case the requested one is not found.
- Returns:
The requested Python Module.
- get_module_name_from_file(section: str, name: str, fallback: str | None = None) str[source]
Looks up a module the same as
get_module_from_filebut returns the module name rather than the module itself.- Parameters:
section
name
fallback
- Returns:
- get_modules_in_category(category: str) List[ModuleType][source]
Returns all modules in a given category, for instance “serializer”, or “cli”. Cobbler internal use only.
- Parameters:
category – The category to check.
- Returns:
The list of modules.
- get_network_interfaces_since(mtime: float, collapse: bool = False) List[NetworkInterface][source]
Return network interfaces modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of files which are newer then the given timestamp.
- get_profile_groups_since(mtime: float, collapse: bool = False) List[ProfileGroup][source]
Return profile groups modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of profile groups which are newer then the given timestamp.
- get_profiles_since(mtime: float, collapse: bool = False) List[Profile][source]
Returns profiles modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of profiles which are newer then the given timestamp.
- get_repo_config_for_profile(obj: BaseItem) str[source]
Get the repository configuration for the specified profile
- Parameters:
obj – The profile to return the configuration for.
- Returns:
The repository configuration as a string.
- get_repo_config_for_system(obj: BaseItem) str[source]
Get the repository configuration for the specified system.
- Parameters:
obj – The system to return the configuration for.
- Returns:
The repository configuration as a string.
- get_repos_since(mtime: float, collapse: bool = False) List[Repo][source]
Return repositories modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of repositories which are newer then the given timestamp.
- static get_signatures() Dict[str, Any][source]
This returns the local signature cache.
- Returns:
The dict containing all signatures.
- get_sync(verbose: bool = False) CobblerSync[source]
Get a Cobbler Sync object which may be executed through the call of
obj.run().- Parameters:
verbose – If the action should be just logged as needed or (if True) as much verbose as possible.
- Returns:
An instance of the CobblerSync class to execute the sync with.
- get_system_groups_since(mtime: float, collapse: bool = False) List[SystemGroup][source]
Return system groups modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of system groups which are newer then the given timestamp.
- get_systems_since(mtime: float, collapse: bool = False) List[System][source]
Return systems modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of systems which are newer then the given timestamp.
- get_template_file_for_profile(obj: BootableItem, path: str) str[source]
Get the template for the specified profile.
- Parameters:
obj – The object which is related to that template.
path – The path to the template.
- Returns:
The template as in its string representation.
- get_template_file_for_system(obj: BootableItem, path: str) str[source]
Get the template for the specified system.
- Parameters:
obj – The object which is related to that template.
path – The path to the template.
- Returns:
The template as in its string representation.
- get_templates_since(mtime: float, collapse: bool = False) List[Template][source]
Return templates modified since a certain time (in seconds since Epoch)
- Parameters:
mtime – The timestamp which marks the gate if an object is included or not.
collapse – If True then this specifies that a list of dicts should be returned instead of a list of objects.
- Returns:
The list of files which are newer then the given timestamp.
- get_tftp_file(path: str, offset: int, size: int) Tuple[bytes, int][source]
Generate and return a file for a TFTP client.
- Parameters:
path – Path to file
offset – Offset of the requested chunk in the file
size – Size of the requested chunk in the file
- Returns:
The requested chunk and the length of the whole file
- get_valid_obj_boot_loaders(obj: Distro | Image) List[BootLoader][source]
Return the list of valid bootloaders for the object
- Parameters:
obj – The object for which the bootloaders should be looked up.
- Returns:
Get a list of all valid bootloaders.
- hardlink() int[source]
Hardlink all files where this is possible to improve performance.
- Returns:
The return code of the subprocess call which actually hardlinks the files.
- import_tree(mirror_url: str, mirror_name: str, network_root: str | None = None, autoinstall_file: str | None = None, rsync_flags: str | None = None, arch: str | None = None, breed: str | None = None, os_version: str | None = None) bool[source]
Automatically import a directory tree full of distribution files.
- Parameters:
mirror_url – Can be a string that represents a path, a user@host syntax for SSH, or an rsync:// address. If mirror_url is a filesystem path and mirroring is not desired, set network_root to something like “nfs://path/to/mirror_url/root”
mirror_name – The name of the mirror.
network_root – the remote path (nfs/http/ftp) for the distro files
autoinstall_file – user-specified response file, which will override the default
rsync_flags – Additional flags that will be passed to the rsync call that will sync everything to the Cobbler webroot.
arch – user-specified architecture
breed – user-specified breed
os_version – user-specified OS version
- static input_string_or_dict(options: str | List[Any] | Dict[Any, Any], allow_multiples: bool = True) str | Dict[Any, Any][source]
See also
- static input_string_or_dict_no_inherit(options: str | List[Any] | Dict[Any, Any], allow_multiples: bool = True) Dict[Any, Any][source]
See also
- is_autoinstall_in_use(autoinstall: str)[source]
Check if the auto-installation template is referenced by at least one Profile or System.
- Parameters:
ai – The name of the template.
- Returns:
True if this is the case, otherwise False.
- is_selinux_enabled() bool[source]
Returns whether selinux is enabled on the Cobbler server. We check this just once at Cobbler API init time, because a restart is required to change this; this does /not/ check enforce/permissive, nor does it need to.
- is_selinux_supported() bool[source]
Returns whether or not the OS is sufficient enough to run with SELinux enabled (currently EL 5 or later).
- Returns:
False per default. If Distro is Redhat and Version >= 5 then it returns true.
- last_modified_time() float[source]
Returns the time of the last modification to Cobbler, made by any API instance, regardless of the serializer type.
- Returns:
0 if there is no file where the information required for this method is saved.
- log(msg: str, args: str | List[str | None] | Dict[str, Any] | None = None, debug: bool = False) None[source]
Logs a message with the already initiated logger of this object.
- Parameters:
msg – The message to log.
args – Optional message which gets appended to the main msg with a ‘;’.
debug – Weather the logged message is a debug message (true) or info (false).
Deprecated since version 3.3.0: We should use the standard logger.
Return the current list of menus
- mkloaders() None[source]
Create the GRUB installer images via this API call. It utilizes
grub2-mkimagebehind the curtain.
- network_interfaces() NetworkInterfaces[source]
Return the current list of network interfaces
- new_distro(is_subobject: bool = False, **kwargs: Any) Distro[source]
Returns a new empty distro object. This distro is not automatically persisted. Persistance is achieved via
save().- Parameters:
is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
An empty Distro object.
- new_distro_group(is_subobject: bool = False, **kwargs: Any) DistroGroup[source]
Returns a new empty distro group object. This distro group is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
An empty DistroGroup object.
- new_image(is_subobject: bool = False, **kwargs: Any) Image[source]
Returns a new empty image object. This image is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object created is a subobject or not.
- Returns:
An empty image object.
- new_item(what: str = '', is_subobject: bool = False, **kwargs: Any) BootableItem[source]
Creates a new (unconfigured) object. The object is not persisted.
- Parameters:
what – Specifies the type of object. Valid item types can be seen at
ItemTypes().is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
The newly created object.
Returns a new empty menu object. This file is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object created is a subobject or not.
- Returns:
An empty Menu object.
- new_network_interface(**kwargs: Any) NetworkInterface[source]
Returns a new empty network interface object. This file is not automatically persisted. Persistence is achieved via
save().- Returns:
An empty Network Interface object.
- new_profile(is_subobject: bool = False, **kwargs: Any) Profile[source]
Returns a new empty profile object. This profile is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object created is a subobject or not.
- Returns:
An empty Profile object.
- new_profile_group(is_subobject: bool = False, **kwargs: Any) ProfileGroup[source]
Returns a new empty profile group object. This profile group is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
An empty ProfileGroup object.
- new_repo(is_subobject: bool = False, **kwargs: Any) Repo[source]
Returns a new empty repo object. This repository is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object created is a subobject or not.
- Returns:
An empty repo object.
- new_system(is_subobject: bool = False, **kwargs: Any) System[source]
Returns a new empty system object. This system is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object created is a subobject or not.
- Returns:
An empty System object.
- new_system_group(is_subobject: bool = False, **kwargs: Any) SystemGroup[source]
Returns a new empty system group object. This system group is not automatically persisted. Persistence is achieved via
save().- Parameters:
is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
An empty SystemGroup object.
- new_template(**kwargs: Any) Template[source]
Returns a new empty template object. This file is not automatically persisted. Persistence is achieved via
save().- Returns:
An empty Template object.
- power_system(system: System, power_operation: str, user: str | None = None, password: str | None = None) bool | None[source]
Power on / power off / get power status /reboot a system.
- Parameters:
system – Cobbler system
power_operation – power operation. Valid values: on, off, reboot, status
user – power management user
password – power management password
- Returns:
bool if operation was successful
- profile_groups() ProfileGroups[source]
Return the current list of profile groups
- remove_distro(ref: Distro | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a distribution from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_distro_group(ref: DistroGroup | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a distro group from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_image(ref: Image | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a image from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_item(what: str, ref: BaseItem | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a general item. This method should not be used by an external api. Please use the specific remove_<itemtype> methods.
- Parameters:
what – The type of the item.
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
Remove a menu from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_network_interface(ref: NetworkInterface | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a network interface from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_profile(ref: Profile | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a profile from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_profile_group(ref: ProfileGroup | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a profile group from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_repo(ref: Repo | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a repository from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_system(ref: System | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a system from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_system_group(ref: SystemGroup | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a system group from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- remove_template(ref: Template | str, recursive: bool = False, delete: bool = True, with_triggers: bool = True, with_sync: bool = True) None[source]
Remove a template from Cobbler.
- Parameters:
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Additional condition that controls if with_triggers and with_sync should be executed.
with_triggers – Whether you would like to have the removal triggers executed or not.
with_sync – In case a Cobbler Sync should be executed after the action.
- rename_distro(ref: Distro, newname: str) None[source]
Rename a distro to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_distro_group(ref: DistroGroup, newname: str) None[source]
Rename a distro group to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_image(ref: Image, newname: str) None[source]
Rename an image to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_item(what: str, ref: BaseItem, newname: str) None[source]
Remove a general item. This method should not be used by an external api. Please use the specific rename_<itemtype> methods.
- Parameters:
what – The type of object which should be renamed.
ref – The internal unique handle for the item.
newname – The new name for the item.
Rename a menu to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_network_interface(ref: NetworkInterface, newname: str) None[source]
Rename a network interface to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_profile(ref: Profile, newname: str) None[source]
Rename a profile to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_profile_group(ref: ProfileGroup, newname: str) None[source]
Rename a profile group to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_repo(ref: Repo, newname: str) None[source]
Rename a repository to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_system(ref: System, newname: str) None[source]
Rename a system to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_system_group(ref: SystemGroup, newname: str) None[source]
Rename a system group to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_template(ref: Template, newname: str) None[source]
Rename a template to a new name.
- Parameters:
ref – The internal unique handle for the item.
newname – The new name for the item.
- replicate(cobbler_master: str | None = None, port: str = '80', distro_patterns: str = '', profile_patterns: str = '', system_patterns: str = '', repo_patterns: str = '', image_patterns: str = '', prune: bool = False, omit_data: bool = False, sync_all: bool = False, use_ssl: bool = False) None[source]
Pull down data/configs from a remote Cobbler server that is a master to this server.
- Parameters:
cobbler_master – The hostname/URL of the other Cobbler server
port – The port to use for the replication task.
distro_patterns – The pattern of distros which should be synced.
profile_patterns – The pattern of profiles which should be synced.
system_patterns – The pattern of systems which should be synced.
repo_patterns – The pattern of repositories which should be synced.
image_patterns – The pattern of images which should be synced.
prune – Whether the object not on the master should be removed or not.
omit_data – If the data downloaded by the current Cobbler server should be rsynced to the destination server.
sync_all – This parameter behaves similarly to a dry run argument. If True then everything will executed, if False then only some things are synced.
use_ssl – Whether SSL should be used (True) or not (False).
- reposync(name: str | None = None, tries: int = 1, nofail: bool = False) None[source]
Take the contents of
/var/lib/cobbler/reposand update them – or create the initial copy if no contents exist yet.- Parameters:
name – The name of the repository to run reposync for.
tries – How many tries should be executed before the action fails.
nofail – If True then the action will fail, otherwise the action will just be skipped. This respects the
triesparameter.
- set_item_resolved_value(item_uuid: str, attribute_path: List[str], value: Any) None[source]
This method helps non Python API consumers to use the Python property setters without having access to the raw data of the object. In case you pass a dictionary the method tries to deduplicate it.
This does not help with network interfaces because they don’t have a UUID at the moment and thus can’t be queried via their UUID.
Warning
This function may throw any exception that is thrown by a setter of a Python property defined in Cobbler.
- Parameters:
item_uuid – The UUID of the item that should be retrieved.
attribute_path – The attribute that should be retrieved.
value – The new value to set.
- Raises:
ValueError – In case a value given was either malformed or the desired item did not exist.
TypeError – In case the type of the method arguments do have the wrong type.
AttributeError – In case the attribute specified is not available on the given item (type).
- status(mode: str) Dict[Any, Any] | str[source]
Get the status of the current Cobbler instance.
- Parameters:
mode – “text” or anything else. Meaning whether the output is thought for the terminal or not.
- Returns:
The current status of Cobbler.
- sync(verbose: bool = False, what: List[str] | None = None) None[source]
Take the values currently written to the configuration files in /etc, and /var, and build out the information tree found in /tftpboot. Any operations done in the API that have not been saved with serialize() will NOT be synchronized with this command.
- Parameters:
verbose – If the action should be just logged as needed or (if True) as much verbose as possible.
what – List of strings what services to sync (e.g. dhcp and/or dns). Empty list for full sync.
- sync_systems(systems: List[str], verbose: bool = False) None[source]
Take the values currently written to the configuration files in /etc, and /var, and build out the information tree found in /tftpboot. Any operations done in the API that have not been saved with serialize() will NOT be synchronized with this command.
- Parameters:
systems – List of specified systems that needs to be synced
verbose – If the action should be just logged as needed or (if True) as much verbose as possible.
- system_groups() SystemGroups[source]
Return the current list of system groups
- templates_refresh_content(objects: List[Template] | None = None) None[source]
Method to refresh the in-memory content of zero or more templates inside Cobbler.
- Parameters:
objects – With the default value None, all templates are refreshed. Otherwhise each template inside the list is refreshed. An empty list refreshes no templates.
- version(extended: bool = False) float | Dict[str, str | List[Any]][source]
What version is Cobbler?
If extended == False, returns a float for backwards compatibility If extended == True, returns a dict:
gitstamp – the last git commit hash gitdate – the last git commit date on the builder machine builddate – the time of the build version – something like “1.3.2” version_tuple – something like [ 1, 3, 2 ]
- Parameters:
extended – False returns a float, True a Dictionary.
7.4. cobbler.cexceptions module
Custom exceptions for Cobbler
7.5. cobbler.configgen module
configgen.py: Generate configuration data.
module for generating configuration manifest using autoinstall_meta data and templates for a given system (hostname)
- class cobbler.configgen.ConfigGen(cobbler_api: CobblerAPI, hostname: str)[source]
Bases:
objectGenerate configuration data for Cobbler’s management resource “repos”. Mainly used by Koan to configure systems.
- gen_config_data() Dict[Any, Any][source]
Generate configuration data for repos.
- Returns:
A dict which has all config data in it.
- gen_config_data_for_koan() str[source]
Encode configuration data. Return json object for Koan.
- Returns:
A json string for koan.
- get_cobbler_resource(resource_key: str) List[Any] | str | Dict[Any, Any][source]
Wrapper around Cobbler blender method
- Parameters:
resource_key – Not known what this actually is doing.
- Returns:
The blendered data. In some cases this is a str, in others it is a list or it might be a dict. In case the key is not found it will return an empty string.
- resolve_resource_var(string_data: ResourceAction | str) str[source]
Substitute variables in strings with data from the
autoinstall_metadictionary of the system.- Parameters:
string_data – The template which will then be substituted by the variables in this class.
- Returns:
A str with the substituted data. If the host_vars are not of type dict then this will return an empty str.
- Raises:
KeyError – When the autoinstall_meta variable does not contain the required Keys in the dict.
7.6. cobbler.decorator module
This module provides decorators that are required for Cobbler to work as expected.
- class cobbler.decorator.InheritableDictProperty(fget=None, fset=None, fdel=None, doc=None)[source]
Bases:
InheritablePropertyThis property is supposed to provide a way to identify properties in code that can be set to inherit.
- class cobbler.decorator.InheritableProperty(fget=None, fset=None, fdel=None, doc=None)[source]
Bases:
LazyPropertyThis property is supposed to provide a way to identify properties in code that can be set to inherit.
- inheritable = True
7.7. cobbler.download_manager module
Cobbler DownloadManager
- class cobbler.download_manager.DownloadManager[source]
Bases:
objectClass to provide an easy way to download files from the web inside Cobbler. Mainly present to provide support for system-wide proxies.
- urlread(url: str, proxies: Any = None, cert: str | Tuple[str, str] | None = None) Response[source]
Read the content of a given URL and pass the requests. Response object to the caller.
- Parameters:
url – The URL the request.
proxies – Override the default Cobbler proxies.
cert – Override the default Cobbler certs.
- Returns:
The Python
requests.Responseobject.
7.8. cobbler.enums module
This module is responsible for containing all enums we use in Cobbler. It should not be dependent upon any other module except the Python standard library.
- class cobbler.enums.Archs(value)[source]
Bases:
ConvertableEnumThis enum describes all system architectures which Cobbler is able to provision.
- AARCH64 = 'aarch64'
- ARM = 'arm'
- I386 = 'i386'
- IA64 = 'ia64'
- PPC = 'ppc'
- PPC64 = 'ppc64'
- PPC64EL = 'ppc64el'
- PPC64LE = 'ppc64le'
- S390 = 's390'
- S390X = 's390x'
- X86_64 = 'x86_64'
- class cobbler.enums.AutoinstallValidationError(value)[source]
Bases:
ConvertableEnumThis enum represents the template validation error codes that are well-known to Cobbler.
- KICKSTART = 2
- NONE = 0
- TEMPLATING = 1
- class cobbler.enums.AutoinstallerType(value)[source]
Bases:
ConvertableEnumThis enum represents the currently allowed types that may request a file with the “autoinstallation” endpoints.
- AGAMA = 'agama'
- AUTOYAST = 'autoyast'
- CLOUDINIT = 'cloud-init'
- KICKSTART = 'kickstart'
- LEGACY = 'legacy'
- PRESEED = 'preseed'
- WINDOWS = 'windows'
- XEN = 'xen'
- class cobbler.enums.BaudRates(value)[source]
Bases:
EnumThis enum describes all baud rates which are commonly used.
- B0 = 0
- B110 = 110
- B115200 = 115200
- B1200 = 1200
- B128000 = 128000
- B14400 = 14400
- B19200 = 19200
- B2400 = 2400
- B256000 = 256000
- B300 = 300
- B38400 = 38400
- B4800 = 4800
- B57600 = 57600
- B600 = 600
- B9600 = 9600
- DISABLED = -1
- class cobbler.enums.BootLoader(value)[source]
Bases:
ConvertableEnumThis enum represents all supported boot loaders inside Cobbler.
- GRUB = 'grub'
- INHERITED = '<<inherit>>'
- IPXE = 'ipxe'
- PXE = 'pxe'
- class cobbler.enums.CloudInitFileTypes(value)[source]
Bases:
ConvertableEnumTODO
- META_DATA = 'meta-data'
- NETWORK_CONFIG = 'network-config'
- USER_DATA = 'user-data'
- VENDOR_DATA = 'vendor-data'
- class cobbler.enums.ConvertableEnum(value)[source]
Bases:
EnumAbstract class to convert the enum via our convert method.
- classmethod to_enum(value: str | CONVERTABLEENUM) CONVERTABLEENUM[source]
This method converts the chosen str to the corresponding enum type.
- Parameters:
value – str which contains the to be converted value.
- Returns:
The enum value.
- Raises:
TypeError – In case value was not of type str.
ValueError – In case value was not in the range of valid values.
- class cobbler.enums.DHCP(value)[source]
Bases:
EnumThis enum represents all DHCP versions that Cobbler supports.
- V4 = 4
- V6 = 6
- class cobbler.enums.EventStatus(value)[source]
Bases:
ConvertableEnumThis enums describes the status an event can have. The cycle is the following:
“Running” –> “Complete” or “Failed”
- COMPLETE = 'complete'
Shows that an event did complete as desired
- FAILED = 'failed'
Shows that an event did not complete as expected
- INFO = 'notification'
Default Event status
- RUNNING = 'running'
Shows that an event is currently being processed by the server
- class cobbler.enums.ImageTypes(value)[source]
Bases:
ConvertableEnumThis enum represents all image types which Cobbler can manage.
- DIRECT = 'direct'
- ISO = 'iso'
- MEMDISK = 'memdisk'
- VIRT_CLONE = 'virt-clone'
- class cobbler.enums.ItemTypes(value)[source]
Bases:
ConvertableEnumThis enum represents all valid item types in Cobbler. If a new item type is created it must be added into this enum. Abstract base item types don’t have to be added here.
- DISTRO_GROUP = 'distro_group'
See
DistroGroup()
- NETWORK_INTERFACE = 'network_interface'
- PROFILE_GROUP = 'profile_group'
See
ProfileGroup()
- SYSTEM_GROUP = 'system_group'
See
SystemGroup()
- TEMPLATE = 'template'
See
Template()
- class cobbler.enums.MirrorType(value)[source]
Bases:
ConvertableEnumThis enum represents all mirror types which Cobbler can manage.
- BASEURL = 'baseurl'
- METALINK = 'metalink'
- MIRRORLIST = 'mirrorlist'
- NONE = 'none'
- class cobbler.enums.NetworkInterfaceType(value)[source]
Bases:
EnumThis enum represents all interface types Cobbler is able to set up on a target host.
- BMC = 'bmc'
- BOND = 'bond'
- BONDED_BRIDGE_SLAVE = 'bonded_bridge_slave'
- BOND_SLAVE = 'bond_slave'
- BRIDGE = 'bridge'
- BRIDGE_SLAVE = 'bridge_slave'
- INFINIBAND = 'infiniband'
- NA = 'na'
- class cobbler.enums.RepoArchs(value)[source]
Bases:
ConvertableEnumThis enum describes all repository architectures Cobbler is able to serve in case the content of the repository is serving the same architecture.
- AARCH64 = 'aarch64'
- ARM = 'arm'
- I386 = 'i386'
- IA64 = 'ia64'
- NOARCH = 'noarch'
- NONE = 'none'
- PPC = 'ppc'
- PPC64 = 'ppc64'
- PPC64EL = 'ppc64el'
- PPC64LE = 'ppc64le'
- S390 = 's390'
- SRC = 'src'
- X86_64 = 'x86_64'
- class cobbler.enums.RepoBreeds(value)[source]
Bases:
ConvertableEnumThis enum describes all repository breeds Cobbler is able to manage.
- APT = 'apt'
- NONE = 'none'
- RHN = 'rhn'
- RSYNC = 'rsync'
- WGET = 'wget'
- YUM = 'yum'
- class cobbler.enums.ResourceAction(value)[source]
Bases:
ConvertableEnumThis enum represents all actions a resource may execute.
- CREATE = 'create'
- REMOVE = 'remove'
- class cobbler.enums.TemplateSchema(value)[source]
Bases:
ConvertableEnumThis enum represents all supported template sources that Cobbler can read.
- ENVIRONMENT = 'environment'
- FILE = 'file'
- IMPORTLIB = 'importlib'
- class cobbler.enums.TemplateTag(value)[source]
Bases:
ConvertableEnumThis enum represents all the well-known tags that represent special templates that are needed so Cobbler can manage the target daemons.
- ACTIVE = 'active'
- BOOTCFG = 'bootcfg'
- DEFAULT = 'default'
- DHCPV4 = 'dhcpv4'
- DHCPV6 = 'dhcpv6'
- DNSMASQ = 'dnsmasq'
- GENDERS = 'genders'
- GRUB = 'grub'
- GRUB_MENU = 'grub_menu'
- GRUB_SUBMENU = 'grub_submenu'
- IPXE = 'ipxe'
- IPXE_MENU = 'ipxe_menu'
- IPXE_SUBMENU = 'ipxe_submenu'
- ISO_BOOTINFO = 'iso_bootinfo'
- ISO_BUILDISO = 'iso_buildiso'
- ISO_GRUB_MENUENTRY = 'iso_grub_menuentry'
- ISO_ISOLINUX_MENUENTRY = 'iso_isolinux_menuentry'
- NAMED_PRIMARY = 'named_primary'
- NAMED_SECONDARY = 'named_secondary'
- NAMED_ZONE_DEFAULT = 'named_zone_default'
- NAMED_ZONE_SPECIFC = 'named_zone_specifc'
- NDJBDNS = 'ndjbdns'
- PXE = 'pxe'
- PXE_MENU = 'pxe_menu'
- PXE_SUBMENU = 'pxe_submenu'
- REPORTING_BUILD_EMAIL = 'reporting_build_email'
- RSYNC = 'rsync'
- WINDOWS_ANSWERFILE = 'windows_answerfile'
- WINDOWS_POST_INST_CMD = 'windows_post_inst_cmd'
- WINDOWS_STARTNET = 'windows_startnet'
- class cobbler.enums.TlsRequireCert(value)[source]
Bases:
ConvertableEnumThis enum represents all TLS validation server cert types which Cobbler can manage.
- ALLOW = 'allow'
- DEMAND = 'demand'
- HARD = 'hard'
- NEVER = 'never'
- class cobbler.enums.VirtDiskDrivers(value)[source]
Bases:
ConvertableEnumThis enum represents all virtual disk driver Cobbler can handle.
- INHERITED = '<<inherit>>'
- QCOW2 = 'qcow2'
- QED = 'qed'
- RAW = 'raw'
- VDI = 'vdi'
- VDMK = 'vdmk'
- class cobbler.enums.VirtType(value)[source]
Bases:
ConvertableEnumThis enum represents all known types of virtualization Cobbler is able to handle via Koan.
- AUTO = 'auto'
- INHERITED = '<<inherit>>'
- KVM = 'kvm'
- OPENVZ = 'openvz'
- QEMU = 'qemu'
- VMWARE = 'vmware'
- VMWAREW = 'vmwarew'
- XENFV = 'xenfv'
- XENPV = 'xenpv'
7.9. cobbler.grub module
Module that contains GRUB related helper functionality.
- cobbler.grub.parse_grub_remote_file(file_location: str) str | None[source]
Parses a URI which grub would try to load from the network.
- Parameters:
file_location – The location which grub would try to load from the network.
- Returns:
In case the URL could be parsed it is returned in the converted format. Otherwise None is returned.
- Raises:
TypeError – In case file_location is not of type
str.ValueError – In case the file location does not contain a valid IPv4 or IPv6 address
7.10. cobbler.module_loader module
Module loader, adapted for Cobbler usage
- class cobbler.module_loader.ModuleLoader(api: CobblerAPI, module_path: str = '')[source]
Bases:
objectClass for dynamically loading Cobbler Plugins on startup
- get_module_by_name(name: str) ModuleType | None[source]
Get a module by its name. The category of the module is not needed.
- Parameters:
name – The name of the module.
- Returns:
The module asked by the function parameter.
- get_module_from_file(category: str, field: str, fallback_module_name: str | None = None) ModuleType[source]
Get Python module, based on name defined in configuration file
- Parameters:
category – field category in configuration file
field – field in configuration file
fallback_module_name – default value used if category/field is not found in configuration file
- Raises:
CX – If unable to load Python module
- Returns:
A Python module.
- get_module_name(category: str, field: str, fallback_module_name: str | None = None) str[source]
Get module name from the settings.
- Parameters:
category – Field category in configuration file.
field – Field in configuration file
fallback_module_name – Default value used if category/field is not found in configuration file
- Raises:
FileNotFoundError – If unable to find configuration file.
ValueError – If the category does not exist or the field is empty.
CX – If the field could not be read and no fallback_module_name was given.
- Returns:
The name of the module.
- get_modules_in_category(category: str) List[ModuleType][source]
Return all modules of a module category.
- Parameters:
category – The module category.
- Returns:
A list of all modules of that category. Returns an empty list if the Category does not exist.
7.11. cobbler.power_manager module
Power management library. Encapsulate the logic to run power management commands so that the Cobbler user does not have to remember different power management tools syntaxes. This makes rebooting a system for OS installation much easier.
- class cobbler.power_manager.PowerManager(api: CobblerAPI)[source]
Bases:
objectHandles power management in systems
- get_power_status(system: System, user: str | None = None, password: str | None = None) bool | None[source]
Get power status for a system that has power management configured.
- Parameters:
system (System) – Cobbler system
user – power management user
password – power management password
- Returns:
if system is powered on
- power_off(system: System, user: str | None = None, password: str | None = None) None[source]
Powers down a system that has power management configured.
- Parameters:
system (System) – Cobbler system
user – power management user
password – power management password
- cobbler.power_manager.get_power_command(power_type: str) str | None[source]
Get power management command path
- Parameters:
power_type – power management type
- Returns:
power management command path
7.12. cobbler.remote module
This module contains all code related to the Cobbler XML-RPC API.
Changelog:
Schema: From -> To
Current Schema: Please refer to the documentation visible of the individual methods.
- V4.0.0 (unreleased)
- Added:
Create, Read, Update & Delete methods for the NetworkInterface class
set_item_resolved_valueinput_string_or_list_no_inheritinput_string_or_listinput_string_or_dictinput_string_or_dict_no_inheritinput_booleaninput_int
- Changed:
`get_random_mac: Change default virt_type` tokvm
- Removed:
xapi_object_edit: Remove all-in-one edit method for the CLI
- V3.3.4 (unreleased)
No changes
- V3.3.3
- Added:
get_item_resolved_valuedump_vars
- V3.3.2
No changes
- V3.3.1
- Changed:
background_mkgrub: Renamed tobackground_mkloaders
- V3.3.0
- Added:
background_syncsystemsbackground_mkgrubget_menufind_menuget_menu_handleremove_menucopy_menurename_menunew_menumodify_menusave_menuget_valid_distro_boot_loadersget_valid_image_boot_loadersget_valid_profile_boot_loadersget_valid_system_boot_loadersget_menus_sinceget_menu_as_rendered
- Changed:
generate_gpxe: Renamed togenerate_ipxe
- Removed:
background_dlcontentget_distro_for_koanget_profile_for_koanget_system_for_koanget_repo_for_koanget_image_for_koanget_mgmtclass_for_koanget_package_for_koanget_file_for_koanget_file_for_koan
- V3.2.2
No changes
- V3.2.1
- Added:
auto_add_repos
- V3.2.0
No changes
- V3.1.2
No changes
- V3.1.1
No changes
- V3.1.0
No changes
- V3.0.1
No changes
- V3.0.0
- Added:
generate_profile_autoinstallgenerate_system_autoinstallget_valid_archsread_autoinstall_templatewrite_autoinstall_templateremove_autoinstall_templateread_autoinstall_snippetwrite_autoinstall_snippetremove_autoinstall_snippet
- Changed:
get_kickstart_templates: Renamed toget_autoinstall_templatesget_snippets: Renamed toget_autoinstall_snippetsis_kickstart_in_use: Renamed tois_autoinstall_in_usegenerate_kickstart: Renamed togenerate_autoinstall
- Removed:
updateread_or_write_kickstart_templateread_or_write_snippet
- V2.8.5
Inital tracking of changes.
- class cobbler.remote.CobblerXMLRPCInterface(api: CobblerAPI)[source]
Bases:
objectThis is the interface used for all XMLRPC methods, for instance, as used by koan or CobblerWeb.
Most read-write operations require a token returned from “login”. Read operations do not.
- auto_add_repos(token: str)[source]
- Parameters:
token – The API-token obtained via the login() method.
- background_aclsetup(options: Dict[str, Any], token: str) str[source]
Get the acl configuration from the config and set the acls in the backgroud.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_buildiso(options: Dict[str, Any], token: str) str[source]
Generates an ISO in /var/www/cobbler/pub that can be used to install profiles without using PXE.
- Parameters:
options – This parameter does contain the options passed from the CLI or remote API who called this.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_hardlink(options: Dict[str, Any], token: str) str[source]
Hardlink all files as a background task.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_import(options: Dict[str, Any], token: str) str[source]
Import an ISO image in the background.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_mkloaders(options: Dict[str, Any], token: str) str[source]
Create the bootloaders that Cobbler uses inside its TFTP-directory and stage them in the background.
- Parameters:
options – This parameter is unused for this background task.
token – The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_power_system(options: Dict[str, Any], token: str) str[source]
Power a system asynchronously in the background.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_replicate(options: Dict[str, Any], token: str) str[source]
Replicate Cobbler in the background to another Cobbler instance.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_reposync(options: Dict[str, Any], token: str) str[source]
Run a reposync in the background.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_signature_reload(options: Dict[str, Any], token: str) str[source]
Run a signature reload in the background.
- Parameters:
options – No additional parameters needed.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_signature_update(options: Dict[str, Any], token: str) str[source]
Run a signature update in the background.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_sync(options: Dict[str, Any], token: str) str[source]
Run a full Cobbler sync in the background.
- Parameters:
options – Possible options: verbose, dhcp, dns
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- background_syncsystems(options: Dict[str, Any], token: str) str[source]
Run a lite Cobbler sync in the background with only systems specified.
- Parameters:
options – Unknown what this parameter does.
token – The API-token obtained via the login() method.
- Returns:
The id of the task that was started.
- background_templates_refresh_content(options: Dict[str, Any], token: str) str[source]
Calls
cobbler.api.CobblerAPI.templates_refresh_content()with the given list of templates as a background task.- Parameters:
options – The dict should have a single key named
objects. This key should be a list of strings with names or UIDs of template objects. A single list may contain a mix of names and UIDs.token – The API-token obtained via the login() method.
- background_validate_autoinstall_files(options: Dict[str, Any], token: str) str[source]
Validate all autoinstall files in the background.
- Parameters:
options – Not known what this parameter does.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The id of the task which was started.
- check(token: str) List[str][source]
Returns a list of all the messages/warnings that are things that admin may want to correct about the configuration of the Cobbler server. This has nothing to do with “check_access” which is an auth/authz function in the XMLRPC API.
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
A list of things to address.
- check_access(token: str | None, resource: str, arg1: str | None = None, arg2: Any = None) int[source]
Check if the token which was provided has access.
- Parameters:
token – The token to check access for.
resource – The resource for which access shall be checked.
arg1 – Arguments to hand to the authorization provider.
arg2 – Arguments to hand to the authorization provider.
- Returns:
If the operation was successful return
1. If unsuccessful then return0. Other codes may be returned if specified by the currently configured authorization module.
- check_access_no_fail(token: str, resource: str, arg1: str | None = None, arg2: Any = None) int[source]
This is called by the WUI to decide whether an element is editable or not. It differs form check_access in that it is supposed to /not/ log the access checks (TBA) and does not raise exceptions.
- Parameters:
token – The token to check access for.
resource – The resource for which access shall be checked.
arg1 – Arguments to hand to the authorization provider.
arg2 – Arguments to hand to the authorization provider.
- Returns:
1 if the object is editable or 0 otherwise.
- clear_system_logs(object_id: str, token: str) bool[source]
clears console logs of a system
- Parameters:
object_id – The object id of the system to clear the logs of.
token – The API-token obtained via the login() method.
- Returns:
True if the operation succeeds.
- copy_distro(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a distribution and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_distro_group(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a distro group and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_image(object_id: str, newname: str, token: str | None = None) bool[source]
Copies an image and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_item(what: str, object_id: str, newname: str, token: str | None = None) bool[source]
Creates a new object that matches an existing object, as specified by an id.
- Parameters:
what – The item type which should be copied.
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
Copies a menu and rename it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_network_interface(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a network interface and rename it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_profile(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a profile and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_profile_group(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a profile group and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_repo(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a repository and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_system(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a system and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_system_group(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a system group and renames it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- copy_template(object_id: str, newname: str, token: str | None = None) bool[source]
Copies a template and rename it afterwards.
- Parameters:
object_id – The object id of the item in question.
newname – The new name for the copied object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- disable_netboot(name: str, token: str | None = None, **rest: Any) bool[source]
This is a feature used by the
pxe_just_oncesupport, see manpage. Sets system named “name” to no-longer PXE. Disabled by default as this requires public API access and is technically a read-write operation.- Parameters:
name – The name of the system to disable netboot for.
token – The API-token obtained via the login() method.
rest – This parameter is unused.
- Returns:
A boolean indicated the success of the action.
- dump_vars(item_uuid: str, formatted_output: bool = False, remove_dicts: bool = True)[source]
This function dumps all variables related to an object. The difference to the above mentioned function is that it accepts the item uid instead of the Python object itself.
See also
Logically identical to
dump_vars()
- extended_version(token: str | None = None, **rest: Any) Dict[str, str | List[str]][source]
Returns the full dictionary of version information. See api.py for documentation.
- Parameters:
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
The extended version of Cobbler
- find_distro(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a distro matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All distributions which have matched the criteria.
- find_distro_group(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a distro group matching certain criteria.
- Parameters:
criteria – The criteria a distro group needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All distro groups which have matched the criteria.
- find_image(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find an image matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All images which have matched the criteria.
- find_items(what: str, criteria: Dict[str, Any] | None = None, sort_field: str | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Works like get_items but also accepts criteria as a dict to search on.
Example:
{ "name" : "*.example.org" }Wildcards work as described by ‘pydoc fnmatch’.
- Parameters:
what – The object type to find.
criteria – The criteria an item needs to match.
sort_field – The field to sort the results after.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.
- Returns:
A list of dicts.
- find_items_paged(what: str, criteria: Dict[str, Any] | None = None, sort_field: str | None = None, page: int = 1, items_per_page: int = 25, resolved: bool = False, token: str | None = None)[source]
Returns a list of dicts as with find_items but additionally supports returning just a portion of the total list, for instance in supporting a web app that wants to show a limited amount of items per page.
- Parameters:
what – The object type to find.
criteria – The criteria a distribution needs to match.
sort_field – The field to sort the results after.
page – The page to return
items_per_page – The number of items per page.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
- Returns:
The found items.
Find a menu matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All files which have matched the criteria.
- find_network_interface(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a network interface matching certain criteria.
- Parameters:
criteria – The criteria a network interface needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All files which have matched the criteria.
- find_profile(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a profile matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All profiles which have matched the criteria.
- find_profile_group(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a profile group matching certain criteria.
- Parameters:
criteria – The criteria a profile group needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All profile groups which have matched the criteria.
- find_repo(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a repository matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All repositories which have matched the criteria.
- find_system(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a system matching certain criteria.
- Parameters:
criteria – The criteria a distribution needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All systems which have matched the criteria.
- find_system_by_dns_name(dns_name: str) Dict[str, Any][source]
This is used by the puppet external nodes feature.
- Parameters:
dns_name – The dns name of the system. This should be the fqdn and not only the hostname.
- Returns:
All system information or an empty dict.
- find_system_group(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a system group matching certain criteria.
- Parameters:
criteria – The criteria a system group needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All system groups which have matched the criteria.
- find_template(criteria: Dict[str, Any] | None = None, expand: bool = False, resolved: bool = False, token: str | None = None, **rest: Any) List[Any][source]
Find a template matching certain criteria.
- Parameters:
criteria – The criteria a template needs to match.
expand – Not only get the names but also the complete object in form of a dict.
resolved – This only has an effect when
expand = True. It returns the resolved representation of the object instead of the raw data.token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
All files which have matched the criteria.
- generate_autoinstall(obj_identifier: str = '', obj_type: str = 'profile', obj_field: str = 'name', autoinstaller_file: str = '', autoinstaller_subfile: str = '') str[source]
Generate the auto-installation file and return it.
- Parameters:
obj_identifier – The identifier of the object to generate the file for.
obj_type – Must be either the str “profile” or “system”.
obj_field – Must be either the str “name” or “uid”.
autoinstaller_type – All currently available types can be found at
cobbler.enums.AutoinstallerType. Please use the string values as an argument to this endpoint.autoinstaller_file – TODO
autoinstaller_subfile – TODO
- Returns:
The str representation of the file.
- generate_bootcfg(profile: str | None = None, system: str | None = None, **rest: Any) str[source]
This generates the bootcfg for a system which is related to a certain profile.
- Parameters:
profile – The profile which is associated to the system.
system – The system which the bootcfg should be generated for.
rest – This is dropped in this method since it is not needed here.
- Returns:
The generated bootcfg.
- generate_ipxe(profile: str | None = None, image: str | None = None, system: str | None = None, **rest: Any) str[source]
Generate the ipxe configuration.
- Parameters:
profile – The profile to generate iPXE config for.
image – The image to generate iPXE config for.
system – The system to generate iPXE config for.
rest – This is dropped in this method since it is not needed here.
- Returns:
The configuration as a str representation.
- generate_script(profile: str | None = None, system: str | None = None, name: str = '') str[source]
This generates the autoinstall script for a system or profile. Profile and System cannot be both given, if they are, Profile wins.
- Parameters:
profile – The profile name to generate the script for.
system – The system name to generate the script for.
name – Name of the generated script. Must only contain alphanumeric characters, dots and underscores.
- Returns:
Some generated script.
- get_authn_module_name(token: str) str[source]
Get the name of the currently used authentication module.
- Parameters:
token – The API-token obtained via the login() method. Cobbler token, obtained form login()
- Returns:
The name of the module.
- get_blended_data(profile: str | None = None, system: str | None = None)[source]
Combine all data which is available from a profile and system together and return it.
Deprecated since version 4.0.0: Please make use of the dump_vars endpoint.
- Parameters:
profile – The profile of the system.
system – The system for which the data should be rendered.
- Returns:
All values which could be blended together through the inheritance chain.
- get_config_data(hostname: str) str[source]
Generate configuration data for the system specified by hostname.
- Parameters:
hostname – The hostname for what to get the config data of.
- Returns:
The config data as a json for Koan.
- get_distro(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a distribution.
- Parameters:
name – The name of the distribution to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_distro_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get distribution after passing through Cobbler’s inheritance engine.
- Parameters:
name – distro name
token – authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a distribution.
- get_distro_group(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a distro group.
- Parameters:
name – The name of the distro group to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_distro_group_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get distro group after passing through Cobbler’s inheritance engine
- Parameters:
name – DistroGroup name
token – Authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a file.
- get_distro_group_handle(name: str)[source]
Get a handle for a distro group which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_distro_groups(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all distro groups.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all distro groups.
- get_distro_groups_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_distro_handle(name: str)[source]
Get a handle for a distribution which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_distros(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all distributions.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list with all distros.
- get_distros_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
Return all of the distro objects that have been modified after mtime.
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_event_log(event_id: str) str[source]
Returns the contents of a task log. Events that are not task-based do not have logs.
- Parameters:
event_id – The event-id generated by Cobbler.
- Returns:
The event log or a
?.
- get_events(for_user: str = '') Dict[str, List[str | float]][source]
Returns a dict(key=event id) = [ statetime, name, state, [read_by_who] ]
- Parameters:
for_user – (Optional) Filter events the user has not seen yet. If left unset, it will return all events.
- Returns:
A dictionary with all the events (or all filtered events).
- get_image(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get an image.
- Parameters:
name – The name of the image to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_image_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get repository after passing through Cobbler’s inheritance engine.
- Parameters:
name – image name
token – authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as an image.
- get_image_handle(name: str)[source]
Get a handle for an image which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_images(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all images.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all images.
- get_images_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_item(what: str, name: str, flatten: bool = False, resolved: bool = False, token: str | None = None)[source]
Returns a dict describing a given object.
- Parameters:
what – “distro”, “profile”, “system”, “image”, “repo”, etc
name – the object name to retrieve
flatten – reduce dicts to string representations (True/False)
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
- Returns:
The item or None.
- get_item_handle(what: str, name: str, token: str | None = None) str[source]
Given the name of an object (or other search parameters), return a reference (object id) that can be used with
modify_*functions orsave_*functions to manipulate that object.- Parameters:
what – The collection where the item is living in.
name – The name of the item.
- Returns:
The handle of the desired object.
- get_item_names(what: str) List[str][source]
This is just like get_items, but transmits less data.
- Parameters:
what – is the name of a Cobbler object type, as described for get_item.
- Returns:
Returns a list of object names (keys) for the given object type.
- get_item_resolved_value(item_uuid: str, attribute: List[str]) str | int | float | List[Any] | Dict[Any, Any][source]
See also
Logically identical to
get_item_resolved_value()
- get_items(what: str) List[Dict[str, Any]][source]
Individual list elements are the same for get_item.
- Parameters:
what – is the name of a Cobbler object type, as described for get_item.
- Returns:
This returns a list of dicts.
Get a menu.
- Parameters:
name – The name of the file to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
Get menu after passing through Cobbler’s inheritance engine
- Parameters:
name – Menu name
token – Authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a file.
Get a handle for a menu which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
This returns all menus.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all files.
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_network_interface(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a network interface.
- Parameters:
name – The name of the network interface to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_network_interface_handle(name: str)[source]
Get a handle for a network interface which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_network_interfaces(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all network interfaces.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all files.
- get_network_interfaces_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_profile(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a profile.
- Parameters:
name – The name of the profile to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_profile_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get profile after passing through Cobbler’s inheritance engine.
- Parameters:
name – profile name
token – authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a profile.
- get_profile_group(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a profile group.
- Parameters:
name – The name of the profile group to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_profile_group_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get profile group after passing through Cobbler’s inheritance engine
- Parameters:
name – ProfileGroup name
token – Authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a file.
- get_profile_group_handle(name: str)[source]
Get a handle for a profile group which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_profile_groups(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all profile groups.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all profile groups.
- get_profile_groups_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_profile_handle(name: str)[source]
Get a handle for a profile which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_profiles(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all profiles.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list with all profiles.
- get_profiles_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_random_mac(virt_type: str = 'kvm', token: str | None = None, **rest: Any) str[source]
Wrapper for
utils.get_random_mac(). Used in the webui.- Parameters:
virt_type – The type of the virtual machine.
token – The API-token obtained via the login() method. Auth token to authenticate against the api.
rest – This is dropped in this method since it is not needed here.
- Returns:
The random mac address which shall be used somewhere else.
- get_repo(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a repository.
- Parameters:
name – The name of the repository to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_repo_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get repository after passing through Cobbler’s inheritance engine.
- Parameters:
name – repository name
token – authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a repository.
- get_repo_config_for_profile(profile_name: str, **rest: Any)[source]
Return the yum configuration a given profile should use to obtain all of it’s Cobbler associated repos.
- Parameters:
profile_name – The name of the profile for which the repository config should be looked up.
rest – This is dropped in this method since it is not needed here.
- Returns:
The repository configuration for the profile.
- get_repo_config_for_system(system_name: str, **rest: Any)[source]
Return the yum configuration a given profile should use to obtain all of it’s Cobbler associated repos.
- Parameters:
system_name – The name of the system for which the repository config should be looked up.
rest – This is dropped in this method since it is not needed here.
- Returns:
The repository configuration for the system.
- get_repo_handle(name: str)[source]
Get a handle for a repository which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_repos(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all repositories.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all repositories.
- get_repos_compatible_with_profile(profile: str, token: str | None = None, **rest: Any) List[Dict[Any, Any]][source]
Get repos that can be used with a given profile name.
- Parameters:
profile – The profile to check for compatibility.
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
The list of compatible repositories.
- get_repos_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_settings(token: str | None = None, **rest: Any) Dict[str, Any][source]
Return the contents of our settings file, which is a dict.
- Parameters:
token – The API-token obtained via the login() method.
rest – Unused parameter.
- Returns:
Get the settings which are currently in Cobbler present.
- get_signatures(token: str | None = None, **rest: Any) Dict[Any, Any][source]
Return the contents of the API signatures
- Parameters:
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
Get the content of the currently loaded signatures file.
- get_status(mode: str = 'normal', token: str | None = None, **rest: Any) Dict[Any, Any] | str[source]
Returns the same information as cobbler status While a read-only operation, this requires a token because it’s potentially a fair amount of I/O
- Parameters:
mode – How the status should be presented.
token – The API-token obtained via the login() method. Auth token to authenticate against the api.
rest – This parameter is currently unused for this method.
- Returns:
The human or machine readable status of the status of Cobbler.
- get_system(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a system.
- Parameters:
name – The name of the system to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_system_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get profile after passing through Cobbler’s inheritance engine.
- Parameters:
name – system name
token – authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a system.
- get_system_group(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a system group.
- Parameters:
name – The name of the system group to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_system_group_as_rendered(name: str, token: str | None = None, **rest: Any) List[Any] | Dict[Any, Any] | int | str | float[source]
Get system group after passing through Cobbler’s inheritance engine
- Parameters:
name – SystemGroup name
token – Authentication token
rest – This is dropped in this method since it is not needed here.
- Returns:
Get a template rendered as a file.
- get_system_group_handle(name: str)[source]
Get a handle for a system group which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_system_groups(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all system groups.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all system groups.
- get_system_groups_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_system_handle(name: str)[source]
Get a handle for a system which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_systems(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all Systems.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all systems.
- get_systems_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_task_status(event_id: str) List[str | float | List[str]][source]
Get the current status of the task.
- Parameters:
event_id – The unique id of the task.
- Returns:
The event status.
- get_template(name: str, flatten: bool = False, resolved: bool = False, token: str | None = None, **rest: Any)[source]
Get a template.
- Parameters:
name – The name of the template to get.
flatten – If the item should be flattened.
resolved – If this is True, Cobbler will resolve the values to its final form, rather than give you the objects raw value.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
rest – Not used with this method currently.
- Returns:
The item or None.
- get_template_content(uid: str, token: str | None = None) str[source]
Search for the given object and return the content of the template. Call
templates_refresh_content()orbackground_templates_refresh_content()to refresh the content if something has changes that the in-memory representation isn’t showing.- Parameters:
uid – The UID of the desired template.
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The content of the autoinstallation template that is currently available in-memory.
- get_template_file_for_profile(profile_name: str, path: str, **rest: Any)[source]
Return the templated file requested for this profile
- Parameters:
profile_name – The name of the profile to get the template file for.
path – The path to the template which is requested.
rest – This is dropped in this method since it is not needed here.
- Returns:
The template file as a str representation.
- get_template_file_for_system(system_name: str, path: str, **rest: Any)[source]
Return the templated file requested for this system
- Parameters:
system_name – The name of the system to get the template file for.
path – The path to the template which is requested.
rest – This is dropped in this method since it is not needed here.
- Returns:
The template file as a str representation.
- get_template_handle(name: str)[source]
Get a handle for a template which allows you to use the functions
modify_*orsave_*to manipulate it.- Parameters:
name – The name of the item.
- Returns:
The handle of the desired object.
- get_templates(page: Any = None, results_per_page: Any = None, token: str | None = None, **rest: Any) List[Dict[str, Any]][source]
This returns all templates.
- Parameters:
page – This parameter is not used currently.
results_per_page – This parameter is not used currently.
token – The API-token obtained via the login() method.
rest – This parameter is not used currently.
- Returns:
The list of all files.
- get_templates_since(mtime: float) List[Any] | Dict[Any, Any] | int | str | float[source]
See documentation for get_distros_since
- Parameters:
mtime – The time after which all items should be included. Everything before this will be excluded.
- Returns:
The list of items which were modified after
mtime.
- get_tftp_file(path: str, offset: int, size: int, token: str) Tuple[bytes, int][source]
Generate and return a file for a TFTP client.
- Parameters:
path – Path to file
token – The API-token obtained via the login() method
offset – Offset of the requested chunk in the file
size – Size of the requested chunk in the file
- Returns:
The requested chunk and the length of the whole file
- get_user_from_token(token: str | None) str[source]
Given a token returned from login, return the username that logged in with it.
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
The username if the token was valid.
- Raises:
CX – If the token supplied to the function is invalid.
ValueError – In case “token” did not fulfil the requirements to be a token.
- get_valid_archs(token: str | None = None) List[str][source]
Return the list of valid architectures as read in from the distro signatures data
- Parameters:
token – The API-token obtained via the login() method.
- Returns:
Get a list of all valid architectures.
- get_valid_breeds(token: str | None = None, **rest: Any) List[str][source]
Return the list of valid breeds as read in from the distro signatures data
- Parameters:
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
All valid OS-Breeds which are present in Cobbler.
- get_valid_distro_boot_loaders(distro_name: str | None, token: str | None = None) List[str][source]
Return the list of valid boot loaders for the distro
- Parameters:
token – The API-token obtained via the login() method.
distro_name – The name of the distro for which the boot loaders should be looked up.
- Returns:
Get a list of all valid boot loaders.
- get_valid_image_boot_loaders(image_name: str | None, token: str | None = None) List[str][source]
Return the list of valid boot loaders for the image
- Parameters:
token – The API-token obtained via the login() method.
image_name – The name of the image for which the boot loaders should be looked up.
- Returns:
Get a list of all valid boot loaders.
- get_valid_os_versions(token: str | None = None, **rest: Any) List[str][source]
Return the list of valid os_versions as read in from the distro signatures data
- Parameters:
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
Get all valid OS-Versions
- get_valid_os_versions_for_breed(breed: str, token: str | None = None, **rest: Any) List[str][source]
Return the list of valid os_versions for the given breed
- Parameters:
breed – The OS-Breed which is requested.
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
All valid OS-versions for a certain breed.
- get_valid_profile_boot_loaders(profile_name: str | None, token: str | None = None) List[str][source]
Return the list of valid boot loaders for the profile
- Parameters:
token – The API-token obtained via the login() method.
profile_name – The name of the profile for which the boot loaders should be looked up.
- Returns:
Get a list of all valid boot loaders.
- get_valid_system_boot_loaders(system_name: str | None, token: str | None = None) List[str][source]
Return the list of valid boot loaders for the system
- Parameters:
token – The API-token obtained via the login() method.
system_name – The name of the system for which the boot loaders should be looked up.
- Returns:
Get a list of all valid boot loaders.get_valid_archs
- has_item(what: str, name: str, token: str | None = None)[source]
Returns True if a given collection has an item with a given name, otherwise returns False.
- Parameters:
what – The collection to search through.
name – The name of the item.
token – The API-token obtained via the login() method.
- Returns:
True if item was found, otherwise False.
- input_string_or_dict(options: str | List[Any] | Dict[Any, Any], allow_multiples: bool = True) str | Dict[Any, Any][source]
See also
- input_string_or_dict_no_inherit(options: str | List[Any] | Dict[Any, Any], allow_multiples: bool = True) Dict[Any, Any][source]
See also
- is_autoinstall_in_use(ai: str, token: str | None = None, **rest: Any) bool[source]
Check if the auto-installation for a system is in use.
- Parameters:
ai – The name of the system which could potentially be in autoinstall mode.
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
True if this is the case, otherwise False.
- last_modified_time(token: str | None = None) float[source]
Return the time of the last modification to any object. Used to verify from a calling application that no Cobbler objects have changed since last check. This method is implemented in the module api under the same name.
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
0 if there is no file where the information required for this method is saved.
- login(login_user: str, login_password: str) str[source]
Takes a username and password, validates it, and if successful returns a random login token which must be used on subsequent method calls. The token will time out after a set interval if not used. Re-logging in permitted.
- Parameters:
login_user – The username which is used to authenticate at Cobbler.
login_password – The password which is used to authenticate at Cobbler.
- Returns:
The token which can be used further on.
- logout(token: str) bool[source]
Retires a token ahead of the timeout.
- Parameters:
token – The API-token obtained via the login() method. Cobbler token, obtained form login()
- Returns:
if operation was successful or not
- modify_distro(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a distribution.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_distro_group(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a distro group.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_image(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of an image.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_item(what: str, object_id: str, attribute: List[str], arg: str | int | float | List[str] | Dict[str, Any], token: str) bool[source]
Adjusts the value of a given field, specified by ‘what’ on a given object id. Allows modification of certain attributes on newly created or existing distro object handle.
- Parameters:
what – The type of object to modify.
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
Modify a single attribute of a menu.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_network_interface(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a network_interface.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_profile(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a profile.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_profile_group(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a profile group.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_repo(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a repository.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_setting(setting_name: str, value: str | bool | float | int | Dict[Any, Any] | List[Any], token: str) int[source]
Modify a single attribute of a setting.
- Parameters:
setting_name – The name of the setting which shall be adjusted.
value – The new value for the setting.
token – The API-token obtained via the login() method.
- Returns:
0 on success, 1 on error.
- modify_system(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a system.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_system_group(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a system group.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- modify_template(object_id: str, attribute: List[str], arg: Any, token: str) bool[source]
Modify a single attribute of a template.
- Parameters:
object_id – The id of the object which shall be modified.
attribute – The attribute name which shall be edited.
arg – The new value for the argument.
token – The API-token obtained via the login() method.
- Returns:
True if the action was successful. Otherwise False.
- new_distro(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_distro_group(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_image(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_item(what: str, token: str, is_subobject: bool = False, **kwargs: Any) str[source]
Creates a new (unconfigured) object, returning an object handle that can be used.
Creates a new (unconfigured) object, returning an object handle that can be used with
modify_*methods and then finallysave_*methods. The handle only exists in memory until saved.- Parameters:
what – specifies the type of object:
distro,profile,system,repo,imageormenu.token – The API-token obtained via the login() method.
is_subobject – If the object is a subobject of an already existing object or not.
- Returns:
The object id for the newly created object.
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_network_interface(system_uid: str, token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
system_uid – The UID of the system to attach the network interface to.
- Returns:
The object id for the newly created object.
- new_profile(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_profile_group(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_repo(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_subprofile(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_system(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_system_group(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- new_template(token: str) str[source]
See
new_item().- Parameters:
token – The API-token obtained via the login() method.
- Returns:
The object id for the newly created object.
- power_system(system_id: str, power: str, token: str) bool[source]
Execute power task synchronously.
Returns true if the operation succeeded or if the system is powered on (in case of status). False otherwise.
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method. All tasks require tokens.
system_id – system handle
power – power operation (on/off/status/reboot)
- register_new_system(info: Dict[str, Any], token: str | None = None, **rest: Any) int[source]
If register_new_installs is enabled in settings, this allows /usr/bin/cobbler-register (part of the koan package) to add new system records remotely if they don’t already exist. There is a cobbler_register snippet that helps with doing this automatically for new installs but it can also be used for existing installs.
See “AutoRegistration” on the Wiki.
- Parameters:
info – The system information which is provided by the system.
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
Return 0 if everything succeeded.
- remove_distro(name: str, token: str, recursive: bool = True) bool[source]
Deletes a distribution from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_distro_group(name: str, token: str, recursive: bool = True) bool[source]
Deletes a distro group from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_image(name: str, token: str, recursive: bool = True) bool[source]
Deletes an image from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_item(what: str, name: str, token: str, recursive: bool = True) bool[source]
Deletes an item from a collection. Note that this requires the name of the distro, not an item handle.
- Parameters:
what – The item type of the item to remove.
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
Deletes a menu from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_network_interface(name: str, token: str, recursive: bool = True) bool[source]
Deletes a network interface from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_profile(name: str, token: str, recursive: bool = True) bool[source]
Deletes a profile from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_profile_group(name: str, token: str, recursive: bool = True) bool[source]
Deletes a profile group from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_repo(name: str, token: str, recursive: bool = True) bool[source]
Deletes a repository from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_system(name: str, token: str, recursive: bool = True) bool[source]
Deletes a system from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_system_group(name: str, token: str, recursive: bool = True) bool[source]
Deletes a system group from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- remove_template(name: str, token: str, recursive: bool = True) bool[source]
Deletes a template from Cobbler.
- Parameters:
name – The name of the item to remove.
token – The API-token obtained via the login() method.
recursive – If items which are depending on this one should be erased too.
- Returns:
True if the action was successful.
- rename_distro(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a distribution specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_distro_group(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a distro group specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_image(object_id: str, newname: str, token: str | None = None) bool[source]
Renames an image specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_item(what: str, object_id: str, newname: str, token: str | None = None) bool[source]
Renames an object specified by object_id to a new name.
- Parameters:
what – The type of object which shall be renamed to a new name.
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
Renames a menu specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_network_interface(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a network interface specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_profile(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a profile specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_profile_group(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a profile group specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_repo(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a repository specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_system(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a system specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_system_group(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a system group specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- rename_template(object_id: str, newname: str, token: str | None = None) bool[source]
Renames a template specified by object_id to a new name.
- Parameters:
object_id – The id which refers to the object.
newname – The new name for the object.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- run_install_triggers(mode: str, objtype: str, name: str, ip: str, token: str | None = None, **rest: Any)[source]
This is a feature used to run the pre/post install triggers. See CobblerTriggers on Wiki for details
- Parameters:
mode – The mode of the triggers. May be “pre”, “post” or “firstboot”.
objtype – The type of object. This should correspond to the collection type.
name – The name of the object.
ip – The ip of the objet.
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
True if everything worked correctly.
- save_distro(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_distro_group(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_image(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_item(what: str, object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
what – The type of object which shall be saved. This corresponds to the collections.
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_network_interface(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_profile(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_profile_group(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_repo(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_system(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_system_group(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- save_template(object_id: str, with_triggers: bool = True, with_sync: bool = True, editmode: str = 'bypass', token: str = '') bool[source]
Saves a newly created or modified object to disk. Calling save is required for any changes to persist.
- Parameters:
object_id – The id of the object to save.
with_triggers – If triggers should be run during save. Set to False to suppress per-save triggers.
with_sync – If a Cobbler sync should be executed after save. Set to False to suppress per-save syncs.
editmode – The mode which shall be used to persist the changes. Currently “new” and “bypass” are supported.
token – The API-token obtained via the login() method.
- Returns:
True if the action succeeded.
- set_item_resolved_value(item_uuid: str, attribute: List[str], value: Any, token: str | None = None) bool[source]
See also
Logically identical to
set_item_resolved_value()
- sync(token: str) bool[source]
Run sync code, which should complete before XMLRPC timeout. We can’t do reposync this way. Would be nice to send output over AJAX/other later.
- Parameters:
token – The API-token obtained via the login() method. Cobbler token, obtained form login()
- Returns:
bool if operation was successful
- sync_dhcp(token: str) bool[source]
Run sync code, which should complete before XMLRPC timeout. We can’t do reposync this way. Would be nice to send output over AJAX/other later.
- Parameters:
token – The API-token obtained via the login() method. Cobbler token, obtained form login()
- Returns:
bool if operation was successful
- templates_refresh_content(objects: List[str], token: str | None = '') bool[source]
Calls
cobbler.api.CobblerAPI.templates_refresh_content()with the given list of templates.- Parameters:
objects – A list of strings which represent the names and/or UIDs of template objects. Missing or not found elements are skipped.
token – The API-token obtained via the login() method.
- token_check(token: str) bool[source]
Checks to make sure a token is valid or not.
- Parameters:
token – The API-token obtained via the login() method. Cobbler token, obtained form login()
- Returns:
if operation was successful or not
- transaction_abort(token: str) bool[source]
Aborts current transaction, all changes are discarded.
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
bool if operation was successful
- transaction_begin(token: str) bool[source]
Begins a new transaction for the logged-in client. Transactions allow multiple API operations (
new_*,get_*,modify_*,copy_*,remove_*) to be grouped atomically. All modifications made within a transaction are isolated until committed. Other clients won’t see changes until the transaction is committed.- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
bool if operation was successful
- transaction_commit(token: str) bool[source]
Commits a transaction.
This performs validation and applies all accumulated transaction operations:
Checks for conflicting external modifications. If any object was modified outside the transaction (mtime mismatch), the commit fails and all changes are discarded.
Objects are removed in reverse dependency order (e.g. Profile - Distro)
Objects are added/modified in dependency order (e.g. Distro - Profile)
Rebuilds the PXE configuration once at the end
- Parameters:
token – The API-token obtained via the login() method. The API-token obtained via the login() method.
- Returns:
bool if operation was successful
- upload_log_data(sys_name: str, file: str, size: int, offset: int, data: Binary, token: str | None = None) bool[source]
This is a logger function used by the “anamon” logging system to upload all sorts of misc data from Anaconda. As it’s a bit of a potential log-flooder, it’s off by default and needs to be enabled in our settings.
- Parameters:
sys_name – The name of the system for which to upload log data.
file – The file where the log data should be put.
size – The size of the data which will be received.
offset – The offset in the file where the data will be written to.
data – The data that should be logged.
token – The API-token obtained via the login() method.
- Returns:
True if everything succeeded.
- version(token: str | None = None, **rest: Any)[source]
Return the Cobbler version for compatibility testing with remote applications. See api.py for documentation.
- Parameters:
token – The API-token obtained via the login() method.
rest – This is dropped in this method since it is not needed here.
- Returns:
The short version of Cobbler.
- xmlrpc_hacks(data: List[Any] | Dict[Any, Any] | int | str | float | None) List[Any] | Dict[Any, Any] | int | str | float[source]
Convert None in XMLRPC to just ‘~’ to make extra sure a client that can’t allow_none can deal with this.
ALSO: a weird hack ensuring that when dicts with integer keys (or other types) are transmitted with string keys.
- Parameters:
data – The data to prepare for the XMLRPC response.
- Returns:
The converted data.
- class cobbler.remote.CobblerXMLRPCServer(args: Any)[source]
Bases:
ThreadingMixIn,SimpleXMLRPCServerThis is the class for the main Cobbler XMLRPC Server. This class does not directly contain all XMLRPC methods. It just starts the server.
- class cobbler.remote.ProxiedXMLRPCInterface(api: CobblerAPI, proxy_class: Type[Any])[source]
Bases:
objectThis interface allows proxying request through another class.
- class cobbler.remote.RequestHandler(request, client_address, server)[source]
Bases:
SimpleXMLRPCRequestHandlerCustom request handler class for our XML-RPC server. This provides custom headers to allow usage behind proxies.
- class cobbler.remote.TransactionItemModifications(attribute: List[str], old_value: Any, new_value: Any)[source]
Bases:
NamedTupleThis tuple is providing named access to a changelog of values that can be used to updated indicies later onwards.
- class cobbler.remote.TransactionTuple(what: str, ref: InheritableItem, to_delete: bool, mtime: float, uid: str, item_modifications: List[TransactionItemModifications])[source]
Bases:
NamedTupleThis tuple is providing named access to values that are saved for a single object inside a single transaction.
- item_modifications: List[TransactionItemModifications]
Alias for field number 5
- ref: InheritableItem
Alias for field number 1
7.13. cobbler.serializer module
Serializer code for Cobbler
- class cobbler.serializer.Serializer(api: CobblerAPI)[source]
Bases:
objectSerializer interface that is used to access data in Cobbler independent of the actual data source.
- deserialize(collection: Collection[ITEM], topological: bool = True) None[source]
Load a collection from disk.
- Parameters:
collection – The Cobbler collection to know the type of the item.
topological – Sort collection based on each items’ depth attribute in the list of collection items. This ensures properly ordered object loading from disk with objects having parent/child relationships, i.e. profiles/subprofiles. See cobbler/items/abstract/inheritable_item.py
- deserialize_item(collection_type: str, uid: str) Dict[str, Any][source]
Load a collection item from disk.
- Parameters:
collection_type – The collection type to deserialize.
uid – The collection item name to deserialize.
- serialize(collection: Collection[ITEM]) None[source]
Save a collection to disk
- Parameters:
collection – The collection to serialize.
- serialize_delete(collection: Collection[ITEM], item: ITEM) None[source]
Delete a collection item from disk
- Parameters:
collection – The Cobbler collection to know the type of the item.
item – The collection item to delete.
- serialize_item(collection: Collection[ITEM], item: ITEM) None[source]
Save a collection item to disk
- Parameters:
collection – The Cobbler collection to know the type of the item.
item – The collection item to serialize.
7.14. cobbler.services module
Mod Python service functions for Cobbler’s public interface (aka cool stuff that works with wget/curl)
Changelog:
Schema: From -> To
Current Schema: Please refer to the documentation visible of the individual methods.
- V4.0.0 (unreleased)
No changes
- V3.3.4 (unreleased)
No changes
- V3.3.3
- Removed:
look
- V3.3.2
No changes
- V3.3.1
No changes
- V3.3.0
- Added:
settings
- Changed:
gpxe: Renamed toipxe
- V3.2.2
No changes
- V3.2.1
No changes
- V3.2.0
No changes
- V3.1.2
No changes
- V3.1.1
No changes
- V3.1.0
No changes
- V3.0.1
No changes
- V3.0.0
- Added:
autoinstallfind_autoinstall
- V2.8.5
Inital tracking of changes.
- class cobbler.services.CobblerSvc(server: str = '')[source]
Bases:
objectInteresting mod python functions are all keyed off the parameter mode, which defaults to index. All options are passed as parameters into the function.
- autodetect(**kwargs: str | int | List[str]) str[source]
This tries to autodect the system with the given information. If more than one candidate is found an error message is returned.
- Parameters:
kwargs – The keys “REMOTE_MACS”, “REMOTE_ADDR” or “interfaces”.
- Returns:
The name of the possible object or an error message.
- autoinstall(profile: str | None = None, system: str | None = None, file: str = '', **kwargs: Any) str[source]
Generate automatic installation files.
- Parameters:
profile – The name of the profile to generate the autoinstall for.
system – The name of the system to generate the autoinstall for.
kwargs – This parameter is unused.
- Returns:
TODO
- bootcfg(profile: str | None = None, system: str | None = None, **kwargs: Any) str[source]
Generate a boot.cfg config file. Used primarily for VMware ESXi.
- Parameters:
profile
system
kwargs – This parameter is unused.
- Returns:
- events(user: str = '', **kwargs: Any) str[source]
If no user is given then all events are returned. Otherwise only event associated to a user are returned.
- Parameters:
user – Filter the events for a given user.
kwargs – This parameter is unused.
- Returns:
A JSON object which contains all events.
- find_autoinstall(system: str | None = None, profile: str | None = None, **kwargs: str | int) str[source]
Find an autoinstallation for a system or a profile. If this is not known different parameters can be passed to kwargs to find it automatically. See “autodetect”.
- Parameters:
system – The system to find the autoinstallation for,
profile – The profile to find the autoinstallation for.
kwargs – The metadata to find the autoinstallation automatically.
- Returns:
The autoinstall script or error message.
- index(**kwargs: Any) str[source]
Just a placeholder method as an entry point.
- Parameters:
kwargs – This parameter is unused.
- Returns:
“no mode specified”
- ipxe(profile: str | None = None, image: str | None = None, system: str | None = None, mac: str | None = None, **kwargs: Any)[source]
Generates an iPXE configuration.
- Parameters:
profile – A profile.
image – An image.
system – A system.
mac – A MAC address.
kwargs – This parameter is unused.
- list(what: str = 'systems', **kwargs: Any) str[source]
Return a list of objects of a desired category. Defaults to “systems”.
- Parameters:
what – May be “systems”, “profiles”, “distros”, “images”, “repos” or “menus”
kwargs – This parameter is unused.
- Returns:
The list of object names.
- nopxe(system: str | None = None, **kwargs: Any) str[source]
Disables the network boot for the given system.
- Parameters:
system – The system to disable netboot for.
kwargs – This parameter is unused.
- Returns:
A boolean status if the action succeed or not.
- property remote: ServerProxy
Sets up the connection to the Cobbler XMLRPC server. This is the version that does not require a login.
- script(profile: str | None = None, system: str | None = None, **kwargs: Any) str[source]
Generate a script based on snippets. Useful for post or late-action scripts where it’s difficult to embed the script in the response file.
- Parameters:
profile – The profile to generate the script for.
system – The system to generate the script for.
kwargs – This may contain a parameter with the key “query_string” which has a key “script” which may be an array. The element from position zero is taken.
- Returns:
The generated script.
- template(profile: str | None = None, system: str | None = None, path: str | None = None, **kwargs: Any) str[source]
Generate a templated file for the system. Either specify a profile OR a system.
- Parameters:
profile – The profile to provide for the generation of the template.
system – The system to provide for the generation of the template.
path – The path to the template.
kwargs – This parameter is unused.
- Returns:
The rendered template.
- trig(mode: str = '?', profile: str | None = None, system: str | None = None, REMOTE_ADDR: str | None = None, **kwargs: Any) str[source]
Hook to call install triggers. Only valid for a profile OR a system.
- Parameters:
mode – Can be “pre”, “post” or “firstboot”. Everything else is invalid.
profile – The profile object to run triggers for.
system – The system object to run triggers for.
REMOTE_ADDR – The ip if the remote system/profile.
kwargs – This parameter is unused.
- Returns:
The return code of the action.
- yum(profile: str | None = None, system: str | None = None, **kwargs: Any) str[source]
Generate a repo config. Either specify a profile OR a system.
- Parameters:
profile – The profile to provide for the generation of the template.
system – The system to provide for the generation of the template.
kwargs – This parameter is unused.
- Returns:
The generated repository config.
- cobbler.services.VALUE_KEY = <object object>
Empty instance. A unique marker value used instead of None to differentiate between when a key should be used for a value and when ‘None’ is a valid entry in a dictionary.
7.15. cobbler.tftpgen module
Generate files provided by TFTP server based on Cobbler object tree. This is the code behind ‘cobbler sync’.
- class cobbler.tftpgen.TFTPGen(api: CobblerAPI)[source]
Bases:
objectGenerate files provided by TFTP server
- build_kernel(metadata: Dict[str, Any], system: System, profile: Profile, distro: Distro, image: Image | None = None, boot_loader: str = 'pxe')[source]
Generates kernel and initrd metadata.
- Parameters:
metadata – Pass additional parameters to the ones being collected during the method.
system – The system to generate the pxe-file for.
profile – The profile to generate the pxe-file for.
distro – If you don’t ship an image, this is needed. Otherwise this just supplies information needed for the templates.
image – If you want to be able to deploy an image, supply this parameter.
boot_loader – Can be any of those returned by utils.get_supported_system_boot_loaders().
- build_kernel_options(system: System | None, profile: Profile | None, distro: Distro | None, image: Image | None, arch: Archs) str[source]
Builds the full kernel options line.
- Parameters:
system – The system to generate the kernel options for.
profile – Although the system contains the profile please specify it explicitly here.
distro – Although the profile contains the distribution please specify it explicitly here.
image – The image to generate the kernel options for.
arch – The processor architecture to generate the kernel options for.
- Returns:
The generated kernel line options.
- copy_bootloaders(dest: str) None[source]
Copy bootloaders to the configured tftpboot directory NOTE: we support different arch’s if defined in our settings file.
- copy_single_distro_file(d_file: str, distro_dir: str, symlink_ok: bool) None[source]
Copy a single file (kernel/initrd) to distro’s images directory
- Parameters:
d_file – distro’s kernel/initrd absolut or remote file path value
distro_dir – directory (typically in {www,tftp}/images) where to copy the file
symlink_ok – whethere it is ok to symlink the file. Typically false in case the file is used by daemons run in chroot environments (tftpd,..)
- Raises:
FileNotFoundError – Raised in case no kernel was found.
- copy_single_distro_files(distro: Distro, dirtree: str, symlink_ok: bool)[source]
Copy the files needed for a single distro.
- Parameters:
distro – The distro to copy.
dirtree – This is the root where the images are located. The folder “images” gets automatically appended.
symlink_ok – If it is okay to use a symlink to link the destination to the source.
- copy_single_image_files(img: Image)[source]
Copies an image to the images directory of Cobbler.
- Parameters:
img – The image to copy.
- copy_static_grub_files() None[source]
Copy the embedded, hardcoded GRUB configuration to the TFTP root. This method only writes files that don’t yet exist.
- generate_bootcfg(what: str, name: str) str[source]
Generate a bootcfg for a system of profile.
- Parameters:
what – The type for what the bootcfg is generated for. Must be “profile” or “system”.
name – The name of the item which the bootcfg should be generated for.
- Returns:
The fully rendered bootcfg as a string.
- generate_ipxe(what: str, name: str) str[source]
Generate the ipxe files.
- Parameters:
what – Either “profile” or “system”. All other item types not valid.
name – The name of the profile or system.
- Returns:
The rendered template.
Generate the requested menu file.
- Parameters:
path – Path to the menu file.
metadata – Menu items and other metadata for the generator.
- generate_script(what: str, objname: str, script_name: str) str[source]
Generate a script from a autoinstall script template for a given profile or system.
- Parameters:
what – The type for what the bootcfg is generated for. Must be “profile” or “system”.
objname – The name of the item which the bootcfg should be generated for.
script_name – The name of the template which should be rendered for the system or profile.
- Returns:
The fully rendered script as a string.
- generate_system_file(system: System, path: Path, metadata: Dict[str, str | Dict[str, str]]) str | None[source]
Generate a single file for a system if the file is related to the system.
- Parameters:
system – The system to generate the file for.
path – The path to the file.
metadata – Menu items and other metadata for the generator.
- Returns:
The contents of the file or None if the system does not provide this file.
- generate_tftp_file(path: Path, offset: int, size: int) Tuple[bytes, int][source]
Generate and return a file for a TFTP client.
- Parameters:
path – Normalized absolute path to the file
offset – Offset of the requested chunk in the file
size – Size of the requested chunk in the file
- Returns:
The requested chunk and the length of the whole file
Generates profiles metadata for pxe, ipxe and grub.
- Parameters:
menu – The menu for which boot files are generated. (Optional)
metadata – Pass additional parameters to the ones being collected during the method.
arch – The processor architecture to generate the menu items for. (Optional)
Generates menu items for pxe, ipxe and grub. Grub menu items are grouped into submenus by profile.
- Parameters:
arch – The processor architecture to generate the menu items for. (Optional)
- Returns:
A dictionary with the pxe, ipxe and grub menu items. It has the keys from utils.get_supported_system_boot_loaders().
Generates menu items for submenus, pxe, ipxe and grub.
- Parameters:
menu – The menu for which boot files are generated. (Optional)
arch – The processor architecture to generate the menu items for. (Optional)
- Returns:
A dictionary with the pxe and grub menu items. It has the keys from utils.get_supported_system_boot_loaders().
Generates profiles metadata for pxe, ipxe and grub.
- Parameters:
menu – The menu for which boot files are generated. (Optional)
metadata – Pass additional parameters to the ones being collected during the method.
arch – The processor architecture to generate the menu items for. (Optional)
Generates submenus metatdata for pxe, ipxe and grub.
- Parameters:
menu – The menu for which boot files are generated. (Optional)
metadata – Pass additional parameters to the ones being collected during the method.
arch – The processor architecture to generate the menu items for. (Optional)
Generates pxe, ipxe and grub boot menus.
- write_all_system_files(system: System, menu_items: Dict[str, str | Dict[str, str]]) None[source]
Writes all files for tftp for a given system with the menu items handed to this method. The system must have a profile attached. Otherwise this method throws an error.
Directory structure and cleanup behaviour:
TFTP Directory/ pxelinux.cfg/ 01-aa-bb-cc-dd-ee-ff grub/ system/ aa:bb:cc:dd:ee:ff system_link/ <system_name>
- Parameters:
system – The system to generate files for.
menu_items – The list of labels that are used for displaying the menu entry.
This method is also responsible for removing stale boot loader artefacts when support for PXE/GRUB is disabled or management is no longer supported for the system.
- write_pxe_file(filename: str | None, system: System | None, profile: Profile | None, distro: Distro | None, arch: Archs | None, image: Image | None = None, metadata: Dict[str, str | Dict[str, str]] | None = None, bootloader_format: BootLoader = BootLoader.PXE) str[source]
Write a configuration file for the bootloader(s).
More system-specific configuration may come in later, if so that would appear inside the system object in api.py Can be used for different formats, “pxe” (default) and “grub”.
- Parameters:
filename – If present this writes the output into the giving filename. If not present this method just returns the generated configuration.
system – If you supply a system there are other templates used then when using only a profile/image/ distro.
profile – The profile to generate the pxe-file for.
distro – If you don’t ship an image, this is needed. Otherwise, this just supplies information needed for the templates.
arch – The processor architecture to generate the pxefile for.
image – If you want to be able to deploy an image, supply this parameter.
metadata – Pass additional parameters to the ones being collected during the method.
bootloader_format – Can be any of those returned by utils.get_supported_system_boot_loaders().
- Returns:
The generated file-content for the required item.
- write_templates(obj: BootableItem, write_file: bool = False, path: str | None = None) Dict[str, str][source]
A semi-generic function that will take an object with a template_files dict {source:destiation}, and generate a rendered file. The write_file option allows for generating of the rendered output without actually creating any files.
- Parameters:
obj – The object to write the template files for.
write_file – If the generated template should be written to the disk.
path – TODO: A useless parameter?
- Returns:
A dict of the destination file names (after variable substitution is done) and the data in the file.
7.16. cobbler.validate module
Cobbler module that is related to validating data for other internal Cobbler modules.
- cobbler.validate.hostname(dnsname: str, allow_trailing_dot: bool = False) str[source]
Validate the DNS name.
- Parameters:
dnsname – Hostname or FQDN
allow_trailing_dot – If True, allows an optional trailing dot for absolute FQDNs
- Returns:
Hostname or FQDN
- Raises:
TypeError – If the Hostname/FQDN is not a string or in an invalid format.
- cobbler.validate.ipv4_address(addr: str) str[source]
Validate an IPv4 address.
- Parameters:
addr – IPv4 address
- Returns:
IPv4 address
- Raises:
TypeError – Raised if
addris not a string.AddressValueError – Raised in case
addris not a valid IPv4 address.NetmaskValueError – Raised in case
addris not a valid IPv4 netmask.
- cobbler.validate.ipv4_netmask(addr: str) str[source]
Validate an IPv4 netmask.
- Parameters:
addr – IPv4 netmask
- Returns:
IPv4 netmask
- Raises:
TypeError – Raised if
addris not a string.AddressValueError – Raised in case
addris not a valid IPv4 address.NetmaskValueError – Raised in case
addris not a valid IPv4 netmask.
- cobbler.validate.ipv6_address(addr: str) str[source]
Validate an IPv6 address.
- Parameters:
addr – IPv6 address
- Returns:
The IPv6 address.
- Raises:
TypeError – Raised if
addris not a string.AddressValueError – Raised in case
addris not a valid IPv6 address.
- cobbler.validate.mac_address(mac: str, for_item: bool = True) str[source]
Validate as an Ethernet MAC address.
- Parameters:
mac – MAC address
for_item – If the check should be performed for an item or not.
- Returns:
MAC address
- Raises:
ValueError – Raised in case
machas an invalid format.TypeError – Raised in case
macis not a string.
- cobbler.validate.name_servers(nameservers: str | List[str], for_item: bool = True) str | List[str][source]
Validate nameservers IP addresses, works for IPv4 and IPv6
- Parameters:
nameservers – string or list of nameserver addresses
for_item – enable/disable special handling for Item objects
- Returns:
The list of valid nameservers.
- Raises:
TypeError – Raised if
nameserversis not a string or list.AddressValueError – Raised in case
nameserversis not a valid address.
- cobbler.validate.name_servers_search(search: str | List[str], for_item: bool = True) str | List[str][source]
Validate nameservers search domains.
Allows trailing dots to specify absolute FQDNs that should not have additional search domains appended by the resolver.
- Parameters:
search – One or more search domains to validate.
for_item – enable/disable special handling for Item objects
- Returns:
The list of valid nameservers.
- Raises:
TypeError – Raised if
searchis not a string or list.
- cobbler.validate.validate_autoinstall_script_name(name: str) bool[source]
This validates if the name given for the script is valid in the context of the API call made. It will be handed to tftpgen.py#generate_script in the end.
- Parameters:
name – The name of the script. Will end up being a filename. May have an extension but should never be a path.
- Returns:
If this is a valid script name or not.
- cobbler.validate.validate_autoinstall_template_file_path(api: CobblerAPI, template_schema: TemplateSchema, template_language: str, autoinstall: str) bool[source]
Validate the automatic installation template’s relative file path.
- Parameters:
api – The api to get the base template path.
autoinstall – automatic installation template relative file path
- Returns:
If the template is a valid path or not.
- cobbler.validate.validate_boot_remote_file(value: str) bool[source]
This validates if the passed value is a valid value for
remote_boot_{kernel,initrd}.- Parameters:
value – Must be a valid URI starting with http or tftp. ftp is not supported and thus invalid.
- Returns:
False in any case. If value is valid,
Trueis returned.
- cobbler.validate.validate_breed(breed: str) str[source]
This is a setter for the operating system breed.
- Parameters:
breed – The os-breed which shall be set.
- Raises:
TypeError – If breed is not a str.
ValueError – If breed is not a supported breed.
- cobbler.validate.validate_grub_remote_file(value: str) bool[source]
This validates if the passed value is a valid value for
remote_grub_{kernel,initrd}.- Parameters:
value – Must be a valid grub formatted URI starting with http or tftp. ftp is not supported and thus invalid.
- Returns:
False in any case. If value is valid,
Trueis returned.
- cobbler.validate.validate_obj_name(object_name: str) bool[source]
This validates the name of an object against the Cobbler specific object name schema.
- Parameters:
object_name – The object name candidate.
- Returns:
True in case it matches the RE_OBJECT_NAME regex, False in all other cases.
- cobbler.validate.validate_obj_type(object_type: str) bool[source]
This validates the given object type against the available object types in Cobbler.
- Parameters:
object_type – The str with the object type to validate.
- Returns:
True in case it is one, False in all other cases.
- cobbler.validate.validate_os_version(os_version: str, breed: str) str[source]
This is a setter for the operating system version of an object.
- Parameters:
os_version – The version which shall be set.
breed – The breed to validate the os_version for.
- cobbler.validate.validate_repos(repos: List[str] | str, api: CobblerAPI, bypass_check: bool = False) List[str] | str[source]
This is a setter for the repository.
- Parameters:
repos – The repositories to set for the object.
api – The api to find the repos.
bypass_check – If the newly set repos should be checked for existence.
- cobbler.validate.validate_serial_baud_rate(baud_rate: int | str | BaudRates) BaudRates[source]
The baud rate is very import that the communication between the two devices can be established correctly. This is the setter for this parameter. This effectively is the speed of the connection.
- Parameters:
baud_rate – The baud rate to set.
- Returns:
The validated baud rate.
- cobbler.validate.validate_serial_device(value: str | int) int[source]
Set the serial device for an object.
- Parameters:
value – The number of the serial device.
- Returns:
The validated device number
- cobbler.validate.validate_template(api: CobblerAPI, value: str | Template) str[source]
This validates the input for the validate setter against the database of templates.
- Parameters:
api – The api to find the templates.
value – The input to verify and sanitize.
- Returns:
The name of the template (if built-in one), the object UID or
- cobbler.validate.validate_uuid(possible_uuid: str) bool[source]
Validate if the handed string is a valid UUIDv4 hex representation.
- Parameters:
possible_uuid – The str with the UUID.
- Returns:
True in case it is one, False otherwise.
- cobbler.validate.validate_virt_auto_boot(value: str | bool | int) bool | str[source]
For Virt only. Specifies whether the VM should automatically boot upon host reboot 0 tells Koan not to auto_boot virtuals.
- Parameters:
value – May be True or False.
- cobbler.validate.validate_virt_bridge(vbridge: str) str[source]
The default bridge for all virtual interfaces under this profile.
- Parameters:
vbridge – The bridgename to set for the object.
- Raises:
TypeError – In case vbridge was not of type str.
- cobbler.validate.validate_virt_cpus(num: str | int) int[source]
For Virt only. Set the number of virtual CPUs to give to the virtual machine. This is fed to virtinst RAW, so Cobbler will not yelp if you try to feed it 9999 CPUs. No formatting like 9,999 please :)
Zero means that the number of cores is inherited. Negative numbers are forbidden
- Parameters:
num – The number of cpu cores. If you pass the magic inherit string it will be converted to 0.
- cobbler.validate.validate_virt_file_size(num: str | int | float) str | float[source]
For Virt only: Specifies the size of the virt image in gigabytes. Older versions of koan (x<0.6.3) interpret 0 as “don’t care”. Newer versions (x>=0.6.4) interpret 0 as “no disks”
- Parameters:
num – is a non-negative integer (0 means default). Can also be a comma seperated list – for usage with multiple disks (not working at the moment)
- cobbler.validate.validate_virt_path(path: str, for_system: bool = False) str[source]
Virtual storage location suggestion, can be overriden by koan.
- Parameters:
path – The path to the storage.
for_system – If this is set to True then the value is inherited from a profile.
7.17. cobbler.yumgen module
Builds out filesystem trees/data based on the object tree. This is the code behind ‘cobbler sync’.
- class cobbler.yumgen.YumGen(api: CobblerAPI)[source]
Bases:
objectYumGen is responsible for generating yum repository configuration blobs for target systems in Cobbler.
This class uses the Cobbler API to access system settings and templating utilities, and produces a complete yum configuration suitable for use by clients requesting repository information. It collects relevant repository sources, renders configuration files using templates, and handles missing sources gracefully by reporting errors in the output.
- get_yum_config(obj: BaseItem, is_profile: bool) str[source]
Return one large yum repo config blob suitable for use by any target system that requests it.
- Parameters:
obj – The object to generate the yumconfig for.
is_profile – If the requested object is a profile. (Parameter not used currently)
- Returns:
The generated yumconfig or the errors.
7.18. Module contents
This is the main Cobbler module. It contains all code related to the Cobbler server and the CLI.
External applications should only make use of the cobbler.api module.