EnvAssert
Test your servers environments by using fabric.
Requirements
python 2.6 or later
fabric
How to Use
install
% pip install envassert
write fabfile.py.
from fabric.api import env, task from envassert import file, process, package, user, group, port, cron, detect env.use_ssh_config = True @task def check(): env.platform_family = detect.detect() assert file.exists("/etc/hosts") assert file.is_file("/etc/hosts") assert file.is_dir("/tmp/") assert file.dir_exists("/tmp/") assert file.has_line("/etc/passwd", "sshd") assert file.owner_is("/bin/sh", "root") assert file.group_is("/bin/sh", "root") assert file.mode_is("/bin/sh", "777") if env.platform_family == "freebsd": assert file.is_link("/compat") else: assert file.is_link("/usr/tmp") assert package.installed("wget.x86_64") assert user.exists("sshd") assert user.is_belonging_group("shirou", "users") assert group.exists("wheel") assert port.is_listening(22) assert port.is_listening(80, "tcp") assert process.is_up("http") is False assert service.is_enabled("httpd") assert cron.has_entry('shirou', 'python') assert filesystem.is_type('ext4', '/')run fab
% fab -H somehost check [somehost] Executing task 'check' Done. Disconnecting from root@192.168.22.98... done.
You can use any other fabric arguments like hosts or parallel.
Detecting OS
The detect.detect() function can detect target OS and distribution. Setting this variable to env.platform_family, functions can dispatch according to that value.
This function is a minimal port of ohai.
Currently, these platform can be detected. (but not tested yet)
rhel (redhat, centos, oracle, scientific, enterpriseenterprise, amazon)
debian (debian, ubuntu, linuxmint, raspbian)
fedora
suse
gentoo
arch
freebsd
netbsd
openbsd
darwin
However, every functions are not implemented for these all platform. Pull Requests are welcome.
The giants on whose shoulders this works stands
serverspec : http://serverspec.org/
cuisine : https://github.com/sebastien/cuisine
ohai (for detecting platforms) : http://docs.opscode.com/chef/ohai.html
License
MIT License
FYI
cuisine: BSD
serverspec: MIT
ohai: Apache 2
Metadata
Release files for envassert 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| envassert-0.1.10.tar.gz | 7.7 kB | Without provenance | Details for envassert-0.1.10.tar.gz |
Release files / envassert-0.1.10.tar.gz
| Download URL | envassert-0.1.10.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b6c4fee34e9a7526706f7c0d0318501c51f48bb148b8bba25c89be76579a0c9
|
|
BLAKE2b-256 checksum How to use checksums |
83b135f68f1408fee211e9ffea275f07a28d60a45e377012b27db65cc7bc62ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for envassert 0.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.