mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-04-27 17:06:57 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed5829d462 | ||
|
|
b025e7c356 | ||
|
|
782340833e | ||
|
|
73aab9e80c | ||
|
|
ae7e8260a3 | ||
|
|
030df96dc0 | ||
|
|
c5d0d3ec82 | ||
|
|
0cff7eb3a2 | ||
|
|
29e3f3dac8 | ||
|
|
d18ea87091 | ||
|
|
529c1e8dcc |
@@ -256,7 +256,7 @@
|
|||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ansible-collections-openstack-release
|
name: ansible-collections-openstack-release
|
||||||
parent: base
|
parent: openstack-tox-linters-ansible
|
||||||
run: ci/publish/publish_collection.yml
|
run: ci/publish/publish_collection.yml
|
||||||
secrets:
|
secrets:
|
||||||
- ansible_galaxy_info
|
- ansible_galaxy_info
|
||||||
|
|||||||
@@ -5,6 +5,43 @@ Ansible OpenStack Collection Release Notes
|
|||||||
.. contents:: Topics
|
.. contents:: Topics
|
||||||
|
|
||||||
|
|
||||||
|
v2.3.3
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Bugfixes and minor changes
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Add test to only_ipv4 in inventory
|
||||||
|
- add an option to use only IPv4 only for ansible_host and ansible_ssh_host
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- CI - Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable
|
||||||
|
|
||||||
|
v2.3.2
|
||||||
|
======
|
||||||
|
|
||||||
|
Release Summary
|
||||||
|
---------------
|
||||||
|
|
||||||
|
Bugfixes and minor changes
|
||||||
|
|
||||||
|
Minor Changes
|
||||||
|
-------------
|
||||||
|
|
||||||
|
- Drop compat implementations for tests
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix openstack.cloud.port module failure in check mode
|
||||||
|
|
||||||
v2.3.1
|
v2.3.1
|
||||||
======
|
======
|
||||||
|
|
||||||
|
|||||||
@@ -578,3 +578,20 @@ releases:
|
|||||||
- Add ability to pass client tls certificate
|
- Add ability to pass client tls certificate
|
||||||
release_summary: Client TLS certificate support
|
release_summary: Client TLS certificate support
|
||||||
release_date: '2024-12-18'
|
release_date: '2024-12-18'
|
||||||
|
2.3.2:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- Fix openstack.cloud.port module failure in check mode
|
||||||
|
minor_changes:
|
||||||
|
- Drop compat implementations for tests
|
||||||
|
release_summary: Bugfixes and minor changes
|
||||||
|
release_date: '2024-12-20'
|
||||||
|
2.3.3:
|
||||||
|
changes:
|
||||||
|
bugfixes:
|
||||||
|
- CI - Fix deprecated ANSIBLE_COLLECTIONS_PATHS variable
|
||||||
|
minor_changes:
|
||||||
|
- Add test to only_ipv4 in inventory
|
||||||
|
- add an option to use only IPv4 only for ansible_host and ansible_ssh_host
|
||||||
|
release_summary: Bugfixes and minor changes
|
||||||
|
release_date: '2024-12-22'
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
vars:
|
vars:
|
||||||
collection_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
collection_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||||
build_collection_path: /tmp/collection_built/
|
build_collection_path: /tmp/collection_built/
|
||||||
ansible_galaxy_path: "~/.local/bin/ansible-galaxy"
|
ansible_virtualenv_path: /tmp/ansible_venv
|
||||||
|
ansible_galaxy_path: "{{ ansible_virtualenv_path }}/bin/ansible-galaxy"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
|
||||||
@@ -11,9 +12,15 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: ensure-pip
|
name: ensure-pip
|
||||||
|
|
||||||
- name: Install ansible
|
- name: Install Ansible in virtualenv
|
||||||
pip:
|
pip:
|
||||||
name: ansible-core<2.12
|
name: ansible-core<2.19
|
||||||
|
virtualenv: "{{ ansible_virtualenv_path }}"
|
||||||
|
virtualenv_command: "{{ ensure_pip_virtualenv_command }}"
|
||||||
|
|
||||||
|
- name: Detect ansible version
|
||||||
|
command: "{{ ansible_virtualenv_path }}/bin/ansible --version"
|
||||||
|
register: ansible_version
|
||||||
|
|
||||||
- name: Discover tag version
|
- name: Discover tag version
|
||||||
set_fact:
|
set_fact:
|
||||||
|
|||||||
@@ -303,6 +303,25 @@
|
|||||||
that:
|
that:
|
||||||
- inventory.all.children.RegionOne.hosts.keys() | sort == ['ansible_server1', 'ansible_server2'] | sort
|
- inventory.all.children.RegionOne.hosts.keys() | sort == ['ansible_server1', 'ansible_server2'] | sort
|
||||||
|
|
||||||
|
- name: List servers with inventory plugin with IPv4 only
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: ansible-inventory --list --yaml --extra-vars only_ipv4=true --inventory-file openstack.yaml
|
||||||
|
chdir: "{{ tmp_dir.path }}"
|
||||||
|
environment:
|
||||||
|
ANSIBLE_INVENTORY_CACHE: "True"
|
||||||
|
ANSIBLE_INVENTORY_CACHE_PLUGIN: "jsonfile"
|
||||||
|
ANSIBLE_CACHE_PLUGIN_CONNECTION: "{{ tmp_dir.path }}/.cache/"
|
||||||
|
register: inventory
|
||||||
|
|
||||||
|
- name: Read YAML output from inventory plugin again
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
inventory: "{{ inventory.stdout | from_yaml }}"
|
||||||
|
|
||||||
|
- name: Check YAML output from inventory plugin again
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- inventory.all.children.RegionOne.hosts.keys() | sort == ['ansible_server1', 'ansible_server2'] | sort
|
||||||
|
|
||||||
- name: Delete server 2
|
- name: Delete server 2
|
||||||
openstack.cloud.resource:
|
openstack.cloud.resource:
|
||||||
service: compute
|
service: compute
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ ansible-galaxy collection install --requirements-file ci/requirements.yml
|
|||||||
if [ -z "$PIP_INSTALL" ]; then
|
if [ -z "$PIP_INSTALL" ]; then
|
||||||
tox -ebuild
|
tox -ebuild
|
||||||
ansible-galaxy collection install "$(find build_artifact/ -maxdepth 1 -name 'openstack-cloud-*')" --force
|
ansible-galaxy collection install "$(find build_artifact/ -maxdepth 1 -name 'openstack-cloud-*')" --force
|
||||||
TEST_COLLECTIONS_PATHS=${HOME}/.ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
|
TEST_COLLECTIONS_PATHS=${HOME}/.ansible/collections:$ANSIBLE_COLLECTIONS_PATH
|
||||||
else
|
else
|
||||||
pip freeze | grep ansible-collections-openstack
|
pip freeze | grep ansible-collections-openstack
|
||||||
TEST_COLLECTIONS_PATHS=$VIRTUAL_ENV/share/ansible/collections:$ANSIBLE_COLLECTIONS_PATHS
|
TEST_COLLECTIONS_PATHS=$VIRTUAL_ENV/share/ansible/collections:$ANSIBLE_COLLECTIONS_PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We need to source the current tox environment so that Ansible will
|
# We need to source the current tox environment so that Ansible will
|
||||||
@@ -129,7 +129,7 @@ cd ci/
|
|||||||
# Run tests
|
# Run tests
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
ANSIBLE_COLLECTIONS_PATHS=$TEST_COLLECTIONS_PATHS ansible-playbook \
|
ANSIBLE_COLLECTIONS_PATH=$TEST_COLLECTIONS_PATHS ansible-playbook \
|
||||||
-vvv ./run-collection.yml \
|
-vvv ./run-collection.yml \
|
||||||
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \
|
-e "sdk_version=${SDK_VER} cloud=${CLOUD} cloud_alt=${CLOUD_ALT} ${ANSIBLE_VARS}" \
|
||||||
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
|
${tag_opt} 2>&1 | sudo tee /opt/stack/logs/test_output.log
|
||||||
|
|||||||
@@ -32,4 +32,4 @@ build_ignore:
|
|||||||
- .vscode
|
- .vscode
|
||||||
- ansible_collections_openstack.egg-info
|
- ansible_collections_openstack.egg-info
|
||||||
- changelogs
|
- changelogs
|
||||||
version: 2.3.1
|
version: 2.3.3
|
||||||
|
|||||||
@@ -96,6 +96,12 @@ options:
|
|||||||
only.
|
only.
|
||||||
type: bool
|
type: bool
|
||||||
default: false
|
default: false
|
||||||
|
only_ipv4:
|
||||||
|
description:
|
||||||
|
- Use only ipv4 addresses for ansible_host and ansible_ssh_host.
|
||||||
|
- Using I(only_ipv4) helps when running Ansible in a ipv4 only setup.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
show_all:
|
show_all:
|
||||||
description:
|
description:
|
||||||
- Whether all servers should be listed or not.
|
- Whether all servers should be listed or not.
|
||||||
@@ -384,10 +390,17 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||||||
if address['OS-EXT-IPS:type'] == 'floating'),
|
if address['OS-EXT-IPS:type'] == 'floating'),
|
||||||
None)
|
None)
|
||||||
|
|
||||||
fixed_ip = next(
|
if self.get_option('only_ipv4'):
|
||||||
(address['addr'] for address in addresses
|
fixed_ip = next(
|
||||||
if address['OS-EXT-IPS:type'] == 'fixed'),
|
(address['addr'] for address in addresses
|
||||||
None)
|
if (address['OS-EXT-IPS:type'] == 'fixed' and address['version'] == 4)),
|
||||||
|
None)
|
||||||
|
|
||||||
|
else:
|
||||||
|
fixed_ip = next(
|
||||||
|
(address['addr'] for address in addresses
|
||||||
|
if address['OS-EXT-IPS:type'] == 'fixed'),
|
||||||
|
None)
|
||||||
|
|
||||||
ip = floating_ip if floating_ip is not None and not self.get_option('private') else fixed_ip
|
ip = floating_ip if floating_ip is not None and not self.get_option('private') else fixed_ip
|
||||||
|
|
||||||
|
|||||||
@@ -511,7 +511,7 @@ class PortModule(OpenStackModule):
|
|||||||
**(dict(network_id=network.id) if network else dict()))
|
**(dict(network_id=network.id) if network else dict()))
|
||||||
|
|
||||||
if self.ansible.check_mode:
|
if self.ansible.check_mode:
|
||||||
self.exit_json(changed=self._will_change(network, port, state))
|
self.exit_json(changed=self._will_change(port, state))
|
||||||
|
|
||||||
if state == 'present' and not port:
|
if state == 'present' and not port:
|
||||||
# create port
|
# create port
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
|
|
||||||
#
|
|
||||||
# Compat for python2.7
|
|
||||||
#
|
|
||||||
|
|
||||||
# One unittest needs to import builtins via __import__() so we need to have
|
|
||||||
# the string that represents it
|
|
||||||
try:
|
|
||||||
import __builtin__ # noqa
|
|
||||||
except ImportError:
|
|
||||||
BUILTINS = 'builtins'
|
|
||||||
else:
|
|
||||||
BUILTINS = '__builtin__'
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
|
|
||||||
'''
|
|
||||||
Compat module for Python3.x's unittest.mock module
|
|
||||||
'''
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Python 2.7
|
|
||||||
|
|
||||||
# Note: Could use the pypi mock library on python3.x as well as python2.x. It
|
|
||||||
# is the same as the python3 stdlib mock library
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Allow wildcard import because we really do want to import all of mock's
|
|
||||||
# symbols into this compat shim
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
from unittest.mock import * # noqa
|
|
||||||
except ImportError:
|
|
||||||
# Python 2
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
try:
|
|
||||||
from mock import * # noqa
|
|
||||||
except ImportError:
|
|
||||||
print('You need the mock library installed on python2.x to run tests')
|
|
||||||
|
|
||||||
|
|
||||||
# Prior to 3.4.4, mock_open cannot handle binary read_data
|
|
||||||
if sys.version_info >= (3,) and sys.version_info < (3, 4, 4):
|
|
||||||
file_spec = None
|
|
||||||
|
|
||||||
def _iterate_read_data(read_data):
|
|
||||||
# Helper for mock_open:
|
|
||||||
# Retrieve lines from read_data via a generator so that separate calls to
|
|
||||||
# readline, read, and readlines are properly interleaved
|
|
||||||
sep = b'\n' if isinstance(read_data, bytes) else '\n'
|
|
||||||
data_as_list = [li + sep for li in read_data.split(sep)]
|
|
||||||
|
|
||||||
if data_as_list[-1] == sep:
|
|
||||||
# If the last line ended in a newline, the list comprehension will have an
|
|
||||||
# extra entry that's just a newline. Remove this.
|
|
||||||
data_as_list = data_as_list[:-1]
|
|
||||||
else:
|
|
||||||
# If there wasn't an extra newline by itself, then the file being
|
|
||||||
# emulated doesn't have a newline to end the last line remove the
|
|
||||||
# newline that our naive format() added
|
|
||||||
data_as_list[-1] = data_as_list[-1][:-1]
|
|
||||||
|
|
||||||
for line in data_as_list:
|
|
||||||
yield line
|
|
||||||
|
|
||||||
def mock_open(mock=None, read_data=''):
|
|
||||||
"""
|
|
||||||
A helper function to create a mock to replace the use of `open`. It works
|
|
||||||
for `open` called directly or used as a context manager.
|
|
||||||
|
|
||||||
The `mock` argument is the mock object to configure. If `None` (the
|
|
||||||
default) then a `MagicMock` will be created for you, with the API limited
|
|
||||||
to methods or attributes available on standard file handles.
|
|
||||||
|
|
||||||
`read_data` is a string for the `read` methoddline`, and `readlines` of the
|
|
||||||
file handle to return. This is an empty string by default.
|
|
||||||
"""
|
|
||||||
def _readlines_side_effect(*args, **kwargs):
|
|
||||||
if handle.readlines.return_value is not None:
|
|
||||||
return handle.readlines.return_value
|
|
||||||
return list(_data)
|
|
||||||
|
|
||||||
def _read_side_effect(*args, **kwargs):
|
|
||||||
if handle.read.return_value is not None:
|
|
||||||
return handle.read.return_value
|
|
||||||
return type(read_data)().join(_data)
|
|
||||||
|
|
||||||
def _readline_side_effect():
|
|
||||||
if handle.readline.return_value is not None:
|
|
||||||
while True:
|
|
||||||
yield handle.readline.return_value
|
|
||||||
for line in _data:
|
|
||||||
yield line
|
|
||||||
|
|
||||||
global file_spec
|
|
||||||
if file_spec is None:
|
|
||||||
import _io # noqa
|
|
||||||
file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))
|
|
||||||
|
|
||||||
if mock is None:
|
|
||||||
mock = MagicMock(name='open', spec=open) # noqa
|
|
||||||
|
|
||||||
handle = MagicMock(spec=file_spec) # noqa
|
|
||||||
handle.__enter__.return_value = handle
|
|
||||||
|
|
||||||
_data = _iterate_read_data(read_data)
|
|
||||||
|
|
||||||
handle.write.return_value = None
|
|
||||||
handle.read.return_value = None
|
|
||||||
handle.readline.return_value = None
|
|
||||||
handle.readlines.return_value = None
|
|
||||||
|
|
||||||
handle.read.side_effect = _read_side_effect
|
|
||||||
handle.readline.side_effect = _readline_side_effect()
|
|
||||||
handle.readlines.side_effect = _readlines_side_effect
|
|
||||||
|
|
||||||
mock.return_value = handle
|
|
||||||
return mock
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
|
|
||||||
#
|
|
||||||
# This file is part of Ansible
|
|
||||||
#
|
|
||||||
# Ansible is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# Ansible is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
# Make coding more python3-ish
|
|
||||||
|
|
||||||
'''
|
|
||||||
Compat module for Python2.7's unittest module
|
|
||||||
'''
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
# Allow wildcard import because we really do want to import all of
|
|
||||||
# unittests's symbols into this compat shim
|
|
||||||
# pylint: disable=wildcard-import,unused-wildcard-import
|
|
||||||
if sys.version_info < (2, 7):
|
|
||||||
try:
|
|
||||||
# Need unittest2 on python2.6
|
|
||||||
from unittest2 import * # noqa
|
|
||||||
except ImportError:
|
|
||||||
print('You need unittest2 installed on python2.6.x to run tests')
|
|
||||||
else:
|
|
||||||
from unittest import * # noqa
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from ansible_collections.openstack.cloud.tests.unit.compat.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from ansible.utils.path import unfrackpath
|
from ansible.utils.path import unfrackpath
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
import unittest
|
||||||
|
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from io import BytesIO, StringIO
|
from io import BytesIO, StringIO
|
||||||
from ansible_collections.openstack.cloud.tests.unit.compat import unittest
|
|
||||||
from ansible.module_utils.six import PY3
|
from ansible.module_utils.six import PY3
|
||||||
from ansible.module_utils._text import to_bytes
|
from ansible.module_utils._text import to_bytes
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import collections
|
import collections
|
||||||
import inspect
|
import inspect
|
||||||
import mock
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from unittest import mock
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from ansible.module_utils.six import string_types
|
from ansible.module_utils.six import string_types
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
from ansible_collections.openstack.cloud.tests.unit.compat import unittest
|
|
||||||
from ansible_collections.openstack.cloud.tests.unit.compat.mock import patch
|
|
||||||
from ansible.module_utils import basic
|
from ansible.module_utils import basic
|
||||||
from ansible.module_utils._text import to_bytes
|
from ansible.module_utils._text import to_bytes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user