diff --git a/docs/cli.md b/docs/cli.md index b70786000..9cbeb74fe 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -77,7 +77,7 @@ pyinfra @local ... pyinfra my-server.net,@local ... # Execute against a Docker container -pyinfra @docker/centos:8 ... +pyinfra @docker/fedora:43 ... ``` ### Limit @@ -132,7 +132,7 @@ For example, here we ensure that `nginx` is installed on the remote servers: # Ubuntu example pyinfra inventory.py apt.packages nginx update=true _sudo=true -# Centos example +# Fedora example pyinfra inventory2.py yum.packages nginx _sudo=true ``` diff --git a/docs/compatibility.md b/docs/compatibility.md index a85c4b5d2..321a8162b 100644 --- a/docs/compatibility.md +++ b/docs/compatibility.md @@ -27,10 +27,9 @@ To debug pyinfra within PyCharm, you need to [explicitly enable support for Geve pyinfra aims to be compatible with all Unix-like operating systems and is currently developed against: + Linux distros: - * Ubuntu 18/20 + * Ubuntu 20/22/24 * Debian 9/10 - * CentOS 7/8 - * Fedora 33 + * Fedora 43 * Alpine 3.8 + BSD flavours: * OpenBSD 6 diff --git a/docs/faq.rst b/docs/faq.rst index b8f15d0b0..bef709551 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -20,6 +20,7 @@ The currently executing host can be fetched from the ``host`` context variable. # Get the actual current hostname from the host from pyinfra.facts.server import Hostname hostname = host.get_fact(Hostname) + print(f"hostname:{hostname}") How do I use sudo in an operation? ---------------------------------- @@ -28,6 +29,7 @@ Sudo is controlled by one of the `privilege and user escalation arguments `_ to automatic .. code:: python + from pyinfra.operations import server # Retry a network operation up to 3 times server.shell( name="Download file with retries", diff --git a/docs/getting-started.rst b/docs/getting-started.rst index 0b519dfe4..096bddd50 100644 --- a/docs/getting-started.rst +++ b/docs/getting-started.rst @@ -29,8 +29,11 @@ You can start pyinfra immediately with some ad-hoc command execution. The CLI al # Execute over SSH pyinfra my-server.net exec -- echo "hello world" + # Execute over SSH with options + pyinfra localhost --ssh-port 2222 --ssh-user vagrant exec -- echo "hello world" + # Execute within a new docker container - pyinfra @docker/ubuntu:18.04 exec -- echo "hello world" + pyinfra @docker/ubuntu:22.04 exec -- echo "hello world" # Execute on the local machine (MacOS/Linux only - for now) pyinfra @local exec -- echo "hello world" @@ -66,8 +69,19 @@ To get started create an ``inventory.py`` containing our hosts to target: .. code:: python - # Define a group as a list of hosts - my_hosts = ["my-server.net", "@docker/ubuntu:18.04"] + # Define a group as a list of hosts + my_hosts = [ + # vagrant instance + ("ubuntu2204", { + "ssh_port": 2222, + "ssh_hostname": "localhost", + "ssh_user": "vagrant", + "_sudo": True + }), + "my-server.net", + "@docker/ubuntu:22.04" + ] + Now create a ``deploy.py`` containing our operations to execute: @@ -79,7 +93,7 @@ Now create a ``deploy.py`` containing our operations to execute: apt.packages( name="Ensure the vim apt package is installed", packages=["vim"], - _sudo=True, # use sudo when installing the packages + update=True, ) This can now be executed like this: diff --git a/docs/using-operations.rst b/docs/using-operations.rst index 357fce77e..f573cca7f 100644 --- a/docs/using-operations.rst +++ b/docs/using-operations.rst @@ -24,7 +24,6 @@ For example, these two operations will ensure that user ``pyinfra`` exists with user="pyinfra", group="pyinfra", mode="644", - _sudo=True, ) @@ -127,20 +126,38 @@ Adding data to inventories is covered in detail here: :doc:`inventory-data`. Dat Host Facts ~~~~~~~~~~ -Facts allow you to use information about the target host to control and configure operations. A good example is switching between ``apt`` & ``yum`` depending on the Linux distribution. Facts are imported from ``pyinfra.facts.*`` and can be retrieved using the ``host.get_fact`` function: +Facts allow you to use information about the target host to control and configure operations. A good example is switching between ``apt`` & ``yum`` depending on the Linux distribution. You can get a fact like this: + +.. code:: bash + + pyinfra inventory.py fact server.LinuxName + +Facts are imported from ``pyinfra.facts.*`` and can be retrieved using the ``host.get_fact`` function. If you save this in a file called `nano.py`: .. code:: python from pyinfra import host from pyinfra.facts.server import LinuxName - from pyinfra.operations import yum + from pyinfra.operations import yum, apt - if host.get_fact(LinuxName) == "CentOS": + if host.get_fact(LinuxName) == "Fedora": yum.packages( name="Install nano via yum", packages=["nano"], _sudo=True ) + if host.get_fact(LinuxName) == "Ubuntu": + apt.packages( + name="Install nano via apt", + packages=["nano"], + update=True, + _sudo=True + ) + +.. code:: bash + + pyinfra inventory.py nano.py + See :doc:`facts` for a full list of available facts and arguments. @@ -322,24 +339,35 @@ Like ``host`` and ``inventory``, ``config`` can be used to set global defaults f Enforcing Requirements ~~~~~~~~~~~~~~~~~~~~~~ -The config object can be used to enforce a pyinfra version or Python package requirements. This can either be defined as a requirements text file path or simply a list of requirements: +The config object can be used to enforce a pyinfra version or Python package requirements. This can either be defined as a requirements text file path or simply a list of requirements. For example, if you create a `requirements.py` file with: .. code:: python # Require a certain pyinfra version - config.REQUIRE_PYINFRA_VERSION = "~=1.1" + config.REQUIRE_PYINFRA_VERSION = "~=3.0" # Require certain packages - config.REQUIRE_PACKAGES = "requirements.txt" # path relative to the current working directory + config.REQUIRE_PACKAGES = "requirements.txt" # path is relative to the current working directory config.REQUIRE_PACKAGES = [ - "pyinfra~=1.1", - "pyinfra-docker~=1.0", + "pyinfra~=3.0", ] +And create a `requirements.txt` file with something like this: + +.. code:: bash + + pyinfra + +Then modify the `nano.py` above to include these lines: +.. code:: python + + from pyinfra import local + local.include("requirements.py") + Examples -------- -A great way to learn more about writing pyinfra deploys is to see some in action. There's a number of resources for this: +A great way to learn more about writing pyinfra deploys is to see some in action. Check out: - `the pyinfra examples repository on GitHub `_ diff --git a/pyinfra-metadata.toml b/pyinfra-metadata.toml index 5e40d92fc..d613016e1 100644 --- a/pyinfra-metadata.toml +++ b/pyinfra-metadata.toml @@ -39,18 +39,6 @@ path = "src/pyinfra/facts/brew.py" type = "fact" tags = ["package-manager", "system"] -[pyinfra.plugins."choco-ops"] -name = "choco" -path = "src/pyinfra/operations/choco.py" -type = "operation" -tags = ["package-manager", "system"] - -[pyinfra.plugins."choco-facts"] -name = "choco" -path = "src/pyinfra/facts/choco.py" -type = "fact" -tags = ["package-manager", "system"] - [pyinfra.plugins."dnf-ops"] name = "dnf" path = "src/pyinfra/operations/dnf.py" diff --git a/src/pyinfra/facts/choco.py b/src/pyinfra/facts/choco.py deleted file mode 100644 index e5c3ed85a..000000000 --- a/src/pyinfra/facts/choco.py +++ /dev/null @@ -1,47 +0,0 @@ -from __future__ import annotations - -from typing_extensions import override - -from pyinfra.api import FactBase - -from .util.packaging import parse_packages - -CHOCO_REGEX = r"^([a-zA-Z0-9\.\-\+\_]+)\s([0-9\.]+)$" - - -class ChocoPackages(FactBase): - """ - Returns a dict of installed choco (Chocolatey) packages: - - .. code:: python - - { - "package_name": ["version"], - } - """ - - @override - def command(self) -> str: - return "choco list" - - shell_executable = "ps" - - default = dict - - @override - def process(self, output): - return parse_packages(CHOCO_REGEX, output) - - -class ChocoVersion(FactBase): - """ - Returns the choco (Chocolatey) version. - """ - - @override - def command(self) -> str: - return "choco --version" - - @override - def process(self, output): - return "".join(output).replace("\n", "") diff --git a/src/pyinfra/operations/apk.py b/src/pyinfra/operations/apk.py index 374eca819..456cac430 100644 --- a/src/pyinfra/operations/apk.py +++ b/src/pyinfra/operations/apk.py @@ -1,5 +1,5 @@ """ -Manage apk packages. +Manage apk packages. (Alpine Linux) """ from __future__ import annotations @@ -64,6 +64,7 @@ def packages( .. code:: python + from pyinfra.operations import apk # Update package list and install packages apk.packages( name="Install Asterisk and Vim", diff --git a/src/pyinfra/operations/apt.py b/src/pyinfra/operations/apt.py index 45fb06112..7e54a47f1 100644 --- a/src/pyinfra/operations/apt.py +++ b/src/pyinfra/operations/apt.py @@ -67,6 +67,7 @@ def key(src: str | None = None, keyserver: str | None = None, keyid: str | list[ .. code:: python + from pyinfra.operations import apt # Note: If using URL, wget is assumed to be installed. apt.key( name="Add the Docker apt gpg key", diff --git a/src/pyinfra/operations/brew.py b/src/pyinfra/operations/brew.py index bde987d18..9158d05c8 100644 --- a/src/pyinfra/operations/brew.py +++ b/src/pyinfra/operations/brew.py @@ -61,6 +61,7 @@ def packages( .. code:: python + from pyinfra.operations import brew # Update package list and install packages brew.packages( name='Install Vim and vimpager', diff --git a/src/pyinfra/operations/choco.py b/src/pyinfra/operations/choco.py deleted file mode 100644 index af6916a20..000000000 --- a/src/pyinfra/operations/choco.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -Manage ``choco`` (Chocolatey) packages (https://chocolatey.org). -""" - -from __future__ import annotations - -from pyinfra import host -from pyinfra.api import operation -from pyinfra.facts.choco import ChocoPackages - -from .util.packaging import ensure_packages - - -@operation() -def packages(packages: str | list[str] | None = None, present=True, latest=False): - """ - Add/remove/update ``choco`` packages. - - + packages: list of packages to ensure - + present: whether the packages should be installed - + latest: whether to upgrade packages without a specified version - - Versions: - Package versions can be pinned like gem: ``:``. - - **Example:** - - .. code:: python - - # Note: Assumes that 'choco' is installed and - # user has Administrator permission. - choco.packages( - name="Install Notepad++", - packages=["notepadplusplus"], - ) - """ - - yield from ensure_packages( - host, - packages, - host.get_fact(ChocoPackages), - present, - install_command="choco install -y", - uninstall_command="choco uninstall -y -x", - upgrade_command="choco update -y", - version_join=":", - latest=latest, - ) - - -@operation(is_idempotent=False) -def install(): - """ - Install ``choco`` (Chocolatey). - """ - - yield ( - "Set-ExecutionPolicy Bypass -Scope Process -Force ;" - "iex ((New-Object System.Net.WebClient).DownloadString" - '("https://chocolatey.org/install.ps1"))' - ) # noqa diff --git a/src/pyinfra/operations/crontab.py b/src/pyinfra/operations/crontab.py index b7849af50..f6413cf86 100644 --- a/src/pyinfra/operations/crontab.py +++ b/src/pyinfra/operations/crontab.py @@ -54,6 +54,7 @@ def crontab( .. code:: python + from pyinfra.operations import crontab # simple example for a crontab crontab.crontab( name="Backup /etc weekly", diff --git a/src/pyinfra/operations/dnf.py b/src/pyinfra/operations/dnf.py index f3ea5d108..61c063936 100644 --- a/src/pyinfra/operations/dnf.py +++ b/src/pyinfra/operations/dnf.py @@ -25,9 +25,12 @@ def key(src: str): .. code:: python + from pyinfra import host + from pyinfra.operations import dnf + from pyinfra.facts.server import LinuxDistribution linux_id = host.get_fact(LinuxDistribution)["release_meta"].get("ID") dnf.key( - name="Add the Docker CentOS gpg key", + name="Add the Docker gpg key", src=f"https://download.docker.com/linux/{linux_id}/gpg", ) diff --git a/src/pyinfra/operations/docker.py b/src/pyinfra/operations/docker.py index 33c0824a1..8a0f37e6d 100644 --- a/src/pyinfra/operations/docker.py +++ b/src/pyinfra/operations/docker.py @@ -50,6 +50,7 @@ def container( .. code:: python + from pyinfra.operations import docker # Run a container docker.container( name="Deploy Nginx container", diff --git a/src/pyinfra/operations/files.py b/src/pyinfra/operations/files.py index 2d59cc85e..a3f519da7 100644 --- a/src/pyinfra/operations/files.py +++ b/src/pyinfra/operations/files.py @@ -117,6 +117,7 @@ def download( .. code:: python + from pyinfra.operations import files files.download( name="Download the Docker repo file", src="https://download.docker.com/linux/centos/docker-ce.repo", @@ -1789,7 +1790,7 @@ def block( # put complex alias into .zshrc files.block( path="/home/user/.zshrc", - content="eval $(thefuck -a)", + content="eval $(thef -a)", try_prevent_shell_expansion=True, marker="## {mark} ALIASES ##" ) diff --git a/src/pyinfra/operations/flatpak.py b/src/pyinfra/operations/flatpak.py index 3a8bae712..0d62072d6 100644 --- a/src/pyinfra/operations/flatpak.py +++ b/src/pyinfra/operations/flatpak.py @@ -26,6 +26,7 @@ def packages( .. code:: python + from pyinfra.operations import flatpak # Install vlc flatpak flatpak.package( name="Install vlc", diff --git a/src/pyinfra/operations/gem.py b/src/pyinfra/operations/gem.py index aa0874a10..71929615a 100644 --- a/src/pyinfra/operations/gem.py +++ b/src/pyinfra/operations/gem.py @@ -27,6 +27,7 @@ def packages(packages: str | list[str] | None = None, present=True, latest=False .. code:: python + from pyinfra.operations import gem # Note: Assumes that 'gem' is installed. gem.packages( name="Install rspec", diff --git a/src/pyinfra/operations/git.py b/src/pyinfra/operations/git.py index 905d3ae12..d6e12ff38 100644 --- a/src/pyinfra/operations/git.py +++ b/src/pyinfra/operations/git.py @@ -30,6 +30,7 @@ def config(key: str, value: str, multi_value=False, repo: str | None = None, sys .. code:: python + from pyinfra.operations import git git.config( name="Always prune specified repo", key="fetch.prune", diff --git a/src/pyinfra/operations/iptables.py b/src/pyinfra/operations/iptables.py index 02be276cb..e1b1cac9b 100644 --- a/src/pyinfra/operations/iptables.py +++ b/src/pyinfra/operations/iptables.py @@ -118,6 +118,7 @@ def rule( .. code:: python + from pyinfra.operations import iptables iptables.rule( name="Block SSH traffic", chain="INPUT", diff --git a/src/pyinfra/operations/lxd.py b/src/pyinfra/operations/lxd.py index cad4b9ea8..b3e26e21f 100644 --- a/src/pyinfra/operations/lxd.py +++ b/src/pyinfra/operations/lxd.py @@ -38,6 +38,7 @@ def container( .. code:: python + from pyinfra.operations import lxd lxd.container( name="Add an ubuntu container", id="ubuntu19", diff --git a/src/pyinfra/operations/mysql.py b/src/pyinfra/operations/mysql.py index 22b6e90d4..46e7b9fb7 100644 --- a/src/pyinfra/operations/mysql.py +++ b/src/pyinfra/operations/mysql.py @@ -101,6 +101,7 @@ def user( .. code:: python + from pyinfra.operations import mysql mysql.user( name="Create the pyinfra@localhost MySQL user", user="pyinfra", diff --git a/src/pyinfra/operations/opkg.py b/src/pyinfra/operations/opkg.py index bf37cd02a..d1c0ad743 100644 --- a/src/pyinfra/operations/opkg.py +++ b/src/pyinfra/operations/opkg.py @@ -52,7 +52,8 @@ def packages( .. code:: python - # Ensure packages are installed∂ (will not force package upgrade) + from pyinfra.operations import opkg + # Ensure packages are installed (will not force package upgrade) opkg.packages(['asterisk', 'vim'], name="Install Asterisk and Vim") # Install the latest versions of packages (always check) diff --git a/src/pyinfra/operations/pacman.py b/src/pyinfra/operations/pacman.py index 2892766d3..07cfd3ad3 100644 --- a/src/pyinfra/operations/pacman.py +++ b/src/pyinfra/operations/pacman.py @@ -57,6 +57,7 @@ def packages( .. code:: python + from pyinfra.operations import pacman pacman.packages( name="Install Vim and a plugin", packages=["vim-fugitive", "vim"], diff --git a/src/pyinfra/operations/pip.py b/src/pyinfra/operations/pip.py index fe2cb8a9c..75a5aedf2 100644 --- a/src/pyinfra/operations/pip.py +++ b/src/pyinfra/operations/pip.py @@ -36,6 +36,7 @@ def virtualenv( .. code:: python + from pyinfra.operations import pip pip.virtualenv( name="Create a virtualenv", path="/usr/local/bin/venv", diff --git a/src/pyinfra/operations/pipx.py b/src/pyinfra/operations/pipx.py index c4927e03e..aca8ad9f9 100644 --- a/src/pyinfra/operations/pipx.py +++ b/src/pyinfra/operations/pipx.py @@ -34,6 +34,7 @@ def packages( .. code:: python + from pyinfra.operations import pipx pipx.packages( name="Install ", packages=["pyinfra"], diff --git a/src/pyinfra/operations/pkg.py b/src/pyinfra/operations/pkg.py index ee2c7cc64..119d8840c 100644 --- a/src/pyinfra/operations/pkg.py +++ b/src/pyinfra/operations/pkg.py @@ -35,6 +35,7 @@ def packages(packages: str | list[str] | None = None, present=True, pkg_path: st .. code:: python + from pyinfra.operations import pkg pkg.packages( name="Install Vim and Vim Addon Manager", packages=["vim-addon-manager", "vim"], diff --git a/src/pyinfra/operations/pkgin.py b/src/pyinfra/operations/pkgin.py index d124f333d..0df8e7434 100644 --- a/src/pyinfra/operations/pkgin.py +++ b/src/pyinfra/operations/pkgin.py @@ -56,6 +56,7 @@ def packages( .. code:: python + from pyinfra.operations import pkgin # Update package list and install packages pkgin.packages( name="Install tmux and Vim", diff --git a/src/pyinfra/operations/postgres.py b/src/pyinfra/operations/postgres.py index 3b4259048..45f269a1e 100644 --- a/src/pyinfra/operations/postgres.py +++ b/src/pyinfra/operations/postgres.py @@ -96,6 +96,7 @@ def role( .. code:: python + from pyinfra.operations import postgresql postgresql.role( name="Create the pyinfra PostgreSQL role", role="pyinfra", diff --git a/src/pyinfra/operations/puppet.py b/src/pyinfra/operations/puppet.py index c27a0a166..2d75ef3af 100644 --- a/src/pyinfra/operations/puppet.py +++ b/src/pyinfra/operations/puppet.py @@ -19,6 +19,7 @@ def agent(server: str | None = None, port: int | None = None): .. code:: python + from pyinfra.operations import puppet puppet.agent() # We also expect a return code of: diff --git a/src/pyinfra/operations/python.py b/src/pyinfra/operations/python.py index f2941401b..ad9f3a64a 100644 --- a/src/pyinfra/operations/python.py +++ b/src/pyinfra/operations/python.py @@ -22,6 +22,7 @@ def call(function: Callable, *args, **kwargs): .. code:: python + from pyinfra.operations import python def my_callback(hello=None): command = 'echo hello' if hello: diff --git a/src/pyinfra/operations/selinux.py b/src/pyinfra/operations/selinux.py index 5ecf2e119..e0a9104f2 100644 --- a/src/pyinfra/operations/selinux.py +++ b/src/pyinfra/operations/selinux.py @@ -39,6 +39,7 @@ def boolean(bool_name: str, value: Boolean, persistent=False): .. code:: python + from pyinfra.operations import selinux selinux.boolean( name='Allow Apache to connect to LDAP server', 'httpd_can_network_connect', diff --git a/src/pyinfra/operations/server.py b/src/pyinfra/operations/server.py index b4e1d8ead..1c149e00d 100644 --- a/src/pyinfra/operations/server.py +++ b/src/pyinfra/operations/server.py @@ -68,6 +68,7 @@ def reboot(delay=10, interval=1, reboot_timeout=300): .. code:: python + from pyinfra.operations import server server.reboot( name="Reboot the server and wait to reconnect", delay=60, diff --git a/src/pyinfra/operations/snap.py b/src/pyinfra/operations/snap.py index c40900415..09946ed8b 100644 --- a/src/pyinfra/operations/snap.py +++ b/src/pyinfra/operations/snap.py @@ -32,7 +32,8 @@ def package( .. code:: python - # Install vlc snap + from pyinfra.operations import snap + # Install vlc via snap snap.package( name="Install vlc", packages="vlc", diff --git a/src/pyinfra/operations/ssh.py b/src/pyinfra/operations/ssh.py index 9494f544b..a25d6e738 100644 --- a/src/pyinfra/operations/ssh.py +++ b/src/pyinfra/operations/ssh.py @@ -28,6 +28,7 @@ def keyscan(hostname: str, force=False, port=22): .. code:: python + from pyinfra.operations import ssh ssh.keyscan( name="Set add server two to known_hosts on one", hostname="two.example.com", diff --git a/src/pyinfra/operations/systemd.py b/src/pyinfra/operations/systemd.py index ce9434731..e961bdf20 100644 --- a/src/pyinfra/operations/systemd.py +++ b/src/pyinfra/operations/systemd.py @@ -66,6 +66,7 @@ def service( .. code:: python + from pyinfra.operations import systemd systemd.service( name="Restart and enable the dnsmasq service", service="dnsmasq.service", diff --git a/src/pyinfra/operations/sysvinit.py b/src/pyinfra/operations/sysvinit.py index c365ff03d..1d82b806b 100644 --- a/src/pyinfra/operations/sysvinit.py +++ b/src/pyinfra/operations/sysvinit.py @@ -38,7 +38,7 @@ def service( support enabling/disabling services: + Ubuntu/Debian (``update-rc.d``) - + CentOS/Fedora/RHEL (``chkconfig``) + + Fedora/RHEL (``chkconfig``) + Gentoo (``rc-update``) For other distributions and more granular service control, see the @@ -48,6 +48,7 @@ def service( .. code:: python + from pyinfra.operations import sysvinit sysvinit.service( name="Restart and enable rsyslog", service="rsyslog", diff --git a/src/pyinfra/operations/xbps.py b/src/pyinfra/operations/xbps.py index 009e911f4..154e9ee42 100644 --- a/src/pyinfra/operations/xbps.py +++ b/src/pyinfra/operations/xbps.py @@ -54,6 +54,7 @@ def packages( .. code:: python + from pyinfra.operations import xbps xbps.packages( name="Install Vim and Vim Pager", packages=["vimpager", "vim"], diff --git a/src/pyinfra/operations/yum.py b/src/pyinfra/operations/yum.py index be500429a..61306cef6 100644 --- a/src/pyinfra/operations/yum.py +++ b/src/pyinfra/operations/yum.py @@ -25,6 +25,9 @@ def key(src: str): .. code:: python + from pyinfra import host + from pyinfra.operations import dnf + from pyinfra.facts.server import LinuxDistribution linux_id = host.get_fact(LinuxDistribution)["release_meta"].get("ID") yum.key( name="Add the Docker CentOS gpg key", @@ -75,7 +78,7 @@ def repo( # Create the repository file from baseurl/etc yum.repo( - name="Add the Docker CentOS repo", + name="Add the Docker repo", src="DockerCE", baseurl="https://download.docker.com/linux/centos/7/$basearch/stable", ) diff --git a/src/pyinfra/operations/zfs.py b/src/pyinfra/operations/zfs.py index 5da6eef43..bffaf52e0 100644 --- a/src/pyinfra/operations/zfs.py +++ b/src/pyinfra/operations/zfs.py @@ -33,6 +33,7 @@ def dataset( .. code:: python + from pyinfra.operations import zfs zfs.dataset( "tank/srv", mountpoint="/srv", diff --git a/src/pyinfra/operations/zypper.py b/src/pyinfra/operations/zypper.py index fc3da9dac..b94511901 100644 --- a/src/pyinfra/operations/zypper.py +++ b/src/pyinfra/operations/zypper.py @@ -42,6 +42,7 @@ def repo( .. code:: python + from pyinfra.operations import zypper # Download a repository file zypper.repo( name="Install container virtualization repo via URL", diff --git a/tests/facts/choco.ChocoPackages/packages.json b/tests/facts/choco.ChocoPackages/packages.json deleted file mode 100644 index d07780832..000000000 --- a/tests/facts/choco.ChocoPackages/packages.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "command": "choco list", - "output": [ - "Chocolatey v0.10.15", - "chocolatey 0.10.15", - "chocolatey-core.extension 1.3.5.1", - "notepadplusplus 7.8.3", - "notepadplusplus.install 7.8.3", - "4 packages installed.", - "" - ], - "fact": { - "chocolatey": [ - "0.10.15" - ], - "chocolatey-core.extension": [ - "1.3.5.1" - ], - "notepadplusplus": [ - "7.8.3" - ], - "notepadplusplus.install": [ - "7.8.3" - ] - } -} diff --git a/tests/facts/choco.ChocoVersion/version.json b/tests/facts/choco.ChocoVersion/version.json deleted file mode 100644 index bc32ccf54..000000000 --- a/tests/facts/choco.ChocoVersion/version.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "command": "choco --version", - "output": ["0.10.15", ""], - "fact": "0.10.15" -} diff --git a/tests/operations/choco.install/install.json b/tests/operations/choco.install/install.json deleted file mode 100644 index 5f6f51e17..000000000 --- a/tests/operations/choco.install/install.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "commands": [ - "Set-ExecutionPolicy Bypass -Scope Process -Force ;iex ((New-Object System.Net.WebClient).DownloadString(\"https://chocolatey.org/install.ps1\"))" - ], - "idempotent": false -} diff --git a/tests/operations/choco.packages/add_packages.json b/tests/operations/choco.packages/add_packages.json deleted file mode 100644 index be08bc9be..000000000 --- a/tests/operations/choco.packages/add_packages.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "args": ["notepadplusplus"], - "facts": { - "choco.ChocoPackages": {} - }, - "commands": [ - "choco install -y notepadplusplus" - ] -} diff --git a/tests/operations/choco.packages/remove_packages.json b/tests/operations/choco.packages/remove_packages.json deleted file mode 100644 index 1552e8228..000000000 --- a/tests/operations/choco.packages/remove_packages.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "args": ["notepadplusplus"], - "kwargs": { - "present": false - }, - "facts": { - "choco.ChocoPackages": { - "notepadplusplus": true - } - }, - "commands": [ - "choco uninstall -y -x notepadplusplus" - ] -} diff --git a/tests/words.txt b/tests/words.txt index d6701aa3a..e915378aa 100644 --- a/tests/words.txt +++ b/tests/words.txt @@ -75,7 +75,6 @@ certificate cfg changelog chdir -choco chown chroot cim