Pulp Smash needs to know about the Pulp application under test and the hosts
that comprise that application. For example, it might need to know which
username and password to use when communicating with a Pulp application, or it
might need to know which host is hosting the squid service, if any. This module
eases the task of managing that information.

This object stores information about Pulp application and its constituent
hosts. A single Pulp application may have its services spread across
several hosts. For example, one host might run Qpid, another might run
MongoDB, and so on. Here’s how to model a multi-host deployment where
Apache runs on one host, and the remaining components run on another host:

In the simplest case, Pulp Smash’s configuration file resides at
~/.config/pulp_smash/settings.json. However, there are several ways to
alter this path. Pulp Smash obeys the XDG Base Directory Specification.
In addition, Pulp Smash responds to the PULP_SMASH_CONFIG_FILE
environment variable. This variable is a relative path, and it defaults to
settings.json.

Configuration files contain JSON data structured in a way that resembles
what is accepted by this class’s constructor. For exact details on the
structure of configuration files, see
pulp_smash.config.CONFIG_JSON_SCHEMA.

Parameters:

pulp_auth – A two-tuple. Credentials to use when communicating with
the server. For example: ('username','password').

pulp_version – A string, such as ‘1.2’ or ‘0.8.rc3’. Defaults to
‘1!0’ (epoch 1, version 0). Must be compatible with the packaging
library’s packaging.version.Version class.

Search each of the standard XDG configuration directories for a
configuration file. Return as soon as a configuration file is found.
Beware of race conditions. By the time client code attempts to open the
file, it may be gone or otherwise inaccessible.

Parameters:

xdg_config_file – A string. The name of the configuration file
that is being searched for.

xdg_config_dir – A string. The name of the directory that is
suffixed to the end of each of the XDG_CONFIG_DIRS paths.

But this latter approach is more fragile. The user must remember to get
a host with api role to check for the verify config, then convert
pulp_auth config to a tuple, and it will require maintenance if
cfg gains or loses attributes.