8. cobbler package
8.1. Subpackages
- 8.1.1. cobbler.actions package
- 8.1.1.1. Subpackages
- 8.1.1.2. Submodules
- 8.1.1.3. cobbler.actions.acl module
- 8.1.1.4. cobbler.actions.check module
CobblerCheck
CobblerCheck.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()
- 8.1.1.5. cobbler.actions.hardlink module
- 8.1.1.6. cobbler.actions.importer module
- 8.1.1.7. cobbler.actions.log module
- 8.1.1.8. cobbler.actions.mkloaders module
- 8.1.1.9. cobbler.actions.replicate module
- 8.1.1.10. cobbler.actions.report module
- 8.1.1.11. cobbler.actions.reposync module
RepoSync
RepoSync.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()
- 8.1.1.12. cobbler.actions.status module
- 8.1.1.13. cobbler.actions.sync module
CobblerSync
CobblerSync.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()
- 8.1.1.14. Module contents
- 8.1.2. cobbler.cobbler_collections package
- 8.1.2.1. Submodules
- 8.1.2.2. cobbler.cobbler_collections.collection module
Collection
Collection.SEARCH_REKEY
Collection.add()
Collection.collection_type()
Collection.collection_types()
Collection.copy()
Collection.factory_produce()
Collection.find()
Collection.from_list()
Collection.get()
Collection.get_names()
Collection.lite_sync
Collection.remove()
Collection.rename()
Collection.to_list()
Collection.to_string()
- 8.1.2.3. cobbler.cobbler_collections.distros module
- 8.1.2.4. cobbler.cobbler_collections.files module
- 8.1.2.5. cobbler.cobbler_collections.images module
- 8.1.2.6. cobbler.cobbler_collections.manager module
CollectionManager
CollectionManager.deserialize()
CollectionManager.deserialize_one_item()
CollectionManager.distros()
CollectionManager.files()
CollectionManager.get_items()
CollectionManager.has_loaded
CollectionManager.images()
CollectionManager.menus()
CollectionManager.mgmtclasses()
CollectionManager.packages()
CollectionManager.profiles()
CollectionManager.repos()
CollectionManager.serialize()
CollectionManager.serialize_delete()
CollectionManager.serialize_delete_one_item()
CollectionManager.serialize_item()
CollectionManager.serialize_one_item()
CollectionManager.settings()
CollectionManager.systems()
- 8.1.2.7. cobbler.cobbler_collections.menus module
- 8.1.2.8. cobbler.cobbler_collections.mgmtclasses module
- 8.1.2.9. cobbler.cobbler_collections.packages module
- 8.1.2.10. cobbler.cobbler_collections.profiles module
- 8.1.2.11. cobbler.cobbler_collections.repos module
- 8.1.2.12. cobbler.cobbler_collections.systems module
- 8.1.2.13. Module contents
- 8.1.3. cobbler.items package
- 8.1.3.1. Submodules
- 8.1.3.2. cobbler.items.distro module
Distro
Distro.COLLECTION_TYPE
Distro.TYPE_NAME
Distro.arch
Distro.boot_loaders
Distro.breed
Distro.check_if_valid()
Distro.find_distro_path()
Distro.initrd
Distro.kernel
Distro.link_distro()
Distro.make_clone()
Distro.os_version
Distro.parent
Distro.redhat_management_key
Distro.remote_boot_initrd
Distro.remote_boot_kernel
Distro.remote_grub_initrd
Distro.remote_grub_kernel
Distro.source_repos
Distro.supported_boot_loaders
Distro.tree_build_time
- 8.1.3.3. cobbler.items.file module
- 8.1.3.4. cobbler.items.image module
Image
Image.COLLECTION_TYPE
Image.TYPE_NAME
Image.arch
Image.autoinstall
Image.boot_loaders
Image.breed
Image.display_name
Image.file
Image.image_type
Image.make_clone()
Image.menu
Image.network_count
Image.os_version
Image.supported_boot_loaders
Image.virt_auto_boot
Image.virt_bridge
Image.virt_cpus
Image.virt_disk_driver
Image.virt_file_size
Image.virt_path
Image.virt_ram
Image.virt_type
- 8.1.3.5. cobbler.items.item module
Item
Item.COLLECTION_TYPE
Item.LOGICAL_INHERITANCE
Item.TYPE_DEPENDENCIES
Item.TYPE_NAME
Item.autoinstall_meta
Item.boot_files
Item.cache
Item.check_if_valid()
Item.children
Item.clean_cache()
Item.comment
Item.ctime
Item.depth
Item.descendants
Item.deserialize()
Item.dump_vars()
Item.fetchable_files
Item.find_match()
Item.find_match_single_key()
Item.from_dict()
Item.get_conceptual_parent()
Item.get_parent
Item.grab_tree()
Item.inmemory
Item.is_subobject
Item.kernel_options
Item.kernel_options_post
Item.logical_parent
Item.make_clone()
Item.mgmt_classes
Item.mgmt_parameters
Item.mtime
Item.name
Item.owners
Item.parent
Item.serialize()
Item.sort_key()
Item.template_files
Item.to_dict()
Item.tree_walk()
Item.uid
ItemCache
- 8.1.3.6. cobbler.items.menu module
- 8.1.3.7. cobbler.items.mgmtclass module
- 8.1.3.8. cobbler.items.package module
- 8.1.3.9. cobbler.items.profile module
Profile
Profile.COLLECTION_TYPE
Profile.TYPE_NAME
Profile.arch
Profile.autoinstall
Profile.boot_loaders
Profile.check_if_valid()
Profile.dhcp_tag
Profile.display_name
Profile.distro
Profile.enable_ipxe
Profile.enable_menu
Profile.filename
Profile.find_match_single_key()
Profile.make_clone()
Profile.menu
Profile.name_servers
Profile.name_servers_search
Profile.next_server_v4
Profile.next_server_v6
Profile.proxy
Profile.redhat_management_key
Profile.repos
Profile.server
Profile.virt_auto_boot
Profile.virt_bridge
Profile.virt_cpus
Profile.virt_disk_driver
Profile.virt_file_size
Profile.virt_path
Profile.virt_ram
Profile.virt_type
- 8.1.3.10. cobbler.items.repo module
Repo
Repo.COLLECTION_TYPE
Repo.TYPE_NAME
Repo.apt_components
Repo.apt_dists
Repo.arch
Repo.breed
Repo.check_if_valid()
Repo.createrepo_flags
Repo.environment
Repo.keep_updated
Repo.make_clone()
Repo.mirror
Repo.mirror_locally
Repo.mirror_type
Repo.os_version
Repo.priority
Repo.proxy
Repo.rpm_list
Repo.rsyncopts
Repo.yumopts
- 8.1.3.11. cobbler.items.resource module
- 8.1.3.12. cobbler.items.system module
NetworkInterface
NetworkInterface.bonding_opts
NetworkInterface.bridge_opts
NetworkInterface.cnames
NetworkInterface.connected_mode
NetworkInterface.deserialize()
NetworkInterface.dhcp_tag
NetworkInterface.dns_name
NetworkInterface.from_dict()
NetworkInterface.if_gateway
NetworkInterface.interface_master
NetworkInterface.interface_type
NetworkInterface.ip_address
NetworkInterface.ipv6_address
NetworkInterface.ipv6_default_gateway
NetworkInterface.ipv6_mtu
NetworkInterface.ipv6_prefix
NetworkInterface.ipv6_secondaries
NetworkInterface.ipv6_static_routes
NetworkInterface.mac_address
NetworkInterface.management
NetworkInterface.modify_interface()
NetworkInterface.mtu
NetworkInterface.netmask
NetworkInterface.serialize()
NetworkInterface.static
NetworkInterface.static_routes
NetworkInterface.to_dict()
NetworkInterface.virt_bridge
System
System.COLLECTION_TYPE
System.TYPE_NAME
System.autoinstall
System.boot_loaders
System.check_if_valid()
System.delete_interface()
System.display_name
System.enable_ipxe
System.filename
System.gateway
System.get_config_filename()
System.get_ip_address()
System.get_mac_address()
System.hostname
System.image
System.interfaces
System.ipv6_autoconfiguration
System.ipv6_default_device
System.is_management_supported()
System.make_clone()
System.modify_interface()
System.name_servers
System.name_servers_search
System.netboot_enabled
System.next_server_v4
System.next_server_v6
System.power_address
System.power_id
System.power_identity_file
System.power_options
System.power_pass
System.power_type
System.power_user
System.profile
System.proxy
System.redhat_management_key
System.rename_interface()
System.repos_enabled
System.serial_baud_rate
System.serial_device
System.server
System.status
System.virt_auto_boot
System.virt_cpus
System.virt_disk_driver
System.virt_file_size
System.virt_path
System.virt_pxe_boot
System.virt_ram
System.virt_type
- 8.1.3.13. Module contents
- 8.1.4. cobbler.modules package
- 8.1.4.1. Subpackages
- 8.1.4.1.1. cobbler.modules.authentication package
- 8.1.4.1.1.1. Submodules
- 8.1.4.1.1.2. cobbler.modules.authentication.configfile module
- 8.1.4.1.1.3. cobbler.modules.authentication.denyall module
- 8.1.4.1.1.4. cobbler.modules.authentication.ldap module
- 8.1.4.1.1.5. cobbler.modules.authentication.pam module
- 8.1.4.1.1.6. cobbler.modules.authentication.passthru module
- 8.1.4.1.1.7. cobbler.modules.authentication.spacewalk module
- 8.1.4.1.1.8. Module contents
- 8.1.4.1.2. cobbler.modules.authorization package
- 8.1.4.1.3. cobbler.modules.installation package
- 8.1.4.1.3.1. Submodules
- 8.1.4.1.3.2. cobbler.modules.installation.post_log module
- 8.1.4.1.3.3. cobbler.modules.installation.post_power module
- 8.1.4.1.3.4. cobbler.modules.installation.post_puppet module
- 8.1.4.1.3.5. cobbler.modules.installation.post_report module
- 8.1.4.1.3.6. cobbler.modules.installation.pre_clear_anamon_logs module
- 8.1.4.1.3.7. cobbler.modules.installation.pre_log module
- 8.1.4.1.3.8. cobbler.modules.installation.pre_puppet module
- 8.1.4.1.3.9. Module contents
- 8.1.4.1.4. cobbler.modules.managers package
- 8.1.4.1.4.1. Submodules
- 8.1.4.1.4.2. cobbler.modules.managers.bind module
- 8.1.4.1.4.3. cobbler.modules.managers.dnsmasq module
- 8.1.4.1.4.4. cobbler.modules.managers.genders module
- 8.1.4.1.4.5. cobbler.modules.managers.import_signatures module
- 8.1.4.1.4.6. cobbler.modules.managers.in_tftpd module
- 8.1.4.1.4.7. cobbler.modules.managers.isc module
- 8.1.4.1.4.8. cobbler.modules.managers.ndjbdns module
- 8.1.4.1.4.9. Module contents
- 8.1.4.1.5. cobbler.modules.serializers package
- 8.1.4.1.1. cobbler.modules.authentication package
- 8.1.4.2. Submodules
- 8.1.4.3. cobbler.modules.nsupdate_add_system_post module
- 8.1.4.4. cobbler.modules.nsupdate_delete_system_pre module
- 8.1.4.5. cobbler.modules.scm_track module
- 8.1.4.6. cobbler.modules.sync_post_restart_services module
- 8.1.4.7. cobbler.modules.sync_post_wingen module
- 8.1.4.8. Module contents
- 8.1.4.1. Subpackages
- 8.1.5. cobbler.settings package
- 8.1.5.1. Subpackages
- 8.1.5.1.1. cobbler.settings.migrations package
- 8.1.5.1.1.1. Submodules
- 8.1.5.1.1.2. cobbler.settings.migrations.V2_8_5 module
- 8.1.5.1.1.3. cobbler.settings.migrations.V3_0_0 module
- 8.1.5.1.1.4. cobbler.settings.migrations.V3_0_1 module
- 8.1.5.1.1.5. cobbler.settings.migrations.V3_1_0 module
- 8.1.5.1.1.6. cobbler.settings.migrations.V3_1_1 module
- 8.1.5.1.1.7. cobbler.settings.migrations.V3_1_2 module
- 8.1.5.1.1.8. cobbler.settings.migrations.V3_2_0 module
- 8.1.5.1.1.9. cobbler.settings.migrations.V3_2_1 module
- 8.1.5.1.1.10. cobbler.settings.migrations.V3_3_0 module
- 8.1.5.1.1.11. cobbler.settings.migrations.V3_3_1 module
- 8.1.5.1.1.12. cobbler.settings.migrations.V3_3_2 module
- 8.1.5.1.1.13. cobbler.settings.migrations.V3_3_3 module
- 8.1.5.1.1.14. cobbler.settings.migrations.V3_4_0 module
- 8.1.5.1.1.15. cobbler.settings.migrations.helper module
- 8.1.5.1.1.16. Module contents
- 8.1.5.1.1. cobbler.settings.migrations package
- 8.1.5.2. Module contents
- 8.1.5.1. Subpackages
- 8.1.6. cobbler.utils package
- 8.1.6.1. Submodules
- 8.1.6.2. cobbler.utils.event module
- 8.1.6.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()
- 8.1.6.4. cobbler.utils.input_converters module
- 8.1.6.5. cobbler.utils.mtab module
- 8.1.6.6. cobbler.utils.process_management module
- 8.1.6.7. cobbler.utils.signatures module
- 8.1.6.8. cobbler.utils.thread module
- 8.1.6.9. Module contents
blender()
cheetah_exc()
command_existing()
compare_versions_gt()
dhcp_service_name()
dhcpconf_location()
dict_annihilate()
dict_removals()
dict_to_string()
die()
file_is_remote()
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()
kopts_overwrite()
local_get_cobbler_api_url()
local_get_cobbler_xmlrpc_url()
lod_sort_by_key()
lod_to_dod()
log_exc()
named_service_name()
namedconf_location()
os_release()
pretty_hex()
read_file_contents()
remote_file_exists()
remove_yum_olddata()
revert_strip_none()
rsync_files()
run_triggers()
strip_none()
subprocess_call()
subprocess_get()
subprocess_sp()
uniquify()
8.2. Submodules
8.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.
- V3.4.0 (unreleased)
- Added:
clean_items_cache
new_item
deserialize_item
input_string_or_list_no_inherit
input_string_or_list
input_string_or_dict
input_string_or_dict_no_inherit
input_boolean
input_int
- Changed:
new_*
: Accepts kwargs as a last argument now (so a dict) that makes it possible to seed an object
- V3.3.4 (unreleased)
No changes
- V3.3.3
- Added:
get_item_resolved_value
set_item_resolved_value
- Changed:
dump_vars
: Added boolean parameterremove_dicts
as a new last argument
- V3.3.2
No changes
- V3.3.1
- Changes:
add_system
: Parametercheck_for_duplicate_netinfo
was removedbuild_iso
: Replaced defaultNone
arguments with typed argumentscreate_grub_images
: Renamed tomkloaders
- V3.3.0
- Added:
menus
copy_menu
remove_menu
rename_menu
new_menu
add_menu
find_menu
get_menus_since
sync_systems
sync_dns
get_valid_obj_boot_loaders
create_grub_images
- Changed:
Constructor: Added
settingsfile_location
andexecute_settings_automigration
as parametersfind_items
: Accept an emptystr
forwhat
if the argumentname
is given.dump_vars
: Parameterformat
was renamed toformatted_output
generate_gpxe
: Renamed togenerate_ipxe
; The second parameter is nowimage
and accepts the name of one.sync
: Accepts a new parameter calledwhat
which is aList[str]
that signals what should be synced. An empty list signals a full sync.sync_dhcp
: Parameterverbose
was removed
- Removed:
The
logger
arugment 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_file
is now calledautoinstall_file
- Removed:
update
clear
deserialize_raw
deserialize_item_raw
power_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:
object
Python 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: Optional[str] = None, addgroup: Optional[str] = None, removeuser: Optional[str] = None, removegroup: Optional[str] = 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) 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.
- add_file(ref: File, check_for_duplicate_names: bool = False, save: bool = True) None [source]
Add a file 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.
- add_image(ref: Image, check_for_duplicate_names: bool = False, save: 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.
- add_item(what: str, ref: ITEM_UNION, check_for_duplicate_names: bool = False, save: 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.
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.
- add_mgmtclass(ref: Mgmtclass, check_for_duplicate_names: bool = False, save: bool = True) None [source]
Add a management class 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.
- add_package(ref: Package, check_for_duplicate_names: bool = False, save: bool = True) None [source]
Add a package 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.
- add_profile(ref: Profile, check_for_duplicate_names: bool = False, save: 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.
- add_repo(ref: Repo, check_for_duplicate_names: bool = False, save: 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.
- add_system(ref: System, check_for_duplicate_names: bool = False, save: 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.
- 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: Optional[str] = None, arg2: Optional[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 reposync
to apply the changes. Credit: Seth Vidal.:raises ImportError
- build_iso(iso: str = 'autoinst.iso', profiles: Optional[List[str]] = None, systems: Optional[List[str]] = None, buildisodir: str = '', distro_name: str = '', standalone: bool = False, airgapped: bool = False, source: str = '', exclude_dns: bool = False, xorrisofs_opts: str = '') 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 – Used with
--standalone
and--airgapped
to create a distro-based ISO including all associated.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.
xorrisofs_opts –
xorrisofs
options to include additionally.
- 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: Union[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_file(ref: File, newname: str) None [source]
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_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: ITEM_UNION, 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_mgmtclass(ref: Mgmtclass, newname: str) None [source]
This method copies a management class 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_package(ref: Package, newname: str) None [source]
This method copies a package 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_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.
- deserialize_item(obj: Item) Dict[str, Any] [source]
Load cobbler item from disk. Cobbler internal use only.
- dump_vars(obj: Item, formatted_output: bool = False, remove_dicts: bool = False) Union[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(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[distro.Distro], distro.Distro]] [source]
Find a distribution via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_file(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[file.File], file.File]] [source]
Find a file via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_image(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[image_module.Image], image_module.Image]] [source]
Find an image via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_items(what: str = '', criteria: Optional[Dict[Any, Any]] = None, name: str = '', return_list: bool = True, no_errors: bool = False) Optional[Union[ITEM_UNION, List[ITEM_UNION]]] [source]
This is the abstract base method for finding object int the api. It should not be used by external resources. Please reefer 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.
name – The name of the object.
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
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_mgmtclass(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[mgmtclass.Mgmtclass], mgmtclass.Mgmtclass]] [source]
Find a management class via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_package(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[package.Package], package.Package]] [source]
Find a package via a name or keys specified in the
**kargs
.- 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.
kargs – 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(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[profile_module.Profile], profile_module.Profile]] [source]
Find a profile via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_repo(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[repo.Repo], repo.Repo]] [source]
Find a repository via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- find_system(name: str = '', return_list: bool = False, no_errors: bool = False, **kargs: FIND_KWARGS) Optional[Union[List[system_module.System], system_module.System]] [source]
Find a system via a name or keys specified in the
**kargs
.- 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.
kargs – Additional key-value pairs which may help in finding the desired objects.
- Returns
A single object or a list of all search results.
- 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_script(profile: Optional[str], system: Optional[str], 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_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_files_since(mtime: float, collapse: bool = False) List[File] [source]
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_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) Optional[ITEM_UNION] [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: 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 – 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_UNION [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_mgmtclasses_since(mtime: float, collapse: bool = False) List[Mgmtclass] [source]
Return management classes 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 management classes which are newer then the given timestamp.
- get_module_by_name(module_name: str) Optional[module] [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: Optional[str] = None) module [source]
Looks in
/etc/cobbler/settings.yaml
for 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: Optional[str] = None) str [source]
Looks up a module the same as
get_module_from_file
but returns the module name rather than the module itself.- Parameters
section –
name –
fallback –
- Returns
- get_modules_in_category(category: str) List[module] [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_packages_since(mtime: float, collapse: bool = False) List[Package] [source]
Return packages 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 packages 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: Item) 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: Item) 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_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: ITEM_UNION, 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: ITEM_UNION, 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_valid_obj_boot_loaders(obj: Union[Distro, Image]) List[str] [source]
Return the list of valid boot loaders for the object
- Parameters
obj – The object for which the boot loaders should be looked up.
- Returns
Get a list of all valid boot loaders.
- 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: Optional[str] = None, autoinstall_file: Optional[str] = None, rsync_flags: Optional[str] = None, arch: Optional[str] = None, breed: Optional[str] = None, os_version: Optional[str] = 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
- input_string_or_dict(options: Union[str, List[Any], Dict[Any, Any]], allow_multiples: bool = True) Union[str, Dict[Any, Any]] [source]
See also
- input_string_or_dict_no_inherit(options: Union[str, List[Any], Dict[Any, Any]], allow_multiples: bool = True) Dict[Any, Any] [source]
See also
- input_string_or_list(options: Optional[Union[str, List[Any]]]) Union[List[Any], str] [source]
See also
- input_string_or_list_no_inherit(options: Optional[Union[str, List[Any]]]) List[Any] [source]
See also
- 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: Optional[Union[str, List[Optional[str]], Dict[str, Any]]] = 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
- mgmtclasses() Mgmtclasses [source]
Return the current list of mgmtclasses
- mkloaders() None [source]
Create the GRUB installer images via this API call. It utilizes
grub2-mkimage
behind the curtain.
- 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_file(is_subobject: bool = False, **kwargs: Any) File [source]
Returns a new empty file 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 File 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) ITEM_UNION [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 File object.
- new_mgmtclass(is_subobject: bool = False, **kwargs: Any) Mgmtclass [source]
Returns a new empty mgmtclass object. This mgmtclass is not automatically persisted. Persistence is achieved via
save()
.- Parameters
is_subobject – If the object created is a subobject or not.
- Returns
An empty mgmtclass object.
- new_package(is_subobject: bool = False, **kwargs: Any) Package [source]
Returns a new empty package object. This package is not automatically persisted. Persistence is achieved via
save()
.- Parameters
is_subobject – If the object created is a subobject or not.
- Returns
An empty Package 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_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.
- power_system(system: System, power_operation: str, user: Optional[str] = None, password: Optional[str] = None) Optional[bool] [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
- remove_distro(ref: Union[Distro, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_file(ref: Union[File, str], recursive: bool = False, delete: bool = True, with_triggers: bool = True) None [source]
Remove a file from Cobbler.
- Parameters
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_image(ref: Union[Image, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_item(what: str, ref: Union[ITEM_UNION, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_mgmtclass(ref: Union[Mgmtclass, str], recursive: bool = False, delete: bool = True, with_triggers: bool = True) None [source]
Remove a management class from Cobbler.
- Parameters
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_package(ref: Union[Package, str], recursive: bool = False, delete: bool = True, with_triggers: bool = True) None [source]
Remove a package from Cobbler.
- Parameters
ref – The internal unique handle for the item.
recursive – If the item should recursively should delete dependencies on itself.
delete – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_profile(ref: Union[Profile, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_repo(ref: Union[Repo, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- remove_system(ref: Union[System, str], recursive: bool = False, delete: bool = True, with_triggers: 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 – Not known what this parameter does exactly.
with_triggers – Whether you would like to have the removal triggers executed or not.
- 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_file(ref: File, newname: str) None [source]
Rename a file 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: ITEM_UNION, 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_mgmtclass(ref: Mgmtclass, newname: str) None [source]
Rename a management class to a new name.
- Parameters
ref – The internal unique handle for the item.
newname – The new name for the item.
- rename_package(ref: Package, newname: str) None [source]
Rename a package 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_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.
- replicate(cobbler_master: Optional[str] = None, port: str = '80', distro_patterns: str = '', profile_patterns: str = '', system_patterns: str = '', repo_patterns: str = '', image_patterns: str = '', mgmtclass_patterns: str = '', package_patterns: str = '', file_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.
mgmtclass_patterns – The pattern of management classes which should be synced.
package_patterns – The pattern of packages which should be synced.
file_patterns – The pattern of files 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).
- report(report_what: str = '', report_name: str = '', report_type: str = '', report_fields: str = '', report_noheaders: bool = False) None [source]
Report functionality for Cobbler.
- Parameters
report_what – The object type that should be reported.
report_name – The name of the object which should be possibly reported.
report_type – May be either “text”, “csv”, “mediawiki”, “trac” or “doku”.
report_fields – Specify “all” or the fields you want to be reported.
report_noheaders – If the column headers should be included in the output or not.
- reposync(name: Optional[str] = None, tries: int = 1, nofail: bool = False) None [source]
Take the contents of
/var/lib/cobbler/repos
and 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
tries
parameter.
- set_item_resolved_value(item_uuid: str, attribute: 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 – 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) Union[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: Optional[List[str]] = 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.
- validate_autoinstall_files() None [source]
Validate if any of the autoinstallation files are invalid and if yes report this.
- version(extended: bool = False) Union[float, Dict[str, Union[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.
8.4. cobbler.autoinstall_manager module
This module contains code in order to create the automatic installation files. For example kickstarts, autoyast files or preseed files.
- class cobbler.autoinstall_manager.AutoInstallationManager(api: CobblerAPI)[source]
Bases:
object
Manage automatic installation templates, snippets and final files
- generate_autoinstall(profile: Optional[str] = None, system: Optional[str] = None) str [source]
Generates the autoinstallation for a system or a profile. You may only specifify one parameter. If you specify both, the system is generated and the profile argument is ignored.
- Parameters
profile – The Cobbler profile you want an autoinstallation generated for.
system – The Cobbler system you want an autoinstallation generated for.
- Returns
The rendered template for the system or profile.
- get_autoinstall_snippets() List[str] [source]
Get a list of all autoinstallation snippets.
- Returns
The list of snippets
- get_autoinstall_templates() List[str] [source]
Get automatic OS installation templates
- Returns
A list of automatic installation templates
- is_autoinstall_in_use(name: str) bool [source]
Reports the status if a given system is currently being provisioned.
- Parameters
name – The name of the system.
- Returns
Whether the system is in install mode or not.
- log_autoinstall_validation_errors(errors_type: int, errors: List[Any])[source]
Log automatic installation file errors
- Parameters
errors_type – validation errors type
errors – A list with all the errors which occurred.
- read_autoinstall_snippet(file_path: str) str [source]
Reads a autoinstall snippet from underneath the configured snippet base dir.
- Parameters
file_path – The relative file path under the configured snippets base dir.
- Returns
The read snippet.
- read_autoinstall_template(file_path: str) str [source]
Read an automatic OS installation template
- Parameters
file_path – automatic installation template relative file path
- Returns
automatic installation template content
- remove_autoinstall_snippet(file_path: str) bool [source]
Remove the autoinstall snippet with the given path.
- Parameters
file_path – The path relative to the configured snippet root.
- Returns
A boolean indicating the success of the task.
- remove_autoinstall_template(file_path: str)[source]
Remove an automatic OS installation template
- Parameters
file_path – automatic installation template relative file path
- validate_autoinstall_file(obj: Item, is_profile: bool) List[Any] [source]
Validate automatic installation file used by a system/profile.
- Parameters
obj – system/profile
is_profile – if obj is a profile
- Returns
[bool, int, list] list with validation result, errors type and list of errors
- validate_autoinstall_files() bool [source]
Determine if Cobbler automatic OS installation files will be accepted by corresponding Linux distribution installers. The presence of an error does not imply that the automatic installation file is bad, only that the possibility exists. Automatic installation file validators are not available for all automatic installation file types and on all operating systems in which Cobbler may be installed.
- Returns
True if all automatic installation files are valid, otherwise false.
- validate_autoinstall_snippet_file_path(snippet: str, new_snippet: bool = False) str [source]
Validate the snippet’s relative file path.
- Parameters
snippet – automatic installation snippet relative file path
new_snippet – when set to true new filenames are allowed
- Returns
Snippet if successful otherwise raises an exception.
- Raises
TypeError – Raised in case
snippet
is not a string.ValueError – Raised in case snippet file is invalid.
OSError – Raised in case snippet file location is not found.
- validate_autoinstall_template_file_path(autoinstall: str, for_item: bool = True, new_autoinstall: bool = False) str [source]
Validate the automatic installation template’s relative file path.
- Parameters
autoinstall – automatic installation template relative file path
for_item – enable/disable special handling for Item objects
new_autoinstall – when set to true new filenames are allowed
- Returns
automatic installation template relative file path
- Raises
TypeError – Raised in case
autoinstall
is not a string.OSError – Raised in case template file not found.
ValueError – Raised in case template file is invalid.
8.5. cobbler.autoinstallgen module
Builds out filesystem trees/data based on the object tree. This is the code behind ‘cobbler sync’.
- class cobbler.autoinstallgen.AutoInstallationGen(api: CobblerAPI)[source]
Bases:
object
Handles conversion of internal state to the tftpboot tree layout
- add_autoyast_script(document: Document, script_type: str, source: str)[source]
Add scripts to an existing AutoYaST XML.
- Parameters
document – The existing AutoYaST XML object.
script_type – The type of the script which should be added.
source – The source of the script. This should be ideally a string.
- create_autoyast_script(document: Document, script: str, name: str) Element [source]
This method attaches a script with a given name to an existing AutoYaST XML file.
- Parameters
document – The existing AutoYaST XML file.
script – The script to attach.
name – The name of the script.
- Returns
The AutoYaST file with the attached script.
- generate_autoinstall(profile: Optional[Profile] = None, system: Optional[System] = None) str [source]
This is an internal method for generating an autoinstall config/script. Please use the
generate_autoinstall_for_*
methods. If you insist on using this mehtod please only supply a profile or a system, not both.- Parameters
profile – The profile to use for generating the autoinstall config/script.
system – The system to use for generating the autoinstall config/script. If both arguments are given, this wins.
- Returns
The autoinstall script or configuration file as a string.
- generate_autoinstall_for_profile(profile: str) str [source]
Generate an autoinstall config or script for a profile.
- Parameters
profile – The Profile to generate the script/config for.
- Returns
The generated output or an error message with a human readable description.
- Raises
CX – Raised in case the profile references a missing distro.
- generate_autoinstall_for_system(sys_name: str) str [source]
Generate an autoinstall config or script for a system.
- Parameters
sys_name – The system name to generate an autoinstall script for.
- Returns
The generated output or an error message with a human readable description.
- Raises
CX – Raised in case the system references a missing profile.
- generate_autoyast(profile: Optional[Profile] = None, system: Optional[System] = None, raw_data: Optional[str] = None) str [source]
Generate auto installation information for SUSE distribution (AutoYaST XML file) for a specific system or general profile. Only a system OR profile can be supplied, NOT both.
- Parameters
profile – The profile to generate the AutoYaST file for.
system – The system to generate the AutoYaST file for.
raw_data – The raw data which should be included in the profile.
- Returns
The generated AutoYaST XML file.
- generate_config_stanza(obj: Union[Profile, System], is_profile: bool = True) str [source]
Add in automatic to configure /etc/yum.repos.d on the remote system if the automatic installation file (template file) contains the magic $yum_config_stanza.
- Parameters
obj – The profile or system to generate a generate a config stanza for.
is_profile – If the object is a profile. If False it is assumed that the object is a system.
- Returns
The curl command to execute to get the configuration for a system or profile.
- generate_repo_stanza(obj: Union[Profile, System], is_profile: bool = True) str [source]
Automatically attaches yum repos to profiles/systems in automatic installation files (template files) that contain the magic $yum_repo_stanza variable. This includes repo objects as well as the yum repos that are part of split tree installs, whose data is stored with the distro (example: RHEL5 imports)
- Parameters
obj – The profile or system to generate the repo stanza for.
is_profile – If True then obj is a profile, otherwise obj has to be a system. Otherwise this method will silently fail.
- Returns
The string with the attached yum repos.
8.6. cobbler.cexceptions module
Custom exceptions for Cobbler
8.7. cobbler.cli module
Command line interface for Cobbler.
- class cobbler.cli.CobblerCLI(cliargs)[source]
Bases:
object
Main CLI Class which contains the logic to communicate with the Cobbler Server.
- check_setup() int [source]
Detect permissions and service accessibility problems and provide nicer error messages for them.
- cleanup_fault_string(fault_str: str) str [source]
Make a remote exception nicely readable by humans so it’s not evident that is a remote fault. Users should not have to understand tracebacks.
- Parameters
fault_str – The stacktrace to niceify.
- Returns
A nicer error messsage.
- direct_command(action_name: str)[source]
Process non-object based commands like “sync” and “hardlink”.
- Parameters
action_name – The action to execute.
- Returns
Depending on the action.
- follow_task(task_id)[source]
Parse out this task’s specific messages from the global log
- Parameters
task_id – The id of the task to follow.
- get_direct_action(object_type, args) Optional[str] [source]
If this is a general command, e.g. “cobbler hardlink”, return the action, like “hardlink”
- Parameters
object_type – Must be None or None is returned.
args – The arg from the CLI.
- Returns
The action key, “version” or None.
- get_fields(object_type: str) list [source]
For a given name of an object type, return the FIELDS data structure.
- Parameters
object_type – The object to return the fields of.
- Returns
The fields or None
- get_object_action(object_type, args) Optional[str] [source]
If this is a CLI command about an object type, e.g. “cobbler distro add”, return the action, like “add”
- Parameters
object_type – The object type.
args – The args from the CLI.
- Returns
The action or None.
- get_object_type(args) Optional[str] [source]
If this is a CLI command about an object type, e.g. “cobbler distro add”, return the type, like “distro”
- Parameters
args – The args from the CLI.
- Returns
The object type or None
- object_command(object_type: str, object_action: str) int [source]
Process object-based commands such as “distro add” or “profile rename”
- Parameters
object_type – The object type to execute an action for.
object_action – The action to execute.
- Returns
Depending on the object and action.
- Raises
- print_help() int [source]
Prints general-top level help, e.g. “cobbler –help” or “cobbler” or “cobbler command-does-not-exist”
- print_object_help(object_type) int [source]
Prints the subcommands for a given object, e.g. “cobbler distro –help”
- Parameters
object_type – The object type to print the help for.
- print_task(task_id)[source]
Pretty print a task executed on the server. This prints to stdout.
- Parameters
task_id – The id of the task to be pretty printed.
- run(args) int [source]
Process the command line and do what the user asks.
- Parameters
args – The args of the CLI
- start_task(name: str, options: dict) str [source]
Start an asynchronous task in the background.
- Parameters
name – “background_” % name function must exist in remote.py. This function will be called in a subthread.
options – Dictionary of options passed to the newly started thread
- Returns
Id of the newly started task
- cobbler.cli.add_options_from_fields(object_type, parser, fields, network_interface_fields, settings, object_action)[source]
Add options to the command line from the fields queried from the Cobbler server.
- Parameters
object_type – The object type to add options for.
parser – The optparse instance to add options to.
fields – The list of fields to add options for.
network_interface_fields – The list of network interface fields if the object type is a system.
settings – Global cobbler settings as returned from
CollectionManager.settings()
object_action – The object action to add options for. May be “add”, “edit”, “find”, “copy”, “rename”, “remove”. If none of these options is given then this method does nothing.
- cobbler.cli.get_comma_separated_args(option: Option, opt_str, value: str, parser: OptionParser)[source]
Simple callback function to achieve option split with comma.
- Reference for the method signature can be found at:
https://docs.python.org/3/library/optparse.html#defining-a-callback-option
- Parameters
option – The option the callback is executed for
opt_str – Unused for this callback function. Would be the extended option if the user used the short version.
value – The value which should be split by comma.
parser – The optparse instance which the callback should be added to.
- cobbler.cli.list_items(remote, otype)[source]
List all items of a given object type and print it to stdout.
- Parameters
remote – The remote to use as the query-source.
otype – The object type to query.
- cobbler.cli.n2s(data)[source]
Return spaces for None
- Parameters
data – The data to check for.
- Returns
The data itself or an empty string.
- cobbler.cli.opt(options, k, defval='')[source]
Returns an option from an Optparse values instance
- Parameters
options – The options object to search in.
k – The key which is in the optparse values instance.
defval – The default value to return.
- Returns
The value for the specified key.
- cobbler.cli.report_item(remote, otype: str, item=None, name=None)[source]
Return a single item in a given collection. Either this is an item object or this method searches for a name.
- Parameters
remote – The remote to use as the query-source.
otype – The object type to query.
item – The item to display
name – The name to search for and display.
- cobbler.cli.report_items(remote, otype: str)[source]
Return all items for a given collection.
- Parameters
remote – The remote to use as the query-source. The remote to use as the query-source.
otype – The object type to query.
- cobbler.cli.report_single_breed(name: str, items: dict) int [source]
Helper function which prints a single signature breed list to the terminal.
- cobbler.cli.to_string_from_fields(item_dict, fields, interface_fields=None) str [source]
item_dict is a dictionary, fields is something like item_distro.FIELDS :param item_dict: The dictionary representation of a Cobbler item. :param fields: This is the list of fields a Cobbler item has. :param interface_fields: This is the list of fields from a network interface of a system. This is optional. :return: The string representation of a Cobbler item with all its values.
8.8. cobbler.cobblerd module
Cobbler daemon for logging remote syslog traffic during automatic installation
- cobbler.cobblerd.core(cobbler_api: CobblerAPI) None [source]
Starts Cobbler.
- Parameters
cobbler_api – The cobbler_api instance which is used for this method.
- cobbler.cobblerd.do_xmlrpc_rw(cobbler_api: CobblerAPI, port: int) None [source]
This trys to bring up the Cobbler xmlrpc_api and restart it if it fails.
- Parameters
cobbler_api – The cobbler_api instance which is used for this method.
port – The port where the xmlrpc api should run on.
8.9. cobbler.configgen module
configgen.py: Generate configuration data.
module for generating configuration manifest using autoinstall_meta data, mgmtclasses, resources, and templates for a given system (hostname)
- class cobbler.configgen.ConfigGen(cobbler_api: CobblerAPI, hostname: str)[source]
Bases:
object
Generate configuration data for Cobbler’s management resources: repos, files and packages. Mainly used by Koan to configure systems.
- gen_config_data() Dict[Any, Any] [source]
Generate configuration data for repos, files and packages.
- Returns
A dict which has all config data in it.
- Raises
CX – In case the package or file resource is not defined.
- 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) Union[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: Union[ResourceAction, str]) str [source]
Substitute variables in strings with data from the
autoinstall_meta
dictionary 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.
8.10. 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:
InheritableProperty
This 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:
LazyProperty
This property is supposed to provide a way to identify properties in code that can be set to inherit.
- inheritable = True
8.11. cobbler.download_manager module
Cobbler DownloadManager
- class cobbler.download_manager.DownloadManager[source]
Bases:
object
TODO
- urlread(url: str, proxies: Any = None, cert: Optional[Union[str, Tuple[str, str]]] = 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.Response
object.
8.12. 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:
ConvertableEnum
This 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.BaudRates(value)[source]
Bases:
Enum
This 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.ConvertableEnum(value)[source]
Bases:
Enum
Abstract class to convert the enum via our convert method.
- classmethod to_enum(value: Union[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.EventStatus(value)[source]
Bases:
ConvertableEnum
This 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:
ConvertableEnum
This 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:
ConvertableEnum
This 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.
- MGMTCLASS = 'mgmtclass'
See
Mgmtclass()
- class cobbler.enums.MirrorType(value)[source]
Bases:
ConvertableEnum
This enum represents all mirror types which Cobbler can manage.
- BASEURL = 'baseurl'
- METALINK = 'metalink'
- MIRRORLIST = 'mirrorlist'
- NONE = 'none'
- class cobbler.enums.NetworkInterfaceType(value)[source]
Bases:
Enum
This enum represents all interface types Cobbler is able to set up on a target host.
- BMC = 6
- BOND = 1
- BONDED_BRIDGE_SLAVE = 5
- BOND_SLAVE = 2
- BRIDGE = 3
- BRIDGE_SLAVE = 4
- INFINIBAND = 7
- NA = 0
- class cobbler.enums.RepoArchs(value)[source]
Bases:
ConvertableEnum
This 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:
ConvertableEnum
This 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:
ConvertableEnum
This enum represents all actions a resource may execute.
- CREATE = 'create'
- REMOVE = 'remove'
- class cobbler.enums.TlsRequireCert(value)[source]
Bases:
ConvertableEnum
This 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:
ConvertableEnum
This 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:
ConvertableEnum
This 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'
8.13. cobbler.grub module
Module that contains GRUB related helper functionality.
- cobbler.grub.parse_grub_remote_file(file_location: str) Optional[str] [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
8.14. cobbler.manager module
8.15. cobbler.module_loader module
Module loader, adapted for Cobbler usage
- class cobbler.module_loader.ModuleLoader(api: CobblerAPI, module_path: str = '')[source]
Bases:
object
Class for dynamically loading Cobbler Plugins on startup
- get_module_by_name(name: str) Optional[module] [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: Optional[str] = None) module [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: Optional[str] = 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.
8.16. 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:
object
Handles power management in systems
- get_power_status(system: System, user: Optional[str] = None, password: Optional[str] = None) Optional[bool] [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: Optional[str] = None, password: Optional[str] = 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) Optional[str] [source]
Get power management command path
- Parameters
power_type – power management type
- Returns
power management command path
8.17. 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.
- V3.4.0 (unreleased)
- Added:
set_item_resolved_value
input_string_or_list_no_inherit
input_string_or_list
input_string_or_dict
input_string_or_dict_no_inherit
input_boolean
input_int
- V3.3.4 (unreleased)
No changes
- V3.3.3
- Added:
get_item_resolved_value
dump_vars
- V3.3.2
No changes
- V3.3.1
- Changed:
background_mkgrub
: Renamed tobackground_mkloaders
- V3.3.0
- Added:
background_syncsystems
background_mkgrub
get_menu
find_menu
get_menu_handle
remove_menu
copy_menu
rename_menu
new_menu
modify_menu
save_menu
get_valid_distro_boot_loaders
get_valid_image_boot_loaders
get_valid_profile_boot_loaders
get_valid_system_boot_loaders
get_menus_since
get_menu_as_rendered
- Changed:
generate_gpxe
: Renamed togenerate_ipxe
- Removed:
background_dlcontent
get_distro_for_koan
get_profile_for_koan
get_system_for_koan
get_repo_for_koan
get_image_for_koan
get_mgmtclass_for_koan
get_package_for_koan
get_file_for_koan
get_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_autoinstall
generate_system_autoinstall
get_valid_archs
read_autoinstall_template
write_autoinstall_template
remove_autoinstall_template
read_autoinstall_snippet
write_autoinstall_snippet
remove_autoinstall_snippet
- Changed:
get_kickstart_templates
: Renamed toget_autoinstall_templates
get_snippets
: Renamed toget_autoinstall_snippets
is_kickstart_in_use
: Renamed tois_autoinstall_in_use
generate_kickstart
: Renamed togenerate_autoinstall
- Removed:
update
read_or_write_kickstart_template
read_or_write_snippet
- V2.8.5
Inital tracking of changes.
- class cobbler.remote.CobblerXMLRPCInterface(api: CobblerAPI)[source]
Bases:
object
This 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]
TODO
- Parameters
options – TODO
token – TODO
- Returns
TODO
- 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_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_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: Optional[str], resource: str, arg1: Optional[str] = None, arg2: Optional[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: Optional[str] = None, arg2: Optional[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: Optional[str] = None)[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_file(object_id: str, newname: str, token: Optional[str] = None)[source]
Copies a file 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_image(object_id: str, newname: str, token: Optional[str] = None)[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: Optional[str] = None)[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_mgmtclass(object_id: str, newname: str, token: Optional[str] = None)[source]
Copies a management class 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_package(object_id: str, newname: str, token: Optional[str] = None)[source]
Copies a package 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: Optional[str] = None)[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_repo(object_id: str, newname: str, token: Optional[str] = None)[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: Optional[str] = None)[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.
- disable_netboot(name: str, token: Optional[str] = None, **rest: Any) bool [source]
This is a feature used by the
pxe_just_once
support, 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: Optional[str] = None, **rest: Any) Dict[str, Union[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: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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_file(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = None, **rest: Any) List[Any] [source]
Find a file 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_image(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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: Optional[Dict[str, Any]] = None, sort_field: Optional[str] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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: Optional[Dict[str, Any]] = None, sort_field: Optional[str] = None, page: int = 1, items_per_page: int = 25, resolved: bool = False, token: Optional[str] = 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_mgmtclass(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = None, **rest: Any) List[Any] [source]
Find a management class 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 management classes which have matched the criteria.
- find_package(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = None, **rest: Any) List[Any] [source]
Find a package 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 packages which have matched the criteria.
- find_profile(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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_repo(criteria: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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: Optional[Dict[str, Any]] = None, expand: bool = False, resolved: bool = False, token: Optional[str] = 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.
- generate_autoinstall(profile: Optional[str] = None, system: Optional[str] = None, REMOTE_ADDR: Optional[Any] = None, REMOTE_MAC: Optional[Any] = None, **rest: Any) str [source]
Generate the autoinstallation file and return it.
- Parameters
profile – The profile to generate the file for.
system – The system to generate the file for.
REMOTE_ADDR – This is dropped in this method since it is not needed here.
REMOTE_MAC – This is dropped in this method since it is not needed here.
rest – This is dropped in this method since it is not needed here.
- Returns
The str representation of the file.
- generate_bootcfg(profile: Optional[str] = None, system: Optional[str] = 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: Optional[str] = None, image: Optional[str] = None, system: Optional[str] = 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_profile_autoinstall(profile: str)[source]
Generate a profile autoinstallation.
- Parameters
profile – The profile to generate the file for.
- Returns
The str representation of the file.
- generate_script(profile: Optional[str] = None, system: Optional[str] = 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.