API library for Cluster API.
Project description
python3-cyberfusion-cluster-support
API library for Cluster API.
Install
PyPI
Run the following command to install the package from PyPI:
pip3 install python3-cyberfusion-cluster-support
Generic
Run the following command to create a source distribution:
python3 setup.py sdist
Debian
Run the following commands to build a Debian package:
mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
dpkg-buildpackage -us -uc
Configure
Config file options
- Section
clusterapi
, keyclusterid
. Only objects belonging to the specified cluster are loaded. - Section
clusterapi
, keyserviceaccountid
. Only objects belonging to a cluster for which a service account to cluster exists for the specified service account are loaded.
Class options
config_file_path
. Non-default config file path.cluster_ids
. Only objects belonging to the specified clusters are loaded.
Cluster IDs: order of precedence
The cluster_ids
class option takes precedence over the clusterid
config file option.
If neither is set, all objects are loaded.
If the clusterid
config file option is set, but you want to load all objects, setting the cluster_ids
class option to None
(default) will not work. Instead, use the sentinel value cyberfusion.ClusterSupport.ALL_CLUSTERS
.
Usage
Basic
from cyberfusion.ClusterSupport import ClusterSupport
s = ClusterSupport()
Read
API objects without parameters
Some API objects do not require parameters to be retrieved.
These API objects are retrieved from the Cluster API once. They are then cached.
Examples:
print(s.database_users)
print(s.unix_users)
print(s.fpm_pools)
API objects with parameters
Some API objects require parameters to be retrieved.
These API objects are retrieved from the Cluster API on every call.
Example:
print(s.access_logs(virtual_host_id=s.virtual_hosts[0].id, ...))
Update
Example:
d = s.database_users[0]
d.password = "newpassword"
d.update()
Create
Example:
from cyberfusion.ClusterSupport import ClusterSupport
from cyberfusion.ClusterSupport.certificates import Certificate
s = ClusterSupport()
c = Certificate(s)
assert c.id is None
c.create(common_names=["domlimev.nl", "www.domlimev.nl"])
assert c.id is not None
assert c.common_names == common_names=["domlimev.nl", "www.domlimev.nl"]
Delete
Example:
from cyberfusion.ClusterSupport import ClusterSupport
s = ClusterSupport()
c = s.certificates[0]
c.delete()
Tests
Run tests with pytest:
pytest tests/
The config file in cyberfusion.cfg
(working directory) is used.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for python3-cyberfusion-cluster-support-1.49.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ee4afc6ae9983d3ca89fad5cf3dff275015fded7bb8ff9457bd61d9df849b66 |
|
MD5 | 8678aaa3284ba627f403355405578960 |
|
BLAKE2b-256 | 932ab089a8eb9aa4ed4f06a475ed9f5f4fe54eb1a3a16ff7194127f03ffd569c |