github pyinfra-dev/pyinfra v0.4
pyinfra v0.4

latest releases: v3.1.1, v3.1, v3.0.2...
7 years ago

Changes in 0.4:

  • Major change: entirely new, streamlined CLI. Legacy support will remain for the next few releases. Usage is now:
# Run one or more deploys against the inventory
pyinfra INVENTORY deploy_web.py [deploy_db.py]...

# Run a single operation against the inventory
pyinfra INVENTORY server.user pyinfra,home=/home/pyinfra

# Execute an arbitrary command on the inventory
pyinfra INVENTORY exec -- echo "hello world"

# Run one or more facts on the inventory
pyinfra INVENTORY fact linux_distribution [users]...
  • Major addition: new connectors module that means hosts are no longer limited to SSH targets. Hostnames prefixed in @ define which non-SSH connector to use. There is a new local connector for executing directly on the local machine, use hostname @local, eg:
pyinfra @local fact arch
  • Major addition: add @deploy wrapper for pyinfra related modules (eg pyinfra-openstack) to wrap a deploy (collection of operations) under one function, eg:
from pyinfra.api import deploy

@deploy('Install Openstack controller')
def install_openstack_controller(state, host):
    apt.packages(
        state, host,
        {'Install openstack-client'},
        ['openstack-client'],
    )
    ...
  • Add SSH module to execute SSH from others hosts: ssh.keyscan, ssh.command, ssh.upload, ssh.download
  • Add vzctl module to manage OpenVZ containers: vzctl.create, vzctl.stop, vzctl.start, vzctl.restart, vzctl.delete, vzctl.set
  • Add on_success and on_error callbacks to all operations (args = (state, host, op_hash))
  • Add server.script_template operation
  • Add global hosts kwarg to all operations, working like local.include's
  • Add cache_time kwarg to apt.update operation
  • Add Inventory.get_group and Inventory.get_host
  • Inventory __len__ now (correctly) looks at active hosts, rather than all
  • Add Inventory.len_all_hosts to replace above bug/qwirk
  • Add progress spinner and % indicator to CLI
  • Replace docopt/termcolor with click
  • Moved pyinfra.cli to pyinfra_cli (internal breaking)
  • Switch to setuptools entry_points instead of distutils scripts
  • Expand Travis.ci testing to Python 3.6 and 3.7 nightly
  • Remove unused kwargs (sudo, sudo_user, su_user) from pyinfra.api.facts.get_facts

Don't miss a new pyinfra release

NewReleases is sending notifications on new releases.