Client module documentation

This module provides acces to the API of a foreman server

class foreman.client.Foreman(url='http://localhost:3000', auth=None, version=None)[source]
bootfiles_operatingsystems(id, medium=None, architecture=None)
Parameters:
  • medium – type String, optional
  • id – type String, required
  • architecture – type String, optional
build_pxe_default_config_templates()
create_architectures(architecture)
Parameters:
  • architecture[name] – type String, required
  • architecture[operatingsystem_ids] – type Array, optional
  • architecture – type Hash, required
create_auth_source_ldaps(auth_source_ldap)
Parameters:
  • auth_source_ldap[tls] – type ‘true’ or ‘false’, optional
  • auth_source_ldap[attr_login] – type String, required
  • auth_source_ldap[name] – type String, required
  • auth_source_ldap[attr_mail] – type String, required
  • auth_source_ldap[port] – type number., optional
  • auth_source_ldap[account] – type String, optional
  • auth_source_ldap[account_password] – type String, required
  • auth_source_ldap[attr_firstname] – type String, required
  • auth_source_ldap[attr_lastname] – type String, required
  • auth_source_ldap[onthefly_register] – type ‘true’ or ‘false’, optional
  • auth_source_ldap – type Hash, required
  • auth_source_ldap[base_dn] – type String, optional
  • auth_source_ldap[host] – type String, required
create_bookmarks(bookmark)
Parameters:
  • bookmark – type Hash, required
  • bookmark[name] – type String, required
  • bookmark[public] – type ‘true’ or ‘false’, optional
  • bookmark[controller] – type String, required
  • bookmark[query] – type String, required
create_common_parameters(common_parameter)
Parameters:
  • common_parameter[value] – type String, required
  • common_parameter[name] – type String, required
  • common_parameter – type Hash, required
create_compute_resources(compute_resource)
Parameters:
  • compute_resource[password] – type String, optional
  • compute_resource[name] – type String, optional
  • compute_resource – type Hash, required
  • compute_resource[url] – type String, required
  • compute_resource[description] – type String, optional
  • compute_resource[server] – type String, optional
  • compute_resource[uuid] – type String, optional
  • compute_resource[tenant] – type String, optional
  • compute_resource[user] – type String, optional
  • compute_resource[provider] – type String, optional
  • compute_resource[region] – type String, optional
create_config_templates(config_template)
Parameters:
  • config_template – type Hash, required
  • config_template[template_combinations_attributes] – type Array, optional
  • config_template[template_kind_id] – type number., optional
  • config_template[name] – type String, required
  • config_template[operatingsystem_ids] – type Array, optional
  • config_template[audit_comment] – type String, optional
  • config_template[snippet] – type ‘true’ or ‘false’, optional
  • config_template[template] – type String, required
create_domains(domain)
Parameters:
  • domain[domain_parameters_attributes] – type Array, optional
  • domain[name] – type String, required
  • domain – type Hash, required
  • domain[dns_id] – type number., optional
  • domain[fullname] – type String, optional
create_environments(environment)
Parameters:
  • environment[name] – type String, required
  • environment – type Hash, required
create_hostgroups(hostgroup)
Parameters:
  • hostgroup[operatingsystem_id] – type number., optional
  • hostgroup[puppet_ca_proxy_id] – type number., optional
  • hostgroup[ptable_id] – type number., optional
  • hostgroup[environment_id] – type number., optional
  • hostgroup[medium_id] – type number., optional
  • hostgroup – type Hash, required
  • hostgroup[subnet_id] – type number., optional
  • hostgroup[architecture_id] – type number., optional
  • hostgroup[name] – type String, required
  • hostgroup[puppet_proxy_id] – type number., optional
  • hostgroup[domain_id] – type number., optional
create_hosts(host)
Parameters:
  • host[hostgroup_id] – type number., optional
  • host[architecture_id] – type number., required
  • host[sp_subnet_id] – type number., optional
  • host[subnet_id] – type number., optional
  • host[owner_id] – type number., optional
  • host – type Hash, required
  • host[host_parameters_attributes] – type Array, optional
  • host[name] – type String, required
  • host[model_id_id] – type number., optional
  • host[puppet_ca_proxy_id] – type number., optional
  • host[domain_id] – type number., required
  • host[mac] – type String, required
  • host[ip] – type String, required
  • host[operatingsystem_id] – type String, required
  • host[ptable_id] – type number., optional
  • host[image_id] – type number., optional
  • host[medium_id] – type number., optional
  • host[puppet_proxy_id] – type number., required
  • host[environment_id] – type String, required
