Skip to main content

Test your servers environments by using fabric.

Project description

Test your servers environments by using fabric.


  • python 2.6 or later
  • fabric

How to Use

  1. install

    % pip install envassert
  2. write

    from fabric.api import env, task
    from envassert import file, process, package, user, group, port, cron, detect
    env.use_ssh_config = True
    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")
            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', '/')
  3. run fab

    % fab -H somehost check
    [somehost] Executing task 'check'
    Disconnecting from root@ 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


MIT License


  • cuisine: BSD
  • serverspec: MIT
  • ohai: Apache 2

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
envassert-0.1.10.tar.gz (7.7 kB) Copy SHA256 hash SHA256 Source None Dec 5, 2016

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page