From 6894ae7d1d5feeae6690435bf8d428fa4eeb5463 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Fri, 13 Nov 2020 15:42:10 -0600 Subject: [PATCH] Rename to ansible-core (#72594) Change: - Initial set of changes for renaming to ansible-core - Includes changelog fragment changes from base -> core - Does NOT include docs changes - Modifies detection stuff in setup.py to support ansible<2.9 and ansible-base Test Plan: - ci_complete --- .gitignore | 2 + Makefile | 2 +- ...319-reduce-ignored-module-sanity-tests.yml | 2 +- .../plugin-loader-collection-name.yml | 2 +- lib/ansible/_vendor/__init__.py | 2 +- lib/ansible/utils/display.py | 2 +- packaging/debian/changelog | 2 +- packaging/debian/control | 6 +-- packaging/debian/rules | 2 +- setup.py | 41 +++++++++++-------- .../collections/redirected.statichost.yml | 2 +- .../prepare_http_tests/tasks/kerberos.yml | 2 +- .../targets/test_core/tasks/main.yml | 2 +- .../ansible_test/_data/completion/docker.txt | 2 +- .../_data/requirements/sanity.ansible-doc.txt | 4 +- .../requirements/sanity.validate-modules.txt | 2 +- .../sanity/code-smell/runtime-metadata.py | 2 +- .../_data/sanity/pylint/plugins/deprecated.py | 4 +- .../validate_modules/schema.py | 4 +- .../lib/ansible_test/_internal/util_common.py | 2 +- .../deprecated-config.requirements.txt | 2 +- .../code-smell/package-data.requirements.txt | 2 +- 22 files changed, 50 insertions(+), 43 deletions(-) diff --git a/.gitignore b/.gitignore index 55909288176..906b538952b 100644 --- a/.gitignore +++ b/.gitignore @@ -79,6 +79,8 @@ Vagrantfile /lib/ansible.egg-info/ # First used in the `devel` branch during Ansible 2.10 development. /lib/ansible_base.egg-info/ +# First used in the `devel` branch during Ansible 2.11 development. +/lib/ansible_core.egg-info/ /shippable/ /test/integration/cloud-config-*.* !/test/integration/cloud-config-*.*.template diff --git a/Makefile b/Makefile index 4c504a858a0..1c7cdba6a49 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ ######################################################## # variable section -NAME = ansible-base +NAME = ansible-core OS = $(shell uname -s) PREFIX ?= '/usr/local' SDIST_DIR ?= 'dist' diff --git a/changelogs/fragments/70319-reduce-ignored-module-sanity-tests.yml b/changelogs/fragments/70319-reduce-ignored-module-sanity-tests.yml index dde323e5cf9..b1ed276ac55 100644 --- a/changelogs/fragments/70319-reduce-ignored-module-sanity-tests.yml +++ b/changelogs/fragments/70319-reduce-ignored-module-sanity-tests.yml @@ -1,4 +1,4 @@ bugfixes: - apt_repository - fixes ``mode`` doc to remove ineffective default (https://github.com/ansible/ansible/pull/70319). deprecated_features: - - apt_key - the paramater ``key`` does not have any effect, has been deprecated and will be removed in ansible-base version 2.14 (https://github.com/ansible/ansible/pull/70319). + - apt_key - the paramater ``key`` does not have any effect, has been deprecated and will be removed in ansible-core version 2.14 (https://github.com/ansible/ansible/pull/70319). diff --git a/changelogs/fragments/plugin-loader-collection-name.yml b/changelogs/fragments/plugin-loader-collection-name.yml index 22b6b38b53b..3da161283dc 100644 --- a/changelogs/fragments/plugin-loader-collection-name.yml +++ b/changelogs/fragments/plugin-loader-collection-name.yml @@ -1,2 +1,2 @@ minor_changes: -- "The plugin loader now keeps track of the collection where a plugin was resolved to, in particular whether the plugin was loaded from ansible-base's internal paths (``ansible.builtin``) or from user-supplied paths (no collection name)." +- "The plugin loader now keeps track of the collection where a plugin was resolved to, in particular whether the plugin was loaded from ansible-core's internal paths (``ansible.builtin``) or from user-supplied paths (no collection name)." diff --git a/lib/ansible/_vendor/__init__.py b/lib/ansible/_vendor/__init__.py index e6a4c56d6ab..a31957b6724 100644 --- a/lib/ansible/_vendor/__init__.py +++ b/lib/ansible/_vendor/__init__.py @@ -39,7 +39,7 @@ def _ensure_vendored_path_entry(): already_loaded_vendored_modules = set(sys.modules.keys()).intersection(vendored_module_names) if already_loaded_vendored_modules: - warnings.warn('One or more Python packages bundled by this ansible-base distribution were already ' + warnings.warn('One or more Python packages bundled by this ansible-core distribution were already ' 'loaded ({0}). This may result in undefined behavior.'.format(', '.join(sorted(already_loaded_vendored_modules)))) diff --git a/lib/ansible/utils/display.py b/lib/ansible/utils/display.py index e268a63c9f5..95cce2bbd58 100644 --- a/lib/ansible/utils/display.py +++ b/lib/ansible/utils/display.py @@ -352,7 +352,7 @@ class Display(with_metaclass(Singleton, object)): msg += '.' if collection_name == 'ansible.builtin': - collection_name = 'ansible-base' + collection_name = 'ansible-core' if removed: header = '[DEPRECATED]: {0}'.format(msg) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 0eb840ce7c4..799f390eeea 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,4 +1,4 @@ -ansible-base (%VERSION%-%RELEASE%~%DIST%) %DIST%; urgency=low +ansible-core (%VERSION%-%RELEASE%~%DIST%) %DIST%; urgency=low * %VERSION% release diff --git a/packaging/debian/control b/packaging/debian/control index 7138005704f..ba724688470 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -1,4 +1,4 @@ -Source: ansible-base +Source: ansible-core Section: admin Priority: optional Standards-Version: 3.9.3 @@ -6,7 +6,7 @@ Maintainer: Ansible, Inc. Build-Depends: cdbs, debhelper (>= 5.0.0), python3-docutils, python3, dh-python | python-support, python3-setuptools, lsb-release, python3-straight.plugin, python3-packaging, python3-jinja2 Homepage: https://github.com/ansible/ansible/ -Package: ansible-base +Package: ansible-core Architecture: all Depends: python3-jinja2, python3-yaml, python3-paramiko, python3-cryptography, sshpass, ${misc:Depends}, ${python:Depends} Description: Ansible IT Automation @@ -18,7 +18,7 @@ Description: Ansible IT Automation Package: ansible-test Architecture: all -Depends: ansible-base (= ${binary:Version}), python3-venv, ${misc:Depends} +Depends: ansible-core (= ${binary:Version}), python3-venv, ${misc:Depends} Description: Ansible IT Automation Ansible is a radically simple model-driven configuration management, multi-node deployment, and remote task execution system. Ansible works diff --git a/packaging/debian/rules b/packaging/debian/rules index cd1e953418a..8bb0dde5cbf 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f # -- makefile -- -DEB_PYTHON3_MODULE_PACKAGES=ansible-base ansible_test +DEB_PYTHON3_MODULE_PACKAGES=ansible-core ansible_test #DEB_PYTHON_INSTALL_ARGS_ALL="--install-purelib=/usr/lib/python2.7/site-packages/" DEB_PYTHON_DISTUTILS_INSTALLDIR_SKEL = /usr/lib/python3/dist-packages/ diff --git a/setup.py b/setup.py index b15d4c966d0..591c8554083 100644 --- a/setup.py +++ b/setup.py @@ -50,9 +50,9 @@ def find_package_info(*file_paths): raise RuntimeError("Unable to find package info.") -def _validate_install_ansible_base(): - """Validate that we can install ansible-base. Currently this only - cares about upgrading to ansible-base from ansible<2.10 +def _validate_install_ansible_core(): + """Validate that we can install ansible-core. This checks if + ansible<=2.9 or ansible-base>=2.10 are installed. """ # Skip common commands we can ignore # Do NOT add bdist_wheel here, we don't ship wheels @@ -80,31 +80,36 @@ def _validate_install_ansible_base(): pass else: version_tuple = tuple(int(v) for v in __version__.split('.')[:2]) - if version_tuple < (2, 10): - stars = '*' * 76 - raise RuntimeError( - ''' + if version_tuple >= (2, 11): + return + elif version_tuple == (2, 10): + ansible_name = 'ansible-base' + else: + ansible_name = 'ansible' + + stars = '*' * 76 + raise RuntimeError( + ''' %s - Cannot install ansible-base with a pre-existing ansible==%s + Cannot install ansible-core with a pre-existing %s==%s installation. - Installing ansible-base with ansible-2.9 or older currently installed with - pip is known to cause problems. Please uninstall ansible and install the new - version: + Installing ansible-core with ansible-2.9 or older, or ansible-base-2.10 + currently installed with pip is known to cause problems. Please uninstall + %s and install the new version: - pip uninstall ansible - pip install ansible-base + pip uninstall %s + pip install ansible-core If you want to skip the conflict checks and manually resolve any issues afterwards, set the ANSIBLE_SKIP_CONFLICT_CHECK environment variable: - ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install ansible-base + ANSIBLE_SKIP_CONFLICT_CHECK=1 pip install ansible-core %s - ''' % (stars, __version__, stars) - ) + ''' % (stars, ansible_name, __version__, ansible_name, ansible_name, stars)) finally: sys.path[:] = sys_path for key in sys_modules_keys.symmetric_difference(sys.modules): @@ -112,7 +117,7 @@ def _validate_install_ansible_base(): sys.modules.update(sys_modules) -_validate_install_ansible_base() +_validate_install_ansible_core() SYMLINK_CACHE = 'SYMLINK_CACHE.json' @@ -347,7 +352,7 @@ static_setup_params = dict( 'install_scripts': InstallScriptsCommand, 'sdist': SDistCommand, }, - name='ansible-base', + name='ansible-core', version=__version__, description='Radically simple IT automation', author=__author__, diff --git a/test/integration/targets/collections/redirected.statichost.yml b/test/integration/targets/collections/redirected.statichost.yml index 9fd2c2d87b7..8cfab462a03 100644 --- a/test/integration/targets/collections/redirected.statichost.yml +++ b/test/integration/targets/collections/redirected.statichost.yml @@ -1,3 +1,3 @@ # use a plugin redirected by core to a collection to ensure inventory redirection and redirected config names are working -plugin: formerly_core_inventory # this is defined in the ansible-base runtime.yml routing to point at testns.content_adj.statichost +plugin: formerly_core_inventory # this is defined in the ansible-core runtime.yml routing to point at testns.content_adj.statichost hostname: dynamic_host_redirected diff --git a/test/integration/targets/prepare_http_tests/tasks/kerberos.yml b/test/integration/targets/prepare_http_tests/tasks/kerberos.yml index d9fc56a4eb5..06feea1c378 100644 --- a/test/integration/targets/prepare_http_tests/tasks/kerberos.yml +++ b/test/integration/targets/prepare_http_tests/tasks/kerberos.yml @@ -30,7 +30,7 @@ state: present when: ansible_facts.distribution not in ['Alpine', 'MacOSX'] -# apk isn't available on ansible-base so just call command +# apk isn't available on ansible-core so just call command - name: Alpine - Install Kerberos system packages command: apk add {{ krb5_packages | join(' ') }} when: ansible_facts.distribution == 'Alpine' diff --git a/test/integration/targets/test_core/tasks/main.yml b/test/integration/targets/test_core/tasks/main.yml index 4f8441e17e0..0ae4da67354 100644 --- a/test/integration/targets/test_core/tasks/main.yml +++ b/test/integration/targets/test_core/tasks/main.yml @@ -87,7 +87,7 @@ ignore_errors: yes register: misuse_of_changed -# providing artificial task results since there are no modules in ansible-base that provide a 'results' list instead of 'changed' +# providing artificial task results since there are no modules in ansible-core that provide a 'results' list instead of 'changed' - name: Prepare artificial task results set_fact: results_all_changed: diff --git a/test/lib/ansible_test/_data/completion/docker.txt b/test/lib/ansible_test/_data/completion/docker.txt index c76cc73794b..cfdf8557e79 100644 --- a/test/lib/ansible_test/_data/completion/docker.txt +++ b/test/lib/ansible_test/_data/completion/docker.txt @@ -1,5 +1,5 @@ default name=quay.io/ansible/default-test-container:2.9.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=collection -default name=quay.io/ansible/ansible-base-test-container:1.7.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=ansible-base +default name=quay.io/ansible/ansible-base-test-container:1.7.0 python=3.6,2.6,2.7,3.5,3.7,3.8,3.9 seccomp=unconfined context=ansible-core alpine3 name=quay.io/ansible/alpine3-test-container:1.19.0 python=3.8 centos6 name=quay.io/ansible/centos6-test-container:1.17.0 python=2.6 seccomp=unconfined centos7 name=quay.io/ansible/centos7-test-container:1.17.0 python=2.7 seccomp=unconfined diff --git a/test/lib/ansible_test/_data/requirements/sanity.ansible-doc.txt b/test/lib/ansible_test/_data/requirements/sanity.ansible-doc.txt index abd6c5fdbd5..cec0eed3cd5 100644 --- a/test/lib/ansible_test/_data/requirements/sanity.ansible-doc.txt +++ b/test/lib/ansible_test/_data/requirements/sanity.ansible-doc.txt @@ -1,2 +1,2 @@ -jinja2 # ansible-base requirement -pyyaml # ansible-base requirement +jinja2 # ansible-core requirement +pyyaml # ansible-core requirement diff --git a/test/lib/ansible_test/_data/requirements/sanity.validate-modules.txt b/test/lib/ansible_test/_data/requirements/sanity.validate-modules.txt index 5c0fca7886f..efe940041c5 100644 --- a/test/lib/ansible_test/_data/requirements/sanity.validate-modules.txt +++ b/test/lib/ansible_test/_data/requirements/sanity.validate-modules.txt @@ -1,3 +1,3 @@ -jinja2 # ansible-base requirement +jinja2 # ansible-core requirement pyyaml # needed for collection_detail.py voluptuous diff --git a/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py b/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py index 6d5689516a0..5eb5a4f24f3 100755 --- a/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py +++ b/test/lib/ansible_test/_data/sanity/code-smell/runtime-metadata.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -"""Schema validation of ansible-base's ansible_builtin_runtime.yml and collection's meta/runtime.yml""" +"""Schema validation of ansible-core's ansible_builtin_runtime.yml and collection's meta/runtime.yml""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type diff --git a/test/lib/ansible_test/_data/sanity/pylint/plugins/deprecated.py b/test/lib/ansible_test/_data/sanity/pylint/plugins/deprecated.py index 9ded3e3bd70..68910cb8504 100644 --- a/test/lib/ansible_test/_data/sanity/pylint/plugins/deprecated.py +++ b/test/lib/ansible_test/_data/sanity/pylint/plugins/deprecated.py @@ -55,14 +55,14 @@ MSGS = { "ansible-deprecated-no-collection-name", "The current collection name in format `namespace.name` must " "be provided as collection_name when calling Display.deprecated " - "or AnsibleModule.deprecate (`ansible.builtin` for ansible-base)", + "or AnsibleModule.deprecate (`ansible.builtin` for ansible-core)", {'minversion': (2, 6)}), 'E9507': ("Wrong collection name (%r) found in call to " "Display.deprecated or AnsibleModule.deprecate", "wrong-collection-deprecated", "The name of the current collection must be passed to the " "Display.deprecated resp. AnsibleModule.deprecate calls " - "(`ansible.builtin` for ansible-base)", + "(`ansible.builtin` for ansible-core)", {'minversion': (2, 6)}), 'E9508': ("Expired date (%r) found in call to Display.deprecated " "or AnsibleModule.deprecate", diff --git a/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/schema.py b/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/schema.py index 9aeb2d7d486..9e4cd427477 100644 --- a/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/schema.py +++ b/test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/schema.py @@ -155,7 +155,7 @@ def check_removal_version(v, version_field, collection_name_field, error_code='i parsed_version.parse(version) except ValueError as exc: raise _add_ansible_error_code( - Invalid('%s (%r) is not a valid ansible-base version: %s' % (version_field, version, exc)), + Invalid('%s (%r) is not a valid ansible-core version: %s' % (version_field, version, exc)), error_code=error_code) return v try: @@ -283,7 +283,7 @@ def version_added(v, error_code='version-added-invalid', accept_historical=False version.parse(version_added) except ValueError as exc: raise _add_ansible_error_code( - Invalid('version_added (%r) is not a valid ansible-base version: ' + Invalid('version_added (%r) is not a valid ansible-core version: ' '%s' % (version_added, exc)), error_code=error_code) else: diff --git a/test/lib/ansible_test/_internal/util_common.py b/test/lib/ansible_test/_internal/util_common.py index 0f3ae62767a..a5923bc0e93 100644 --- a/test/lib/ansible_test/_internal/util_common.py +++ b/test/lib/ansible_test/_internal/util_common.py @@ -153,7 +153,7 @@ def get_parameterized_completion(cache, name): if data_context().content.collection: context = 'collection' else: - context = 'ansible-base' + context = 'ansible-core' images = read_lines_without_comments(os.path.join(ANSIBLE_TEST_DATA_ROOT, 'completion', '%s.txt' % name), remove_blank_lines=True) diff --git a/test/sanity/code-smell/deprecated-config.requirements.txt b/test/sanity/code-smell/deprecated-config.requirements.txt index cfefdeec63d..859c4ee7e63 100644 --- a/test/sanity/code-smell/deprecated-config.requirements.txt +++ b/test/sanity/code-smell/deprecated-config.requirements.txt @@ -1,2 +1,2 @@ -jinja2 # ansible-base requirement +jinja2 # ansible-core requirement pyyaml diff --git a/test/sanity/code-smell/package-data.requirements.txt b/test/sanity/code-smell/package-data.requirements.txt index 5d74c7152e3..bc7167a6c5f 100644 --- a/test/sanity/code-smell/package-data.requirements.txt +++ b/test/sanity/code-smell/package-data.requirements.txt @@ -1,7 +1,7 @@ docutils jinja2 packaging -pyyaml # ansible-base requirement +pyyaml # ansible-core requirement rstcheck setuptools > 39.2 straight.plugin