Build skel to separate the OSA connection plugin
This change implements the basic skeleton to create a new repo for the OSA connection plugin. This change will allow the connection plugin to be installed standalone, and maintained by a larger community. This change has pruned the git history so that all of the old history and commiters record for the connection plugin remains intact. Signed-off-by: Kevin Carter <kevin@cloudnull.com>
This commit is contained in:
parent
43200c2292
commit
f2364022a6
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
*.py[cod]
|
||||
|
||||
# Testing cruft
|
||||
.tox
|
||||
.venv
|
||||
*.egg*
|
||||
egg
|
||||
.coverage
|
||||
cover
|
||||
.tox
|
||||
nosetests.xml
|
||||
.testrepository
|
||||
.venv
|
||||
|
||||
# Editors
|
||||
*~
|
||||
.*.swp
|
||||
.*sw?
|
||||
|
||||
# Playbook retry files
|
||||
*.retry
|
49
.pre-commit-config.yaml
Normal file
49
.pre-commit-config.yaml
Normal file
@ -0,0 +1,49 @@
|
||||
---
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v2.1.0
|
||||
hooks:
|
||||
- id: end-of-file-fixer
|
||||
- id: trailing-whitespace
|
||||
- id: mixed-line-ending
|
||||
- id: check-byte-order-marker
|
||||
- id: check-executables-have-shebangs
|
||||
- id: check-merge-conflict
|
||||
- id: debug-statements
|
||||
- id: flake8
|
||||
entry: flake8 --ignore=E24,E121,E122,E123,E124,E126,E226,E265,E305,E402,F401,F405,E501,E704,F403,F841,W503
|
||||
# TODO(cloudnull): These codes were added to pass the lint check.
|
||||
# All of these ignore codes should be resolved in
|
||||
# future PRs.
|
||||
- id: check-yaml
|
||||
files: .*\.(yaml|yml)$
|
||||
- repo: https://github.com/adrienverge/yamllint.git
|
||||
rev: v1.15.0
|
||||
hooks:
|
||||
- id: yamllint
|
||||
files: \.(yaml|yml)$
|
||||
types: [file, yaml]
|
||||
entry: yamllint --strict -f parsable
|
||||
- repo: https://github.com/ansible/ansible-lint
|
||||
rev: v4.1.0a0
|
||||
hooks:
|
||||
- id: ansible-lint
|
||||
files: \.(yaml|yml)$
|
||||
entry: >-
|
||||
ansible-lint --force-color -v -x "ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
|
||||
--exclude=tripleo_ansible/roles.galaxy
|
||||
# TODO(cloudnull): These codes were added to pass the lint check.
|
||||
# Things found within roles.galaxy are external
|
||||
# and not something maintained here.
|
||||
- repo: https://github.com/openstack-dev/bashate.git
|
||||
rev: 0.6.0
|
||||
hooks:
|
||||
- id: bashate
|
||||
entry: bashate --error . --verbose --ignore=E006,E040
|
||||
# Run bashate check for all bash scripts
|
||||
# Ignores the following rules:
|
||||
# E006: Line longer than 79 columns (as many scripts use jinja
|
||||
# templating, this is very difficult)
|
||||
# E040: Syntax error determined using `bash -n` (as many scripts
|
||||
# use jinja templating, this will often fail and the syntax
|
||||
# error will be discovered in execution anyway)
|
10
.yamllint
Normal file
10
.yamllint
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
# matches hardcoded 160 value from ansible-lint
|
||||
max: 160
|
||||
|
||||
ignore: |
|
||||
zuul.d/*.yaml
|
100
CONTRIBUTING.rst
Normal file
100
CONTRIBUTING.rst
Normal file
@ -0,0 +1,100 @@
|
||||
Ansible-Plugin-Connection
|
||||
#########################
|
||||
:tags: openstack, cloud, ansible
|
||||
:category: \*nix
|
||||
|
||||
contributor guidelines
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Filing Bugs
|
||||
-----------
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net
|
||||
/openstack-ansible"
|
||||
|
||||
|
||||
When submitting a bug, or working on a bug, please ensure the following
|
||||
criteria are met:
|
||||
* The description clearly states or describes the original problem or root
|
||||
cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* The provided information should be totally self-contained. External
|
||||
access to web services/sites should not be needed.
|
||||
* Steps to reproduce the problem if possible.
|
||||
|
||||
|
||||
Submitting Code
|
||||
---------------
|
||||
|
||||
Changes to the project should be submitted for review via the Gerrit tool,
|
||||
following the workflow documented at:
|
||||
"http://docs.openstack.org/infra/manual/developers.html#development-workflow"
|
||||
|
||||
Pull requests submitted through GitHub will be ignored and closed without
|
||||
regard.
|
||||
|
||||
|
||||
Extra
|
||||
-----
|
||||
|
||||
Tags: If it's a bug that needs fixing in a branch in addition to Master, add a
|
||||
'\<release\>-backport-potential' tag (eg ``juno-backport-potential``).
|
||||
There are predefined tags that will autocomplete.
|
||||
|
||||
Status:
|
||||
Please leave this alone, it should be New till someone triages the issue.
|
||||
|
||||
Importance:
|
||||
Should only be touched if it is a Blocker/Gating issue. If it is, please
|
||||
set to High, and only use Critical if you have found a bug that can take
|
||||
down whole infrastructures.
|
||||
|
||||
|
||||
Style guide
|
||||
-----------
|
||||
|
||||
When creating tasks and other roles for use in Ansible please create then
|
||||
using the YAML dictionary format.
|
||||
|
||||
Example YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name:
|
||||
thing1: "some-stuff"
|
||||
thing2: "some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Example **NOT** in YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name: thing1="some-stuff" thing2="some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Usage of the ">" and "|" operators should be limited to Ansible conditionals
|
||||
and command modules such as the ansible ``shell`` module.
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
When submitting an issue, or working on an issue please ensure the following
|
||||
criteria are met:
|
||||
* The description clearly states or describes the original problem or root
|
||||
cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* If the issue is a bug that needs fixing in a branch other than Master,
|
||||
add the 'backport potential' tag TO THE ISSUE (not the PR).
|
||||
* The provided information should be totally self-contained. External
|
||||
access to web services/sites should not be needed.
|
||||
* If the issue is needed for a hotfix release, add the 'expedite' label.
|
||||
* Steps to reproduce the problem if possible.
|
229
LICENSE
Normal file
229
LICENSE
Normal file
@ -0,0 +1,229 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
Files in this project licensed under the MIT license:
|
||||
|
||||
- callbacks/profile_tasks.py
|
30
README.rst
Normal file
30
README.rst
Normal file
@ -0,0 +1,30 @@
|
||||
========================
|
||||
Team and repository tags
|
||||
========================
|
||||
|
||||
.. image:: https://governance.openstack.org/tc/badges/ansible-plugin-connection.svg
|
||||
:target: https://governance.openstack.org/tc/reference/tags/index.html
|
||||
|
||||
.. Change things from this point on
|
||||
|
||||
=========================
|
||||
Ansible-Plugin-Connection
|
||||
=========================
|
||||
|
||||
This is a plugin which provides for the ability to connetion to container resources
|
||||
on remote machines.
|
||||
|
||||
Documentation for the project can be found at:
|
||||
https://docs.openstack.org/ansible-plugin-connection/latest/
|
||||
|
||||
Release notes for the project can be found at:
|
||||
https://docs.openstack.org/releasenotes/ansible-plugin-connection/
|
||||
|
||||
The project source code repository is located at:
|
||||
https://opendev.org/openstack/ansible-plugin-connection/
|
||||
|
||||
The project home is at:
|
||||
https://launchpad.net/openstack-ansible
|
||||
|
||||
The project bug tracker is located at:
|
||||
https://bugs.launchpad.net/openstack-ansible
|
67
Vagrantfile
vendored
Normal file
67
Vagrantfile
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
# Note:
|
||||
# This file is maintained in the openstack-ansible-tests repository.
|
||||
# https://opendev.org/openstack/openstack-ansible-tests/src/Vagrantfile
|
||||
#
|
||||
# If you need to perform any change on it, you should modify the central file,
|
||||
# then, an OpenStack CI job will propagate your changes to every OSA repository
|
||||
# since every repo uses the same Vagrantfile
|
||||
|
||||
# Verify whether required plugins are installed.
|
||||
required_plugins = [ "vagrant-disksize" ]
|
||||
required_plugins.each do |plugin|
|
||||
if not Vagrant.has_plugin?(plugin)
|
||||
raise "The vagrant plugin #{plugin} is required. Please run `vagrant plugin install #{plugin}`"
|
||||
end
|
||||
end
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
config.vm.provider "virtualbox" do |v|
|
||||
v.memory = 6144
|
||||
v.cpus = 2
|
||||
# https://github.com/hashicorp/vagrant/issues/9524
|
||||
v.customize ["modifyvm", :id, "--audio", "none"]
|
||||
end
|
||||
|
||||
config.vm.synced_folder ".", "/vagrant", type: "rsync"
|
||||
|
||||
config.vm.provision "shell",
|
||||
privileged: false,
|
||||
inline: <<-SHELL
|
||||
cd /vagrant
|
||||
./run_tests.sh
|
||||
SHELL
|
||||
|
||||
config.vm.define "centos7" do |centos7|
|
||||
centos7.vm.box = "centos/7"
|
||||
end
|
||||
|
||||
config.vm.define "debian8" do |debian8|
|
||||
debian8.vm.box = "debian/jessie64"
|
||||
end
|
||||
|
||||
config.vm.define "debian9" do |debian9|
|
||||
debian9.vm.box = "debian/stretch64"
|
||||
end
|
||||
|
||||
config.vm.define "gentoo" do |gentoo|
|
||||
gentoo.vm.box = "generic/gentoo"
|
||||
end
|
||||
|
||||
config.vm.define "opensuse150" do |leap150|
|
||||
leap150.vm.box = "opensuse/openSUSE-15.0-x86_64"
|
||||
end
|
||||
|
||||
config.vm.define "opensuse151" do |leap150|
|
||||
leap150.vm.box = "opensuse/openSUSE-15.1-x86_64"
|
||||
end
|
||||
|
||||
config.vm.define "ubuntu1604" do |xenial|
|
||||
xenial.disksize.size = "40GB"
|
||||
xenial.vm.box = "ubuntu/xenial64"
|
||||
end
|
||||
|
||||
config.vm.define "ubuntu1804" do |bionic|
|
||||
bionic.disksize.size = "40GB"
|
||||
bionic.vm.box = "ubuntu/bionic64"
|
||||
end
|
||||
end
|
19
ansible-test-env.rc
Normal file
19
ansible-test-env.rc
Normal file
@ -0,0 +1,19 @@
|
||||
export ANSIBLE_WORKPATH="$(dirname $(readlink -f ${BASH_SOURCE[0]}))"
|
||||
export ANSIBLE_STDOUT_CALLBACK=debug
|
||||
export ANSIBLE_CONNECTION_PLUGINS="${ANSIBLE_WORKPATH}/connection"
|
||||
export ANSIBLE_INVENTORY="${ANSIBLE_WORKPATH}/tests/hosts.ini"
|
||||
export ANSIBLE_RETRY_FILES_ENABLED="0"
|
||||
export ANSIBLE_LOAD_CALLBACK_PLUGINS="1"
|
||||
export ANSIBLE_HOST_KEY_CHECKING=False
|
||||
|
||||
function unset-ansible-test-env {
|
||||
for i in $(env | grep ANSIBLE_ | awk -F'=' '{print $1}'); do
|
||||
unset ${i}
|
||||
done
|
||||
unset ANSIBLE_WORKPATH
|
||||
echo -e "Ansible test environment deactivated.\n"
|
||||
unset -f unset-ansible-test-env
|
||||
}
|
||||
|
||||
echo -e "Ansible test environment is now active"
|
||||
echo -e "Run 'unset-ansible-test-env' to deactivate.\n"
|
52
bindep.txt
Normal file
52
bindep.txt
Normal file
@ -0,0 +1,52 @@
|
||||
# This file facilitates OpenStack-CI package installation
|
||||
# before the execution of any tests.
|
||||
#
|
||||
# See the following for details:
|
||||
# - https://docs.openstack.org/infra/bindep/
|
||||
# - https://opendev.org/openstack-infra/bindep
|
||||
#
|
||||
# Even if the role does not make use of this facility, it
|
||||
# is better to have this file empty, otherwise OpenStack-CI
|
||||
# will fall back to installing its default packages which
|
||||
# will potentially be detrimental to the tests executed.
|
||||
#
|
||||
# Note:
|
||||
# This file is maintained in the openstack-ansible-tests repository.
|
||||
# https://opendev.org/openstack/openstack-ansible-tests/src/bindep.txt
|
||||
# If you need to remove or add extra dependencies, you should modify
|
||||
# the central file instead and once your change is accepted then update
|
||||
# this file as well. The purpose of this file is to ensure that Python and
|
||||
# Ansible have all their necessary binary requirements on the test host before
|
||||
# tox executes. Any binary requirements needed by services/roles should be
|
||||
# installed by those roles in their applicable package install tasks, not through
|
||||
# using this file.
|
||||
#
|
||||
|
||||
# The gcc compiler
|
||||
gcc
|
||||
|
||||
# Base requirements for Ubuntu
|
||||
git-core [platform:dpkg platform:suse]
|
||||
libssl-dev [platform:dpkg]
|
||||
libffi-dev [platform:dpkg]
|
||||
python2.7 [platform:dpkg]
|
||||
python-apt [platform:dpkg]
|
||||
python-dev [platform:dpkg]
|
||||
python3 [platform:dpkg]
|
||||
python3-apt [platform:dpkg]
|
||||
python3-dev [platform:dpkg]
|
||||
|
||||
# Base requirements for RPM distros
|
||||
gcc-c++ [platform:rpm]
|
||||
git [platform:rpm !platform:suse]
|
||||
libffi-devel [platform:rpm]
|
||||
openssl-devel [platform:rpm]
|
||||
python-devel [platform:rpm]
|
||||
python2-dnf [platform:fedora]
|
||||
|
||||
# For SELinux
|
||||
libselinux-python [platform:redhat]
|
||||
libsemanage-python [platform:redhat]
|
||||
|
||||
# Required for compressing collected log files in CI
|
||||
gzip
|
0
doc/build/html/.gitkeep
vendored
Normal file
0
doc/build/html/.gitkeep
vendored
Normal file
0
doc/source/.gitkeep
Normal file
0
doc/source/.gitkeep
Normal file
17
molecule-requirements.txt
Normal file
17
molecule-requirements.txt
Normal file
@ -0,0 +1,17 @@
|
||||
# this is required for the molecule jobs
|
||||
ansible
|
||||
ansi2html
|
||||
docker
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-html
|
||||
pytest-xdist
|
||||
mock
|
||||
molecule>=2.22rc1
|
||||
|
||||
# this is required for the docs build jobs
|
||||
sphinx
|
||||
openstackdocstheme>=1.29.2 # Apache-2.0
|
||||
reno>=2.11.3 # Apache-2.0
|
||||
doc8>=0.8.0 # Apache-2.0
|
||||
bashate>=0.6.0 # Apache-2.0
|
37
molecule/default/Dockerfile
Normal file
37
molecule/default/Dockerfile
Normal file
@ -0,0 +1,37 @@
|
||||
# Molecule managed
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash {{ item.pkg_extras | default('') }} && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl python-setuptools bash {{ item.pkg_extras | default('') }} && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml {{ item.pkg_extras | default('') }} && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates {{ item.pkg_extras | default('') }}; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates {{ item.pkg_extras | default('') }} && xbps-remove -O; fi
|
||||
|
||||
{% for pkg in item.easy_install | default([]) %}
|
||||
# install pip for centos where there is no python-pip rpm in default repos
|
||||
RUN easy_install {{ pkg }}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
CMD ["sh", "-c", "while true; do sleep 10000; done"]
|
46
molecule/default/molecule.yml
Normal file
46
molecule/default/molecule.yml
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
driver:
|
||||
name: docker
|
||||
|
||||
log: true
|
||||
|
||||
platforms:
|
||||
- name: centos7
|
||||
hostname: centos7
|
||||
image: centos:7
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python-setuptools
|
||||
easy_install:
|
||||
- pip
|
||||
environment: &env
|
||||
http_proxy: "{{ lookup('env', 'http_proxy') }}"
|
||||
https_proxy: "{{ lookup('env', 'https_proxy') }}"
|
||||
|
||||
- name: fedora28
|
||||
hostname: fedora28
|
||||
image: fedora:28
|
||||
dockerfile: Dockerfile
|
||||
pkg_extras: python*-setuptools
|
||||
environment:
|
||||
<<: *env
|
||||
|
||||
provisioner:
|
||||
name: ansible
|
||||
log: true
|
||||
env:
|
||||
ANSIBLE_STDOUT_CALLBACK: yaml
|
||||
|
||||
scenario:
|
||||
test_sequence:
|
||||
- destroy
|
||||
- create
|
||||
- converge
|
||||
- destroy
|
||||
|
||||
lint:
|
||||
enabled: false
|
||||
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
23
molecule/default/playbook.yml
Normal file
23
molecule/default/playbook.yml
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
- name: Converge
|
||||
hosts: all
|
||||
tasks:
|
||||
- name: Testing
|
||||
debug:
|
||||
msg: test
|
0
releasenotes/build/html/.gitkeep
Normal file
0
releasenotes/build/html/.gitkeep
Normal file
0
releasenotes/source/.gitkeep
Normal file
0
releasenotes/source/.gitkeep
Normal file
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
pbr>=1.6
|
48
scripts/bindep-install
Executable file
48
scripts/bindep-install
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
## Shell Opts ----------------------------------------------------------------
|
||||
|
||||
set -o pipefail
|
||||
set -xeuo
|
||||
|
||||
|
||||
## Vars ----------------------------------------------------------------------
|
||||
|
||||
export BINDEP_FILE="${BINDEP_FILE:-$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../bindep.txt}"
|
||||
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
|
||||
# Source distribution information
|
||||
source /etc/os-release || source /usr/lib/os-release
|
||||
PKG_MGR=$(command -v dnf || command -v yum || command -v apt || command -v zypper)
|
||||
|
||||
# NOTE(cloudnull): Get a list of packages to install with bindep. If packages
|
||||
# need to be installed, bindep exits with an exit code of 1.
|
||||
BINDEP_PKGS=$(bindep -b -f "${BINDEP_FILE}" test || true)
|
||||
|
||||
if [[ ${#BINDEP_PKGS} > 0 ]]; then
|
||||
case "${ID,,}" in
|
||||
amzn|rhel|centos|fedora|ubuntu|debian)
|
||||
sudo "${PKG_MGR}" install -y ${BINDEP_PKGS}
|
||||
;;
|
||||
*suse*)
|
||||
sudo "${PKG_MGR}" -n install ${BINDEP_PKGS}
|
||||
;;
|
||||
esac
|
||||
fi
|
70
scripts/run-local-test
Executable file
70
scripts/run-local-test
Executable file
@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
## Shell Opts ----------------------------------------------------------------
|
||||
|
||||
set -o pipefail
|
||||
set -xeuo
|
||||
|
||||
## Vars ----------------------------------------------------------------------
|
||||
|
||||
export PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../"
|
||||
export CONTAINER_TECH="${CONTAINER_TECH:-$1}"
|
||||
export JOB_ANSIBLE_ARGS=${JOB_ANSIBLE_ARGS:-"-v"}
|
||||
|
||||
## Main ----------------------------------------------------------------------
|
||||
|
||||
# Source distribution information
|
||||
source /etc/os-release || source /usr/lib/os-release
|
||||
RHT_PKG_MGR=$(command -v dnf || command -v yum)
|
||||
PYTHON_EXEC=$(command -v python3 || command -v python)
|
||||
|
||||
# Install the one requirement we need to run any local test
|
||||
case "${ID,,}" in
|
||||
amzn|rhel|centos|fedora)
|
||||
sudo "${RHT_PKG_MGR}" install -y python*-virtualenv
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create a virtual env
|
||||
"${PYTHON_EXEC}" -m virtualenv --system-site-packages "${HOME}/test-python"
|
||||
|
||||
# Run bindep
|
||||
"${HOME}/test-python/bin/pip" install pip setuptools bindep --upgrade
|
||||
"${PROJECT_DIR}/scripts/bindep-install"
|
||||
|
||||
# Install local requirements
|
||||
if [[ -d "${HOME}/.cache/pip/wheels" ]]; then
|
||||
rm -rf "${HOME}/.cache/pip/wheels"
|
||||
fi
|
||||
"${HOME}/test-python/bin/pip" install \
|
||||
-r "${PROJECT_DIR}/requirements.txt" \
|
||||
-r "${PROJECT_DIR}/test-requirements.txt" \
|
||||
-r "${PROJECT_DIR}/molecule-requirements.txt"
|
||||
|
||||
# Run local test
|
||||
PS1="[\u@\h \W]\$" source "${HOME}/test-python/bin/activate"
|
||||
source "${PROJECT_DIR}/ansible-test-env.rc"
|
||||
export ANSIBLE_ROLES_PATH="${ANSIBLE_ROLES_PATH}:${HOME}/zuul-jobs/roles"
|
||||
ansible-playbook -i "${PROJECT_DIR}/tests/hosts.ini" \
|
||||
-e "project_src=${PROJECT_DIR}" \
|
||||
-e "container_tech=${CONTAINER_TECH}" \
|
||||
-e "job_ansible_args='${JOB_ANSIBLE_ARGS}'" \
|
||||
-e "ansible_user=${USER}" \
|
||||
-e "ansible_user_dir=${HOME}" \
|
||||
"${PROJECT_DIR}/zuul.d/playbooks/prepare-test-host.yml" \
|
||||
"${PROJECT_DIR}/zuul.d/playbooks/run-local.yml"
|
33
setup.cfg
Normal file
33
setup.cfg
Normal file
@ -0,0 +1,33 @@
|
||||
[metadata]
|
||||
name = ansible-plugin-connection
|
||||
summary = Ansible connection Plugin
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack
|
||||
author-email = openstack-discuss@lists.openstack.org
|
||||
home-page = https://docs.openstack.org/ansible-plugin-connection/latest/
|
||||
classifier =
|
||||
Intended Audience :: Developers
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
build-dir = doc/build
|
||||
source-dir = doc/source
|
||||
|
||||
[pbr]
|
||||
skip_authors = True
|
||||
skip_changelog = True
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
|
||||
[files]
|
||||
data_files =
|
||||
share/ansible/plugins/connection = connection/*
|
29
setup.py
Normal file
29
setup.py
Normal file
@ -0,0 +1,29 @@
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
try:
|
||||
import multiprocessing # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr>=2.0.0'],
|
||||
pbr=True)
|
2
test-requirements.txt
Normal file
2
test-requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
pre-commit # MIT
|
||||
netaddr # BSD
|
20
tests/conftest.py
Normal file
20
tests/conftest.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import os
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption('--scenario', help='scenario setting')
|
||||
parser.addoption('--ansible-args', help='ansible args passed into test runner.')
|
1
tests/hosts.ini
Normal file
1
tests/hosts.ini
Normal file
@ -0,0 +1 @@
|
||||
test ansible_connection=local ansible_host=localhost
|
45
tests/test_molecule.py
Normal file
45
tests/test_molecule.py
Normal file
@ -0,0 +1,45 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_molecule(pytestconfig):
|
||||
cmd = ['python', '-m', 'molecule']
|
||||
scenario = pytestconfig.getoption("scenario")
|
||||
ansible_args = pytestconfig.getoption("ansible_args")
|
||||
|
||||
if ansible_args:
|
||||
cmd.append('converge')
|
||||
if scenario:
|
||||
cmd.extend(['--scenario-name', scenario])
|
||||
cmd.append('--')
|
||||
cmd.extend(ansible_args.split())
|
||||
else:
|
||||
cmd.append('test')
|
||||
if scenario:
|
||||
cmd.extend(['--scenario-name', scenario])
|
||||
else:
|
||||
cmd.append('--all')
|
||||
|
||||
try:
|
||||
assert subprocess.call(cmd) == 0
|
||||
finally:
|
||||
if ansible_args:
|
||||
cmd = ['python', '-m', 'molecule', 'destroy']
|
||||
if scenario:
|
||||
cmd.extend(['--scenario-name', scenario])
|
||||
subprocess.call(cmd)
|
104
tox.ini
Normal file
104
tox.ini
Normal file
@ -0,0 +1,104 @@
|
||||
[tox]
|
||||
minversion = 2.0
|
||||
envlist = docs, linters
|
||||
skipdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} {opts} {packages}
|
||||
passenv = *
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
ANSIBLE_CONNECTION_PLUGINS={toxinidir}/connection
|
||||
ANSIBLE_INVENTORY={toxinidir}/tests/hosts.ini
|
||||
ANSIBLE_NOCOWS=1
|
||||
ANSIBLE_RETRY_FILES_ENABLED=0
|
||||
ANSIBLE_STDOUT_CALLBACK=debug
|
||||
ANSIBLE_LOG_PATH={envlogdir}/ansible-execution.log
|
||||
VIRTUAL_ENV={envdir}
|
||||
# pip: Avoid 2020-01-01 warnings: https://github.com/pypa/pip/issues/6207
|
||||
# paramiko CryptographyDeprecationWarning: https://github.com/ansible/ansible/issues/52598
|
||||
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command,ignore::UserWarning
|
||||
PIP_DISABLE_PIP_VERSION_CHECK=1
|
||||
sitepackages = True
|
||||
deps = -r {toxinidir}/test-requirements.txt
|
||||
whitelist_externals = bash
|
||||
|
||||
[testenv:bindep]
|
||||
# Do not install any requirements. We want this to be fast and work even if
|
||||
# system dependencies are missing, since it's used to tell you what system
|
||||
# dependencies are missing! This also means that bindep must be installed
|
||||
# separately, outside of the requirements files.
|
||||
deps = bindep
|
||||
commands = bindep test
|
||||
|
||||
[testenv:pep8]
|
||||
envdir = {toxworkdir}/linters
|
||||
commands =
|
||||
python -m pre_commit run flake8 -a
|
||||
|
||||
[testenv:ansible-lint]
|
||||
envdir = {toxworkdir}/linters
|
||||
deps =
|
||||
{[testenv:linters]deps}
|
||||
commands =
|
||||
python -m pre_commit run ansible-lint -a
|
||||
|
||||
[testenv:yamllint]
|
||||
envdir = {toxworkdir}/linters
|
||||
deps = {[testenv:linters]deps}
|
||||
commands =
|
||||
python -m pre_commit run yamllint -a
|
||||
|
||||
[testenv:bashate]
|
||||
envdir = {toxworkdir}/linters
|
||||
deps = {[testenv:linters]deps}
|
||||
commands =
|
||||
python -m pre_commit run bashate -a
|
||||
|
||||
[testenv:whitespace]
|
||||
envdir = {toxworkdir}/linters
|
||||
deps = {[testenv:linters]deps}
|
||||
commands =
|
||||
python -m pre_commit run trailing-whitespace -a
|
||||
|
||||
[testenv:shebangs]
|
||||
envdir = {toxworkdir}/linters
|
||||
deps = {[testenv:linters]deps}
|
||||
commands =
|
||||
python -m pre_commit run check-executables-have-shebangs -a
|
||||
|
||||
[testenv:linters]
|
||||
deps =
|
||||
-r {toxinidir}/requirements.txt
|
||||
-r {toxinidir}/test-requirements.txt
|
||||
-r {toxinidir}/molecule-requirements.txt
|
||||
commands =
|
||||
{[testenv:pep8]commands}
|
||||
{[testenv:ansible-lint]commands}
|
||||
{[testenv:bashate]commands}
|
||||
{[testenv:yamllint]commands}
|
||||
{[testenv:whitespace]commands}
|
||||
{[testenv:shebangs]commands}
|
||||
|
||||
[testenv:releasenotes]
|
||||
basepython = python3
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
deps =
|
||||
-r {toxinidir}/doc/requirements.txt
|
||||
commands=
|
||||
doc8 doc
|
||||
sphinx-build -a -E -W -d doc/build/doctrees -b html doc/source doc/build/html -T
|
||||
|
||||
[doc8]
|
||||
# Settings for doc8:
|
||||
extensions = .rst
|
||||
ignore = D001
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
19
zuul.d.prep/base.yaml
Normal file
19
zuul.d.prep/base.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
---
|
||||
- job:
|
||||
description: Base ansible-connection-plugin job
|
||||
name: ansible-connection-plugin-centos-7-base
|
||||
nodeset: centos-7
|
||||
parent: base
|
||||
pre-run:
|
||||
- zuul.d/playbooks/prepare-test-host.yml
|
||||
- zuul.d/playbooks/pre.yml
|
||||
run:
|
||||
- zuul.d/playbooks/run.yml
|
||||
timeout: 1800
|
||||
voting: true
|
||||
- job:
|
||||
files:
|
||||
- ^doc/.*
|
||||
- ^README.rst
|
||||
name: ansible-connection-plugin-docs
|
||||
parent: openstack-tox-docs
|
17
zuul.d.prep/layout.yaml
Normal file
17
zuul.d.prep/layout.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- project:
|
||||
templates:
|
||||
- ansible-connection-plugin-molecule-jobs
|
||||
- release-notes-jobs-python3
|
||||
check:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- ansible-connection-plugin-docs
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- ansible-connection-plugin-docs
|
||||
post:
|
||||
jobs:
|
||||
- publish-openstack-python-branch-tarball
|
||||
- publish-openstack-tox-docs
|
14
zuul.d.prep/molecule.yaml
Normal file
14
zuul.d.prep/molecule.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- project-template:
|
||||
check:
|
||||
jobs:
|
||||
- ansible-connection-plugin-centos-7-molecule-docker
|
||||
gate:
|
||||
jobs:
|
||||
- ansible-connection-plugin-centos-7-molecule-docker
|
||||
name: ansible-connection-plugin-molecule-jobs
|
||||
- job:
|
||||
name: ansible-connection-plugin-centos-7-molecule-docker
|
||||
parent: ansible-connection-plugin-centos-7-base
|
||||
vars:
|
||||
container_tech: docker
|
42
zuul.d.prep/playbooks/pre.yml
Normal file
42
zuul.d.prep/playbooks/pre.yml
Normal file
@ -0,0 +1,42 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
pre_tasks:
|
||||
- name: Set project path fact
|
||||
set_fact:
|
||||
ansible_project_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||
|
||||
- name: Ensure output dirs
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/zuul-output/logs"
|
||||
state: directory
|
||||
|
||||
- name: Setup bindep
|
||||
pip:
|
||||
name: "bindep"
|
||||
virtualenv: "{{ ansible_user_dir }}/test-python"
|
||||
virtualenv_site_packages: true
|
||||
|
||||
- name: Run bindep
|
||||
shell: |-
|
||||
. {{ ansible_user_dir }}/test-python/bin/activate
|
||||
{{ ansible_project_path }}/scripts/bindep-install
|
||||
become: true
|
||||
|
||||
- name: Setup test-python
|
||||
pip:
|
||||
requirements: "{{ ansible_project_path }}/molecule-requirements.txt"
|
||||
virtualenv: "{{ ansible_user_dir }}/test-python"
|
||||
virtualenv_site_packages: true
|
||||
tasks:
|
||||
- name: Get Ansible Galaxy roles
|
||||
command: >-
|
||||
{{ ansible_user_dir }}/test-python/bin/ansible-galaxy install
|
||||
-fr
|
||||
{{ ansible_project_path }}/ansible/ansible-role-requirements.yml
|
||||
environment:
|
||||
ANSIBLE_ROLES_PATH: "{{ ansible_project_path }}/ansible/roles.galaxy"
|
||||
roles:
|
||||
- role: install-docker
|
||||
when:
|
||||
- container_tech == 'docker'
|
68
zuul.d.prep/playbooks/prepare-test-host.yml
Normal file
68
zuul.d.prep/playbooks/prepare-test-host.yml
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
- name: pre prepare
|
||||
hosts: all
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: set basic user fact
|
||||
fail:
|
||||
msg: >-
|
||||
The variable `ansible_user` set this option and try again. On the
|
||||
CLI this can be defined with "-e ansible_user=${USER}"
|
||||
when:
|
||||
- ansible_user is undefined
|
||||
|
||||
- name: set basic home fact
|
||||
fail:
|
||||
msg: >-
|
||||
The variable `ansible_user_dir` set this option and try again. On
|
||||
the CLI this can be defined with "-e ansible_user_dir=${HOME}"
|
||||
when:
|
||||
- ansible_user_dir is undefined
|
||||
|
||||
- name: Ensure the user has a .ssh directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/.ssh"
|
||||
state: directory
|
||||
owner: "{{ ansible_user }}"
|
||||
group: "{{ ansible_user }}"
|
||||
mode: "0700"
|
||||
|
||||
- name: Create ssh key pair
|
||||
user:
|
||||
name: "{{ ansible_user }}"
|
||||
generate_ssh_key: true
|
||||
ssh_key_bits: 2048
|
||||
ssh_key_file: "{{ ansible_user_dir }}/.ssh/id_rsa"
|
||||
|
||||
- name: Slurp pub key
|
||||
slurp:
|
||||
src: "{{ ansible_user_dir ~ '/.ssh/id_rsa.pub' }}"
|
||||
register: pub_key
|
||||
|
||||
- name: Ensure can ssh to can connect to localhost
|
||||
authorized_key:
|
||||
user: "{{ ansible_user }}"
|
||||
key: "{{ pub_key['content'] | b64decode }}"
|
||||
|
||||
- name: Get the zuul/zuul-jobs repo
|
||||
git:
|
||||
repo: https://opendev.org/zuul/zuul-jobs
|
||||
dest: "{{ ansible_user_dir }}/zuul-jobs"
|
||||
version: master
|
||||
force: true
|
14
zuul.d.prep/playbooks/run-local.yml
Normal file
14
zuul.d.prep/playbooks/run-local.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: set basic zuul fact
|
||||
set_fact:
|
||||
zuul:
|
||||
project:
|
||||
src_dir: "{{ project_src }}"
|
||||
ansible_connection: ssh
|
||||
|
||||
- import_playbook: pre.yml
|
||||
|
||||
- import_playbook: run.yml
|
30
zuul.d.prep/playbooks/run.yml
Normal file
30
zuul.d.prep/playbooks/run.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
environment:
|
||||
ANSIBLE_LOG_PATH: "{{ ansible_user_dir }}/zuul-output/logs/ansible-execution.log"
|
||||
pre_tasks:
|
||||
- name: Set project path fact
|
||||
set_fact:
|
||||
ansible_project_path: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"
|
||||
|
||||
- name: Set action plugin path fact
|
||||
set_fact:
|
||||
action_connection_plugins_paths:
|
||||
- "{{ ansible_project_path }}/connection"
|
||||
tasks:
|
||||
- name: Run role test job
|
||||
shell: |-
|
||||
. {{ ansible_user_dir }}/test-python/bin/activate
|
||||
. {{ ansible_project_path }}/ansible-test-env.rc
|
||||
pytest --color=no \
|
||||
--html={{ ansible_user_dir }}/zuul-output/logs/reports.html \
|
||||
--self-contained-html \
|
||||
-s \
|
||||
--ansible-args='{{ job_ansible_args | default("-v") }}' \
|
||||
{{ ansible_project_path }}/tests/test_molecule.py
|
||||
args:
|
||||
chdir: "{{ ansible_project_path }}"
|
||||
executable: /bin/bash
|
||||
environment:
|
||||
ANSIBLE_CONNECTION_PLUGINS: "{{ action_connection_plugins_paths | join(':') }}"
|
Loading…
Reference in New Issue
Block a user