create_images(compute_resource_id, image)
Parameters:
  • image[name] – type String, required
  • image[username] – type String, required
  • image[architecture_id] – type number., required
  • compute_resource_id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • image[compute_resource_id] – type number., required
  • image[operatingsystem_id] – type number., required
  • image – type Hash, required
  • image[uuid] – type String, required
create_lookup_keys(lookup_key)
Parameters:
  • lookup_key[default_value] – type String, optional
  • lookup_key[description] – type String, optional
  • lookup_key[path] – type String, optional
  • lookup_key[puppetclass_id] – type number., optional
  • lookup_key – type Hash, required
  • lookup_key[key] – type String, required
  • lookup_key[lookup_values_count] – type number., optional
create_media(medium)
Parameters:
  • medium – type Hash, required
  • medium[os_family] – type String, optional
  • medium[name] – type String, required
  • medium[path] – type String, required
create_models(model)
Parameters:
  • model[name] – type String, required
  • model[hardware_model] – type String, optional
  • model[vendor_class] – type String, optional
  • model – type Hash, required
  • model[info] – type String, optional
create_operatingsystems(operatingsystem)
Parameters:
  • operatingsystem – type Hash, required
  • operatingsystem[minor] – type String, required
  • operatingsystem[family] – type String, optional
  • operatingsystem[release_name] – type String, optional
  • operatingsystem[major] – type String, required
  • operatingsystem[name] – type regular expression /A(S+)Z/., required
create_ptables(ptable)
Parameters:
  • ptable[layout] – type String, required
  • ptable – type Hash, required
  • ptable[name] – type String, required
  • ptable[os_family] – type String, optional
create_puppetclasses(puppetclass)
Parameters:
  • puppetclass[name] – type String, required
  • puppetclass – type Hash, required
create_roles(role)
Parameters:
  • role – type Hash, required
  • role[name] – type String, required
create_smart_proxies(smart_proxy)
Parameters:
  • smart_proxy[name] – type String, required
  • smart_proxy – type Hash, required
  • smart_proxy[url] – type String, required
create_subnets(subnet)
Parameters:
  • subnet[mask] – type String, required
  • subnet[vlanid] – type String, optional
  • subnet[dns_primary] – type String, optional
  • subnet[gateway] – type String, optional
  • subnet[to] – type String, optional
  • subnet – type Hash, required
  • subnet[dns_id] – type number., optional
  • subnet[dhcp_id] – type number., optional
  • subnet[from] – type String, optional
  • subnet[name] – type String, required
  • subnet[network] – type String, required
  • subnet[dns_secondary] – type String, optional
  • subnet[domain_ids] – type Array, optional
  • subnet[tftp_id] – type number., optional
create_usergroups(usergroup)
Parameters:
  • usergroup – type Hash, required
  • usergroup[name] – type String, required
create_users(user)
Parameters:
  • user[login] – type String, required
  • user – type Hash, required
  • user[firstname] – type String, optional
  • user[admin] – type ‘true’ or ‘false’, optional
  • user[password] – type String, required
  • user[auth_source_id] – type Integer, required
  • user[lastname] – type String, optional
  • user[mail] – type String, required
