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 <gabrioux@redhat.com>
(cherry picked from commit 72d8315299)
pull/4016/head
Guillaume Abrioux 2019-04-09 09:22:06 +02:00
parent 8c47e063e0
commit d83db2c8ed
7 changed files with 21 additions and 13 deletions

View File

@ -16,8 +16,8 @@ Obsoletes: ceph-iscsi-ansible <= 1.5
BuildArch: noarch BuildArch: noarch
BuildRequires: ansible >= 2.7 BuildRequires: ansible >= 2.8
Requires: ansible >= 2.7 Requires: ansible >= 2.8
%if 0%{?rhel} == 7 %if 0%{?rhel} == 7
BuildRequires: python2-devel BuildRequires: python2-devel

View File

@ -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``. - ``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 Configuration and Usage
======================= =======================

View File

@ -300,7 +300,6 @@
- import_role: - import_role:
name: ceph-defaults name: ceph-defaults
private: false
- name: gather monitors facts - name: gather monitors facts
setup: setup:
@ -310,7 +309,6 @@
- import_role: - import_role:
name: ceph-facts name: ceph-facts
private: false
- name: get all the running osds - name: get all the running osds
shell: | shell: |
@ -584,11 +582,9 @@
- import_role: - import_role:
name: ceph-defaults name: ceph-defaults
private: false
- import_role: - import_role:
name: ceph-facts name: ceph-facts
private: false
- name: show container list on all the nodes (should be empty) - name: show container list on all the nodes (should be empty)
command: > command: >

View File

@ -1,9 +1,19 @@
from . import ceph_volume from . import ceph_volume
from ansible.compat.tests.mock import MagicMock
import mock import mock
import os 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'}) @mock.patch.dict(os.environ, {'CEPH_CONTAINER_BINARY': 'docker'})
class TestCephVolumeModule(object): class TestCephVolumeModule(object):

View File

@ -1,4 +1,4 @@
# These are Python requirements needed to run ceph-ansible master # These are Python requirements needed to run ceph-ansible master
notario>=0.0.13 notario>=0.0.13
ansible~=2.7,<2.8 ansible>=2.8,<2.9
netaddr netaddr

View File

@ -55,15 +55,15 @@
- name: fail on unsupported ansible version (1.X) - name: fail on unsupported ansible version (1.X)
fail: 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 when: ansible_version.major|int < 2
- name: fail on unsupported ansible version - name: fail on unsupported ansible version
fail: fail:
msg: "Ansible version must be 2.7 or 2.8!" msg: "Ansible version must be 2.8!"
when: when:
- ansible_version.major|int == 2 - 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 - name: fail if systemd is not present
fail: fail:

View File

@ -4,6 +4,6 @@ testinfra==1.19.0
pytest-xdist==1.27.0 pytest-xdist==1.27.0
pytest==3.6.1 pytest==3.6.1
notario>=0.0.13 notario>=0.0.13
ansible~=2.7,<2.8 ansible>=2.8,<2.9
netaddr netaddr
mock mock