andebox


Nameandebox JSON
Version 0.63 PyPI version JSON
download
home_pagehttps://github.com/russoz-ansible/andebox
SummaryAnsible Developers Box
upload_time2024-10-24 10:35:51
maintainerNone
docs_urlNone
authorAlexei Znamensky
requires_python<4.0,>=3.9
licenseMIT
keywords ansible tox vagrant
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            andebox
=======

Ansible Developer's (tool)Box, **andebox**, is a script to assist Ansible developers
by encapsulating some boilerplate tasks. One of the core features is the ability to run
`ansible-test` on a local copy of a collection repository without having to worry about
setting environment variables nor having the _expected_ directory structure _above_ the
collection directory.

It also allows some basic stats gathering from the `tests/sanity/ignore-X.Y.txt` files.

Installation
------------

Install it as usual:

    pip install andebox

Requirements
------------

* ansible-core for actions `test` and `tox-test`
* pyyaml for reading galaxy.yml
* distutils for comparing `LooseVersion` objects for action `ignore`
* vagrant for action `vagrant`
  * `andebox` and any other dependency must be installed inside the VM, but that setup is the user responsibility

Setup-less ansible-test
-----------------------

No need to clone in specific locations or keep track of env variables. Simply clone whichever collection you want and
run the `ansible-test` command as:

```
# Run sanity test(s)
$ andebox test -- sanity --docker default --test validate-modules plugins/modules/mymodule.py

# Run sanity test(s) excluding the modules listed in the CLI from the sanity 'ignore-X.Y.txt' files
$ andebox test -ei -- sanity --docker default --test validate-modules plugins/modules/mymodule.py

# Run unit test(s)
$ andebox test -- unit --docker default test/units/plugins/modules/mymodule.py

# Run integration test
$ andebox test -- integration --docker default mymodule

# Run tests in multiple Ansible versions using tox
$ andebox tox-test -- sanity --docker default --test validate-modules plugins/modules/mymodule.py
$ andebox tox-test -- unit --docker default test/units/plugins/modules/mymodule.py
$ andebox tox-test -- integration --docker default mymodule

# Run tests in multiple specific Ansible versions using tox
$ andebox tox-test -e ac211,ac212 -- unit --docker default test/units/plugins/modules/mymodule.py     # ansible-core 2.11 & 2.12 only
$ andebox tox-test -e a4,dev -- integration --docker default mymodule                                 # ansible 4 & development branch
```

By default, `andebox` will discover the full name of the collection by parsing the `galaxy.yml` file found in
the local directory.
If the file is not present or if it fails for any reason, use the option `--collection` to specify it, as in:

```
$ andebox test --collection community.general -- sanity --docker default -v --test validate-modules
```

Please notice that `andebox` uses whichever `ansible-test` is available in `PATH` for execution

Stats on ignore files
---------------------

Gathering stats from the ignore files can be quite annoying, especially if they are long. One can run:

```
$ andebox ignores -v2.10 -d4 -fc '.*:parameter-list-no-elements'
    24  plugins/modules/ovirt validate-modules:parameter-list-no-elements
     8  plugins/modules/centurylink validate-modules:parameter-list-no-elements
     6  plugins/modules/redfish validate-modules:parameter-list-no-elements
     5  plugins/modules/oneandone validate-modules:parameter-list-no-elements
     4  plugins/modules/rackspace validate-modules:parameter-list-no-elements
     4  plugins/modules/oneview validate-modules:parameter-list-no-elements
     3  plugins/modules/opennebula validate-modules:parameter-list-no-elements
     3  plugins/modules/univention validate-modules:parameter-list-no-elements
     3  plugins/modules/consul validate-modules:parameter-list-no-elements
     3  plugins/modules/sensu validate-modules:parameter-list-no-elements
```

Runtime config
--------------

Quickly peek what is the `runtime.yml` status for a specific module:

```
$ andebox runtime scaleway_ip_facts
D modules scaleway_ip_facts: deprecation in 3.0.0 (current=2.4.0): Use community.general.scaleway_ip_info instead.
```

