Python API¶
Spicerack Python API autodoc.
Spicerack package.
-
class
spicerack.
Spicerack
(*, verbose=False, dry_run=True, cumin_config='/etc/cumin/config.yaml', conftool_config='/etc/conftool/config.yaml', conftool_schema='/etc/conftool/schema.yaml', spicerack_config_dir='/etc/spicerack')[source]¶ Bases:
object
Spicerack service locator.
-
__init__
(*, verbose=False, dry_run=True, cumin_config='/etc/cumin/config.yaml', conftool_config='/etc/conftool/config.yaml', conftool_schema='/etc/conftool/schema.yaml', spicerack_config_dir='/etc/spicerack')[source]¶ Initialize the service locator for the Spicerack library.
Parameters: - verbose (bool, optional) -- whether to set the verbose mode.
- dry_run (bool, optional) -- whether this is a DRY-RUN.
- cumin_config (str) -- the path of Cumin's configuration file.
- conftool_config (str, optional) -- the path of Conftool's configuration file.
- conftool_schema (str, optional) -- the path of Conftool's schema file.
- spicerack_config_dir (str, optional) -- the path for the root configuration directory for Spicerack. Module-specific configuration will be loaded from config_dir/module_name/.
-
admin_reason
(reason, task_id=None)[source]¶ Get an administrative Reason instance.
Parameters: Returns: the administrative Reason instance.
Return type:
-
confctl
(entity_name)[source]¶ Access a Conftool specific entity instance.
Parameters: entity_name (str) -- the name of a Conftool entity. Available values: node, service, discovery, mwconfig. Returns: the confctl entity instance. Return type: spicerack.confctl.ConftoolEntity
-
debmonitor
()[source]¶ Get a Debmonitor instance to interact with a Debmonitor website.
It requires that a
debmonitor/config.yaml
configuration file exists inside thespicerack_config_dir
that was passed to the Spicerack constructor with those fields:host: debmonitor.example.com cert: /path/to/tls/certificate key: /path/to/tls/key
Returns: the instance. Return type: spicerack.debmonitor.Debmonitor Raises: spicerack.exceptions.SpicerackError
-- if unble to read the configuration file.
-
discovery
(*records)[source]¶ Get a Discovery instance.
Parameters: *records (str) -- arbitrary positional arguments, each one must be a Discovery DNS record name. Returns: the pre-configured Discovery instance for the given records. Return type: spicerack.dnsdisc.Discovery
-
dns
()[source]¶ Get a Dns instance.
Returns: a Dns instance that will use the operating system default namserver(s). Return type: spicerack.dns.Dns
-
dry_run
¶ Getter for the dry_run property.
Returns: True if the DRY-RUN mode is set, False otherwise. Return type: bool
-
elasticsearch_clusters
(clustergroup)[source]¶ Get an ElasticsearchClusters instance.
Parameters: clustergroup (str) -- name of cluster group e.g search_eqiad Returns: ElasticsearchClusters instance Return type: spicerack.elasticsearch_cluster.ElasticsearchClusters
-
icinga
()[source]¶ Get an Icinga instance.
Returns: Icinga instance. Return type: spicerack.icinga.Icinga
-
ipmi
()[source]¶ Get an Ipmi instance to send remote IPMI commands to management consoles.
Returns: the instance to run ipmitool commands. Return type: spicerack.ipmi.Ipmi
-
irc_logger
¶ Getter for the irc_logger property.
Returns: the logger instance to write to IRC. Return type: logging.Logger
-
mediawiki
()[source]¶ Get a MediaWiki instance.
Returns: the pre-configured MediaWiki instance. Return type: spicerack.mediawiki.MediaWiki
-
mysql
()[source]¶ Get a Mysql instance.
Returns: the pre-configured Mysql instance. Return type: spicerack.mysql.Mysql
-
phabricator
(bot_config_file, section='phabricator_bot')[source]¶ Get a Phabricator instance to interact with a Phabricator website.
Parameters: - bot_config_file (str) --
the path to the configuration file for the Phabricator bot, with the following structure:
[section_name] host = https://phabricator.example.org/api/ username = phab-bot token = api-12345
- section (str, optional) -- the name of the section of the configuration file where to find the required parameters.
Returns: the instance.
Return type: - bot_config_file (str) --
-
puppet
(remote_hosts)[source]¶ Get a PuppetHosts instance for the given remote hosts.
Parameters: remote_hosts (spicerack.remote.RemoteHosts) -- the instance with the target hosts. Returns: the instance to manage Puppet on the target hosts. Return type: spicerack.puppet.PuppetHosts
-
puppet_master
()[source]¶ Get a PuppetMaster instance to manage hosts and certificates from a Puppet master.
Returns: the instance to manage Puppet hosts and certificates. Return type: spicerack.puppet.PuppetMaster
-
redis_cluster
(cluster)[source]¶ Get a RedisCluster instance.
Parameters: cluster (str) -- the name of the cluster. Returns: the cluster instance. Return type: spicerack.redis_cluster.RedisCluster
-
remote
()[source]¶ Get a Remote instance.
Returns: the pre-configured Remote instance. Return type: spicerack.remote.Remote
-
Subpackages and Submodules