summaryrefslogtreecommitdiffstats
path: root/src/ansible_compat/constants.py
blob: f5335ab34540bf782b80a307c22b77974804855d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Constants used by ansible_compat."""

from pathlib import Path

META_MAIN = (Path("meta") / Path("main.yml"), Path("meta") / Path("main.yaml"))
REQUIREMENT_LOCATIONS = [
    "requirements.yml",
    "roles/requirements.yml",
    "collections/requirements.yml",
    # These is more of less the official way to store test requirements in collections so far, comments shows number of repos using this reported by https://sourcegraph.com/ at the time of writing
    "tests/requirements.yml",  # 170
    "tests/integration/requirements.yml",  # 3
    "tests/unit/requirements.yml",  # 1
]

# Minimal version of Ansible we support for runtime
ANSIBLE_MIN_VERSION = "2.14"

# Based on https://docs.ansible.com/ansible/latest/reference_appendices/config.html
ANSIBLE_DEFAULT_ROLES_PATH = (
    "~/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles"
)

INVALID_CONFIG_RC = 2
ANSIBLE_MISSING_RC = 4
INVALID_PREREQUISITES_RC = 10

MSG_INVALID_FQRL = """\
Computed fully qualified role name of {0} does not follow current galaxy requirements.
Please edit meta/main.yml and assure we can correctly determine full role name:

galaxy_info:
role_name: my_name  # if absent directory name hosting role is used instead
namespace: my_galaxy_namespace  # if absent, author is used instead

Namespace: https://galaxy.ansible.com/docs/contributing/namespaces.html#galaxy-namespace-limitations
Role: https://galaxy.ansible.com/docs/contributing/creating_role.html#role-names

As an alternative, you can add 'role-name' to either skip_list or warn_list.
"""

RC_ANSIBLE_OPTIONS_ERROR = 5