From d83db2c8ed8a838c0ef6aaa44323c8234b313b0c Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Tue, 9 Apr 2019 09:22:06 +0200 Subject: [PATCH] switch to ansible 2.8 - remove private attribute with import_role. - update documentation. - update rpm spec requirement. - fix MagicMock python import in unit tests. Closes: #3765 Signed-off-by: Guillaume Abrioux (cherry picked from commit 72d8315299aa56889d8c680269fdf5da57f9654e) --- ceph-ansible.spec.in | 4 ++-- docs/source/index.rst | 4 +++- infrastructure-playbooks/purge-docker-cluster.yml | 4 ---- library/test_ceph_volume.py | 12 +++++++++++- requirements.txt | 2 +- roles/ceph-validate/tasks/check_system.yml | 6 +++--- tests/requirements.txt | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) diff --git a/ceph-ansible.spec.in b/ceph-ansible.spec.in index a5e2df327..6c8d80a9d 100644 --- a/ceph-ansible.spec.in +++ b/ceph-ansible.spec.in @@ -16,8 +16,8 @@ Obsoletes: ceph-iscsi-ansible <= 1.5 BuildArch: noarch -BuildRequires: ansible >= 2.7 -Requires: ansible >= 2.7 +BuildRequires: ansible >= 2.8 +Requires: ansible >= 2.8 %if 0%{?rhel} == 7 BuildRequires: python2-devel diff --git a/docs/source/index.rst b/docs/source/index.rst index f59bcafe7..bfab715d1 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -77,7 +77,9 @@ The ``master`` branch should be considered experimental and used with caution. - ``stable-3.2`` Supports for Ceph version ``luminous`` and ``mimic``. This branch supports Ansible version ``2.6``. -- ``master`` Supports for Ceph@master version. This branch supports Ansible version ``2.7``. +- ``stable-4.0`` Supports Ceph version ``nautilus``. This branch requires Ansible version ``2.8``. + +- ``master`` Supports Ceph@master version. This branch requires Ansible version ``2.8``. Configuration and Usage ======================= diff --git a/infrastructure-playbooks/purge-docker-cluster.yml b/infrastructure-playbooks/purge-docker-cluster.yml index 38ca3d9d0..a372001e9 100644 --- a/infrastructure-playbooks/purge-docker-cluster.yml +++ b/infrastructure-playbooks/purge-docker-cluster.yml @@ -300,7 +300,6 @@ - import_role: name: ceph-defaults - private: false - name: gather monitors facts setup: @@ -310,7 +309,6 @@ - import_role: name: ceph-facts - private: false - name: get all the running osds shell: | @@ -584,11 +582,9 @@ - import_role: name: ceph-defaults - private: false - import_role: name: ceph-facts - private: false - name: show container list on all the nodes (should be empty) command: > diff --git a/library/test_ceph_volume.py b/library/test_ceph_volume.py index a4688dc09..e58b93bdb 100644 --- a/library/test_ceph_volume.py +++ b/library/test_ceph_volume.py @@ -1,9 +1,19 @@ from . import ceph_volume -from ansible.compat.tests.mock import MagicMock import mock import os +# Python 3 +try: + from unittest.mock import MagicMock +except ImportError: + # Python 2 + try: + from mock import MagicMock + except ImportError: + print('You need the mock library installed on python2.x to run tests') + + @mock.patch.dict(os.environ, {'CEPH_CONTAINER_BINARY': 'docker'}) class TestCephVolumeModule(object): diff --git a/requirements.txt b/requirements.txt index f6dd4ddfe..60fa2b3b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ # These are Python requirements needed to run ceph-ansible master notario>=0.0.13 -ansible~=2.7,<2.8 +ansible>=2.8,<2.9 netaddr diff --git a/roles/ceph-validate/tasks/check_system.yml b/roles/ceph-validate/tasks/check_system.yml index 4a538f9a8..cec5b7f65 100644 --- a/roles/ceph-validate/tasks/check_system.yml +++ b/roles/ceph-validate/tasks/check_system.yml @@ -55,15 +55,15 @@ - name: fail on unsupported ansible version (1.X) fail: - msg: "Ansible version must be >= 2.7.x, please update!" + msg: "Ansible version must be >= 2.8.x, please update!" when: ansible_version.major|int < 2 - name: fail on unsupported ansible version fail: - msg: "Ansible version must be 2.7 or 2.8!" + msg: "Ansible version must be 2.8!" when: - ansible_version.major|int == 2 - - ansible_version.minor|int not in [7, 8] + - ansible_version.minor|int != 8 - name: fail if systemd is not present fail: diff --git a/tests/requirements.txt b/tests/requirements.txt index b24695747..750ce5fa4 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,6 +4,6 @@ testinfra==1.19.0 pytest-xdist==1.27.0 pytest==3.6.1 notario>=0.0.13 -ansible~=2.7,<2.8 +ansible>=2.8,<2.9 netaddr mock