This object has attributes corresponding to all configuration options from both “[main] Options” and “Options for both [main] and Repo” sections. For example setting a proxy to access all repositories:
import dnf base = dnf.Base() conf = base.conf conf.proxy = "http://the.proxy.url:3128" conf.proxy_username = "username" conf.proxy_password = "secret" base.read_all_repos() base.fill_sack()
Returns the value of the first valid reposdir or if unavailable the value of created reposdir (string)
A mapping of substitutions used in repositories’ remote URL configuration. The commonly used ones are:
key meaning default arch architecture of the machine autodetected basearch the architecture family of the current “arch” autodetected releasever release name of the system distribution
dnf.rpm.detect_releasever()can be used to detect the
Following example shows recommended method how to override autodetected architectures:
import dnf import hawkey arch = hawkey.detect_arch() base = dnf.Base() base.conf.substitutions['arch'] = arch base.conf.substitutions['basearch'] = dnf.rpm.basearch(arch) base.fill_sack() ...
Exclude all packages in the pkgs list from all operations.
Prefix config option named option with
Read configuration options from the
mainsection in filename. Option values not present there are left at their current values. If filename is
config_file_pathis used. Conversely, the configuration path used to load the configuration file that was used is stored into
config_file_pathbefore the function returns.
Print configuration values, including inherited values.
write_raw_configfile(filename, section_id, substitutions, modify)¶
Update or create config file. Where filename represents name of config file (.conf or .repo); section_id represents id of modified section (e.g. main, fedora, updates); substitutions represents an instance of base.conf.substitutions; modify represents dict of modified options.