Or using a regular expression:

```
$ andebox runtime -r 'gc[pe]'
R lookup gcp_storage_file: redirected to community.google.gcp_storage_file
T modules gce: terminated in 2.0.0: Use google.cloud.gcp_compute_instance instead.
R modules gce_eip: redirected to community.google.gce_eip
R modules gce_img: redirected to community.google.gce_img
R modules gce_instance_template: redirected to community.google.gce_instance_template
R modules gce_labels: redirected to community.google.gce_labels
R modules gce_lb: redirected to community.google.gce_lb
R modules gce_mig: redirected to community.google.gce_mig
R modules gce_net: redirected to community.google.gce_net
R modules gce_pd: redirected to community.google.gce_pd
R modules gce_snapshot: redirected to community.google.gce_snapshot
R modules gce_tag: redirected to community.google.gce_tag
T modules gcp_backend_service: terminated in 2.0.0: Use google.cloud.gcp_compute_backend_service instead.
T modules gcp_forwarding_rule: terminated in 2.0.0: Use google.cloud.gcp_compute_forwarding_rule or google.cloud.gcp_compute_global_forwarding_rule instead.
T modules gcp_healthcheck: terminated in 2.0.0: Use google.cloud.gcp_compute_health_check, google.cloud.gcp_compute_http_health_check or google.cloud.gcp_compute_https_health_check instead.
T modules gcp_target_proxy: terminated in 2.0.0: Use google.cloud.gcp_compute_target_http_proxy instead.
T modules gcp_url_map: terminated in 2.0.0: Use google.cloud.gcp_compute_url_map instead.
R modules gcpubsub: redirected to community.google.gcpubsub
R modules gcpubsub_info: redirected to community.google.gcpubsub_info
R modules gcpubsub_facts: redirected to community.google.gcpubsub_info
R doc_fragments _gcp: redirected to community.google._gcp
R module_utils gce: redirected to community.google.gce
R module_utils gcp: redirected to community.google.gcp
```
where D=Deprecated, T=Tombstone, R=Redirect.

Run Integration Tests in Vagrant VMs
------------------------------------