destroy_architectures(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_auth_source_ldaps(id)
Parameters:id – type String, required
destroy_bookmarks(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_common_parameters(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_compute_resources(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_config_templates(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_domains(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_environments(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_hostgroups(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_hosts(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_images(id, compute_resource_id)
Parameters:
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • compute_resource_id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_lookup_keys(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_media(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
destroy_models(id)
Parameters:id – type String, required
destroy_operatingsystems(id)
Parameters:id – type String, required
destroy_ptables(id)
Parameters:id – type String, required
destroy_puppetclasses(id)
Parameters:id – type String, required
destroy_reports(id)
Parameters:id – type String, required
destroy_roles(id)
Parameters:id – type String, required
destroy_smart_proxies(id)
Parameters:id – type String, required
destroy_subnets(id)
Parameters:id – type number., required
destroy_usergroups(id)
Parameters:id – type String, required
destroy_users(id)
Parameters:id – type String, required
do_delete(rtype, mtype, **kwargs)[source]
Parameters:rtype – Request type, one of [‘index’, ‘show’, ‘status’,

‘create’, ‘update’, ‘destroy’] :param mtype: Model type, the data model with wich we are interacting, for example host or environment. :param **kwargs: parameters for the api call

do_get(rtype, mtype, **kwargs)[source]
Parameters:rtype – Request type, one of [‘index’, ‘show’, ‘status’,

‘create’, ‘update’, ‘destroy’] :param mtype: Model type, the data model with wich we are interacting, for example host or environment. :param **kwargs: parameters for the api call

do_post(rtype, mtype, **kwargs)[source]
Parameters:rtype – Request type, one of [‘index’, ‘show’, ‘status’,

‘create’, ‘update’, ‘destroy’] :param mtype: Model type, the data model with wich we are interacting, for example host or environment. :param **kwargs: parameters for the api call

do_put(rtype, mtype, **kwargs)[source]
Parameters:rtype – Request type, one of [‘index’, ‘show’, ‘status’,

‘create’, ‘update’, ‘destroy’] :param mtype: Model type, the data model with wich we are interacting, for example host or environment. :param **kwargs: parameters for the api call

get_foreman_version()[source]

Even if we have an api method that return the foreman version, we need the version first to know it’s path, so instead of that we get the main page and extract the version from the footer.

hosts_release(query=None, amount=None, host_name=None)
Parameters:
  • query – type String, optional
  • amount – type Integer, optional
  • host_name – type String, optional
hosts_reserve(reason, query=None, amount=None)
Parameters:
  • query – type String, optional
  • reason – type String, required
  • amount – type Integer, optional
index_architectures(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_audits(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_auth_source_ldaps(per_page=None, page=None)
Parameters:
  • per_page – type String, optional
  • page – type String, optional
index_bookmarks(per_page=None, page=None)
Parameters:
  • per_page – type String, optional
  • page – type String, optional
index_common_parameters(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_compute_resources(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_config_templates(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_dashboard(search=None)
Parameters:search – type String, optional
index_domains(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_environments(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_fact_values(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_home()
index_hostgroups(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_hosts(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_images(compute_resource_id, page=None, per_page=None, search=None, order=None)
Parameters:
  • page – type String, optional
  • per_page – type String, optional
  • search – type String, optional
  • order – type String, optional
  • compute_resource_id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
index_lookup_keys(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_media(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_models(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_operatingsystems(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_ptables(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_puppetclasses(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_reports(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_roles(per_page=None, page=None)
Parameters:
  • per_page – type String, optional
  • page – type String, optional
index_settings(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_smart_proxies(per_page=None, type=None, page=None)
Parameters:
  • per_page – type String, optional
  • type – type String, optional
  • page – type String, optional
index_subnets(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_template_kinds(per_page=None, page=None)
Parameters:
  • per_page – type String, optional
  • page – type String, optional
index_usergroups(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
index_users(per_page=None, search=None, page=None, order=None)
Parameters:
  • per_page – type String, optional
  • search – type String, optional
  • page – type String, optional
  • order – type String, optional
last_reports(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
revision_config_templates(version=None)
Parameters:version – type String, optional
send_request(rtype, mtype, **params)[source]
Parameters:rtype – Request type, one of [‘index’, ‘show’, ‘status’,

‘create’, ‘update’, ‘destroy’, ‘GET’, ‘POST’, ‘PUT’, ‘DELETE’] :param mtype: Model type, the data model with wich we are interacting, for example host or environment. :param **params: parameters for the api call

show_architectures(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_audits(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_auth_source_ldaps(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_available(query=None, amount=None)
Parameters:
  • query – type String, optional
  • amount – type Integer, optional
show_bookmarks(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_common_parameters(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_compute_resources(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_config_templates(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_domains(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_environments(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_hostgroups(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_hosts(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space., required
show_images(id, compute_resource_id)
Parameters:
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • compute_resource_id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_lookup_keys(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_media(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_models(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_operatingsystems(id)
Parameters:id – type String, required
show_ptables(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_puppetclasses(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_reports(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_reserved(query=None)
Parameters:query – type String, optional
show_roles(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_settings(id)
Parameters:id – type String, required
show_smart_proxies(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_subnets(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_usergroups(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
show_users(id)
Parameters:id – type String, required
status_home()
status_hosts(id)
Parameters:id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, dot(.), space, underscore(_), hypen(-) with no leading or trailing space., required
update_architectures(id, architecture)
Parameters:
  • architecture[name] – type String, optional
  • architecture[operatingsystem_ids] – type Array, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • architecture – type Hash, required
update_auth_source_ldaps(auth_source_ldap, id)
Parameters:
  • auth_source_ldap[tls] – type ‘true’ or ‘false’, optional
  • auth_source_ldap[attr_login] – type String, required
  • auth_source_ldap[name] – type String, optional
  • auth_source_ldap[attr_mail] – type String, required
  • auth_source_ldap[port] – type number., optional
  • auth_source_ldap[account] – type String, optional
  • auth_source_ldap[account_password] – type String, required
  • auth_source_ldap[attr_firstname] – type String, required
  • auth_source_ldap[attr_lastname] – type String, required
  • auth_source_ldap[onthefly_register] – type ‘true’ or ‘false’, optional
  • auth_source_ldap – type Hash, required
  • auth_source_ldap[base_dn] – type String, optional
  • id – type String, required
  • auth_source_ldap[host] – type String, optional
update_bookmarks(bookmark, id)
Parameters:
  • bookmark[public] – type ‘true’ or ‘false’, optional
  • bookmark – type Hash, required
  • bookmark[name] – type String, optional
  • bookmark[controller] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • bookmark[query] – type String, optional
update_common_parameters(common_parameter, id)
Parameters:
  • common_parameter[value] – type String, optional
  • common_parameter[name] – type String, optional
  • common_parameter – type Hash, required
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_compute_resources(compute_resource, id)
Parameters:
  • compute_resource[password] – type String, optional
  • compute_resource[name] – type String, optional
  • compute_resource – type Hash, required
  • compute_resource[url] – type String, optional
  • compute_resource[description] – type String, optional
  • compute_resource[server] – type String, optional
  • compute_resource[uuid] – type String, optional
  • compute_resource[tenant] – type String, optional
  • compute_resource[user] – type String, optional
  • compute_resource[provider] – type String, optional
  • compute_resource[region] – type String, optional
  • id – type String, required
update_config_templates(config_template, id)
Parameters:
  • config_template – type Hash, required
  • config_template[template_combinations_attributes] – type Array, optional
  • config_template[template_kind_id] – type number., optional
  • config_template[name] – type String, optional
  • config_template[operatingsystem_ids] – type Array, optional
  • config_template[audit_comment] – type String, optional
  • config_template[snippet] – type ‘true’ or ‘false’, optional
  • config_template[template] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_domains(domain, id)
Parameters:
  • domain[domain_parameters_attributes] – type Array, optional
  • domain[dns_id] – type number., optional
  • domain – type Hash, required
  • domain[name] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • domain[fullname] – type String, optional
update_environments(environment, id)
Parameters:
  • environment[name] – type String, optional
  • environment – type Hash, required
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_hostgroups(hostgroup, id)
Parameters:
  • hostgroup[operatingsystem_id] – type number., optional
  • hostgroup[puppet_ca_proxy_id] – type number., optional
  • hostgroup[ptable_id] – type number., optional
  • hostgroup[environment_id] – type number., optional
  • hostgroup[medium_id] – type number., optional
  • hostgroup – type Hash, required
  • hostgroup[subnet_id] – type number., optional
  • hostgroup[architecture_id] – type number., optional
  • hostgroup[name] – type String, optional
  • hostgroup[puppet_proxy_id] – type number., optional
  • hostgroup[domain_id] – type number., optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_hosts(host, id)
Parameters:
  • host[hostgroup_id] – type number., optional
  • host[architecture_id] – type number., optional
  • host[sp_subnet_id] – type number., optional
  • host[subnet_id] – type number., optional
  • host[owner_id] – type number., optional
  • host – type Hash, required
  • host[host_parameters_attributes] – type Array, optional
  • host[name] – type String, optional
  • host[model_id_id] – type number., optional
  • host[puppet_ca_proxy_id] – type number., optional
  • host[domain_id] – type number., optional
  • host[mac] – type String, required
  • host[ip] – type String, required
  • host[operatingsystem_id] – type String, optional
  • host[ptable_id] – type number., optional
  • host[image_id] – type number., optional
  • host[medium_id] – type number., optional
  • host[puppet_proxy_id] – type number., optional
  • host[environment_id] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_images(compute_resource_id, image, id)
Parameters:
  • image[name] – type String, optional
  • image[username] – type String, optional
  • image[architecture_id] – type number., optional
  • compute_resource_id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • image[compute_resource_id] – type number., optional
  • image[operatingsystem_id] – type number., optional
  • image – type Hash, required
  • image[uuid] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
update_lookup_keys(lookup_key, id)
Parameters:
  • lookup_key[path] – type String, optional
  • lookup_key[puppetclass_id] – type number., optional
  • lookup_key[description] – type String, optional
  • lookup_key – type Hash, required
  • lookup_key[default_value] – type String, optional
  • lookup_key[key] – type String, optional
  • id – type identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space., required
  • lookup_key[lookup_values_count] – type number., optional
update_media(medium, id)
Parameters:
  • medium – type Hash, required
  • medium[os_family] – type String, optional
  • medium[name] – type String, optional
  • id – type String, required
  • medium[path] – type String, optional
update_models(model, id)
Parameters:
  • model[name] – type String, optional
  • model[vendor_class] – type String, optional
  • model[hardware_model] – type String, optional
  • model[info] – type String, optional
  • model – type Hash, required
  • id – type String, required
update_operatingsystems(operatingsystem, id)
Parameters:
  • operatingsystem – type Hash, required
  • operatingsystem[minor] – type String, optional
  • operatingsystem[family] – type String, optional
  • operatingsystem[release_name] – type String, optional
  • operatingsystem[major] – type String, optional
  • operatingsystem[name] – type regular expression /A(S+)Z/., optional
  • id – type String, required
update_ptables(ptable, id)
Parameters:
  • ptable[layout] – type String, optional
  • ptable – type Hash, required
  • ptable[name] – type String, optional
  • ptable[os_family] – type String, optional
  • id – type String, required
update_puppetclasses(puppetclass, id)
Parameters:
  • puppetclass[name] – type String, optional
  • puppetclass – type Hash, required
  • id – type String, required
update_reserved_reason(reason, query=None, amount=None)
Parameters:
  • query – type String, optional
  • reason – type String, required
  • amount – type Integer, optional
update_roles(role, id)
Parameters:
  • role[name] – type String, optional
  • role – type Hash, required
  • id – type String, required
update_settings(setting, id)
Parameters:
  • setting[value] – type String, optional
  • setting – type Hash, required
  • id – type String, required
update_smart_proxies(smart_proxy, id)
Parameters:
  • smart_proxy[name] – type String, optional
  • smart_proxy – type Hash, required
  • smart_proxy[url] – type String, optional
  • id – type String, required
update_subnets(subnet, id)
Parameters:
  • subnet[mask] – type String, optional
  • subnet[vlanid] – type String, optional
  • subnet[dns_primary] – type String, optional
  • subnet[gateway] – type String, optional
  • subnet[to] – type String, optional
  • subnet – type Hash, required
  • subnet[dns_id] – type number., optional
  • subnet[dhcp_id] – type number., optional
  • subnet[from] – type String, optional
  • subnet[name] – type String, optional
  • subnet[network] – type String, optional
  • subnet[dns_secondary] – type String, optional
  • subnet[domain_ids] – type Array, optional
  • id – type number., required
  • subnet[tftp_id] – type number., optional
update_usergroups(usergroup, id)
Parameters:
  • usergroup – type Hash, required
  • id – type String, required
  • usergroup[name] – type String, optional
update_users(user, id)
Parameters:
  • user[login] – type String, optional
  • user – type Hash, required
  • user[firstname] – type String, optional
  • user[admin] – type ‘true’ or ‘false’, optional
  • user[password] – type String, optional
  • user[lastname] – type String, optional
  • id – type String, required
  • user[mail] – type String, optional
exception foreman.client.ForemanException(res, msg)[source]
exception foreman.client.ForemanVersionException[source]
class foreman.client.MetaForeman[source]
exception foreman.client.ObjectNotFound(res, msg)[source]
exception foreman.client.Unacceptable(res, msg)[source]
foreman.client.gen_fun_doc(fdef)[source]
Parameters:fdef – Function definition as found in the definitions file

Generate the documtation for the given function definition

foreman.client.gen_fun_line(params)[source]
Parameters:params – Dict with the funciton parameters as found in the

definitions file

Generates the python code that defines a function from it’s definition

foreman.client.generate_defs_file(fname='definitions.py')[source]
Parameters:fname – Name of the file todump the definitoins to.

Fetch the docs and generate the definitions of the api methods.

foreman.client.get_funct(fname, mname, fdef)[source]
Parameters:
  • fname – Funtion name
  • fdef – Function definition as in the definitions file

Generate the function from the given function and definition

foreman.client.get_method_definition(method_url)[source]
Parameters:method_url – relative url to the method’s documentation page

For a specific method url doc page, return it’s definition

foreman.client.get_methods_urls()[source]

Get the first level of the pages of the documentation

foreman.client.res_to_str(res)[source]
Parameters:resrequests.Response object

Parse the given request and generate an informative string from it

Previous topic

Welcome to Foreman API’s documentation!

Next topic

Tutorial

This Page