To run the test inside a VM managed by [vagrant](https://www.vagrantup.com/):

```
# Run test in VM named "fedora37" using sudo
$ andebox vagrant -n fedora37 -s -- --python 3.9 xfs_quota --color yes
```

Also beware that `andebox` does not create nor manage `Vagrantfile`. The user is responsible for creating and setting up the VM definition. It must have `andebox` and `ansible-core` (or `ansible-base` or `ansible`) installed on a virtual environment. By default, the venv is expected to be at `/venv` but the location can be specified using the `--venv` parameter.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/russoz-ansible/andebox",
    "name": "andebox",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "ansible, tox, vagrant",
    "author": "Alexei Znamensky",
    "author_email": "russoz@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/77/22/bc927b096ba309d1d0eca7b846ebe9f229c8577ca392cd6111ddc0770756/andebox-0.63.tar.gz",
    "platform": null,
    "description": "andebox\n=======\n\nAnsible Developer's (tool)Box, **andebox**, is a script to assist Ansible developers\nby encapsulating some boilerplate tasks. One of the core features is the ability to run\n`ansible-test` on a local copy of a collection repository without having to worry about\nsetting environment variables nor having the _expected_ directory structure _above_ the\ncollection directory.\n\nIt also allows some basic stats gathering from the `tests/sanity/ignore-X.Y.txt` files.\n\nInstallation\n------------\n\nInstall it as usual:\n\n    pip install andebox\n\nRequirements\n------------\n\n* ansible-core for actions `test` and `tox-test`\n* pyyaml for reading galaxy.yml\n* distutils for comparing `LooseVersion` objects for action `ignore`\n* vagrant for action `vagrant`\n  * `andebox` and any other dependency must be installed inside the VM, but that setup is the user responsibility\n\nSetup-less ansible-test\n-----------------------\n\nNo need to clone in specific locations or keep track of env variables. Simply clone whichever collection you want and\nrun the `ansible-test` command as:\n\n```\n# Run sanity test(s)\n$ andebox test -- sanity --docker default --test validate-modules plugins/modules/mymodule.py\n\n# Run sanity test(s) excluding the modules listed in the CLI from the sanity 'ignore-X.Y.txt' files\n$ andebox test -ei -- sanity --docker default --test validate-modules plugins/modules/mymodule.py\n\n# Run unit test(s)\n$ andebox test -- unit --docker default test/units/plugins/modules/mymodule.py\n\n# Run integration test\n$ andebox test -- integration --docker default mymodule\n\n# Run tests in multiple Ansible versions using tox\n$ andebox tox-test -- sanity --docker default --test validate-modules plugins/modules/mymodule.py\n$ andebox tox-test -- unit --docker default test/units/plugins/modules/mymodule.py\n$ andebox tox-test -- integration --docker default mymodule\n\n# Run tests in multiple specific Ansible versions using tox\n$ andebox tox-test -e ac211,ac212 -- unit --docker default test/units/plugins/modules/mymodule.py     # ansible-core 2.11 & 2.12 only\n$ andebox tox-test -e a4,dev -- integration --docker default mymodule                                 # ansible 4 & development branch\n```\n\nBy default, `andebox` will discover the full name of the collection by parsing the `galaxy.yml` file found in\nthe local directory.\nIf the file is not present or if it fails for any reason, use the option `--collection` to specify it, as in:\n\n```\n$ andebox test --collection community.general -- sanity --docker default -v --test validate-modules\n```\n\nPlease notice that `andebox` uses whichever `ansible-test` is available in `PATH` for execution\n\nStats on ignore files\n---------------------\n\nGathering stats from the ignore files can be quite annoying, especially if they are long. One can run:\n\n```\n$ andebox ignores -v2.10 -d4 -fc '.*:parameter-list-no-elements'\n    24  plugins/modules/ovirt validate-modules:parameter-list-no-elements\n     8  plugins/modules/centurylink validate-modules:parameter-list-no-elements\n     6  plugins/modules/redfish validate-modules:parameter-list-no-elements\n     5  plugins/modules/oneandone validate-modules:parameter-list-no-elements\n     4  plugins/modules/rackspace validate-modules:parameter-list-no-elements\n     4  plugins/modules/oneview validate-modules:parameter-list-no-elements\n     3  plugins/modules/opennebula validate-modules:parameter-list-no-elements\n     3  plugins/modules/univention validate-modules:parameter-list-no-elements\n     3  plugins/modules/consul validate-modules:parameter-list-no-elements\n     3  plugins/modules/sensu validate-modules:parameter-list-no-elements\n```\n\nRuntime config\n--------------\n\nQuickly peek what is the `runtime.yml` status for a specific module:\n\n```\n$ andebox runtime scaleway_ip_facts\nD modules scaleway_ip_facts: deprecation in 3.0.0 (current=2.4.0): Use community.general.scaleway_ip_info instead.\n```\n\nOr using a regular expression:\n\n```\n$ andebox runtime -r 'gc[pe]'\nR lookup gcp_storage_file: redirected to community.google.gcp_storage_file\nT modules gce: terminated in 2.0.0: Use google.cloud.gcp_compute_instance instead.\nR modules gce_eip: redirected to community.google.gce_eip\nR modules gce_img: redirected to community.google.gce_img\nR modules gce_instance_template: redirected to community.google.gce_instance_template\nR modules gce_labels: redirected to community.google.gce_labels\nR modules gce_lb: redirected to community.google.gce_lb\nR modules gce_mig: redirected to community.google.gce_mig\nR modules gce_net: redirected to community.google.gce_net\nR modules gce_pd: redirected to community.google.gce_pd\nR modules gce_snapshot: redirected to community.google.gce_snapshot\nR modules gce_tag: redirected to community.google.gce_tag\nT modules gcp_backend_service: terminated in 2.0.0: Use google.cloud.gcp_compute_backend_service instead.\nT modules gcp_forwarding_rule: terminated in 2.0.0: Use google.cloud.gcp_compute_forwarding_rule or google.cloud.gcp_compute_global_forwarding_rule instead.\nT modules gcp_healthcheck: terminated in 2.0.0: Use google.cloud.gcp_compute_health_check, google.cloud.gcp_compute_http_health_check or google.cloud.gcp_compute_https_health_check instead.\nT modules gcp_target_proxy: terminated in 2.0.0: Use google.cloud.gcp_compute_target_http_proxy instead.\nT modules gcp_url_map: terminated in 2.0.0: Use google.cloud.gcp_compute_url_map instead.\nR modules gcpubsub: redirected to community.google.gcpubsub\nR modules gcpubsub_info: redirected to community.google.gcpubsub_info\nR modules gcpubsub_facts: redirected to community.google.gcpubsub_info\nR doc_fragments _gcp: redirected to community.google._gcp\nR module_utils gce: redirected to community.google.gce\nR module_utils gcp: redirected to community.google.gcp\n```\nwhere D=Deprecated, T=Tombstone, R=Redirect.\n\nRun Integration Tests in Vagrant VMs\n------------------------------------\n\nTo run the test inside a VM managed by [vagrant](https://www.vagrantup.com/):\n\n```\n# Run test in VM named \"fedora37\" using sudo\n$ andebox vagrant -n fedora37 -s -- --python 3.9 xfs_quota --color yes\n```\n\nAlso beware that `andebox` does not create nor manage `Vagrantfile`. The user is responsible for creating and setting up the VM definition. It must have `andebox` and `ansible-core` (or `ansible-base` or `ansible`) installed on a virtual environment. By default, the venv is expected to be at `/venv` but the location can be specified using the `--venv` parameter.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Ansible Developers Box",
    "version": "0.63",
    "project_urls": {
        "Bug Tracker": "https://github.com/russoz-ansible/andebox/issues",
        "Homepage": "https://github.com/russoz-ansible/andebox",
        "Repository": "https://github.com/russoz-ansible/andebox",
        "Source Code": "https://github.com/russoz-ansible/andebox"
    },
    "split_keywords": [
        "ansible",
        " tox",
        " vagrant"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bff7d126b1bf6b8da5660789360919229bc3638b910900b82aa38b53d69b54c",
                "md5": "7720a08182e473ac2e65c78bd145c5f1",
                "sha256": "cf894d8d5a733aadfa2870105d4a32e5f8249bd15910c281094c9abbd254b98a"
            },
            "downloads": -1,
            "filename": "andebox-0.63-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7720a08182e473ac2e65c78bd145c5f1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 19401,
            "upload_time": "2024-10-24T10:35:49",
            "upload_time_iso_8601": "2024-10-24T10:35:49.982332Z",
            "url": "https://files.pythonhosted.org/packages/9b/ff/7d126b1bf6b8da5660789360919229bc3638b910900b82aa38b53d69b54c/andebox-0.63-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7722bc927b096ba309d1d0eca7b846ebe9f229c8577ca392cd6111ddc0770756",
                "md5": "a7a3080b2c97763b6b3b08a4d2314b13",
                "sha256": "47f0fba790c161c276a522bea49dd795feb0da58a0e0a3a7593083d62fcc28a0"
            },
            "downloads": -1,
            "filename": "andebox-0.63.tar.gz",
            "has_sig": false,
            "md5_digest": "a7a3080b2c97763b6b3b08a4d2314b13",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 15500,
            "upload_time": "2024-10-24T10:35:51",
            "upload_time_iso_8601": "2024-10-24T10:35:51.982352Z",
            "url": "https://files.pythonhosted.org/packages/77/22/bc927b096ba309d1d0eca7b846ebe9f229c8577ca392cd6111ddc0770756/andebox-0.63.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-24 10:35:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "russoz-ansible",
    "github_project": "andebox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "andebox"
}
        
Elapsed time: 0.76191s