18 Commits

Author SHA1 Message Date
Mark Goddard
3f10f70840 Drop python 2 support from action plugins
These are executed on the local host where we run ansible-playbook,
and we have agreed to drop Python 2 support there.

Partially Implements: blueprint drop-py2-support
Change-Id: Id2190c3a22a56f4f048afbf0f7200daa8f41a292
2019-12-11 16:07:37 +00:00
Radosław Piliszek
0c00915c41 Enhance merge_* action plugins to allow expected relative includes
This mimics behavior of core 'template' module to allow relative
includes from the same dir as merged template, base dir of
playbook/role (usually role for us) and its 'templates' subdir.

Additionally old unused code was removed.

Change-Id: I83804d3cf5f17eb2302a2dfe49229c6277b1e25f
Signed-off-by: Radosław Piliszek <radoslaw.piliszek@gmail.com>
2019-07-10 20:52:53 +02:00
Victor Coutellier
85f7da9792 Fix action_plugins python3 compatibility
Fix filemode in the merge_configs and merge_yaml action plugin to
be compatible with python3

Change-Id: Ief64c5bdcd717141281e23c255a49ec02a96aef2
Closes-Bug: #1820134
2019-03-14 23:39:26 +01:00
confi-surya
b41309ef16 Update hacking version
Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: Ie5e5417a1d8481bb59d516a320bd7cc1dd89591e
2018-12-27 04:44:49 +00:00
caoyuan
8ee47ae3a2 Merge the merge_yaml and merge_config module into one
move the merge_yaml and merge_config module's DOCUMENTATION and
EXAMPLES into action_plugins.

Change-Id: I84c5b94afb870fc9a25838782389f7b1f8b882fd
Closes-Bug: #1799236
2018-10-31 10:13:00 +08:00
Jeffrey Zhang
1db352f007 Support check and diff mode for merge_config and merge_yaml module
Change-Id: Ib2ca736e08f48da88bb74feb5cd1efce3b860ab7
Partially-Implements: blueprint ansible-check-mode
2018-06-12 10:56:45 +08:00
Doug Szumski
d32c708290 Support parsing ini files with no sections
Services such as Zookeeper and Kafka use ini files which do not
explicitly specify sections. This change supports merging ini
files with no sections, so that the configuration for these
services follows the example configuration provided for them
as closely as possible.

Closes-Bug: #1756101
Partially-Implements: blueprint monasca-roles
Change-Id: I1061729875e5545c7af7d80779f9c2124b6c7134
2018-03-16 15:26:41 +00:00
Jeffrey Zhang
03e1b05f99 Use unified vars in task
Ansible task support vars directive, no need implement another one in
merge_config. This patch remove the vars directive in merge_config
action plugin.

Change-Id: I33648a2b6e39b4d49ce76eb66fbf2522721f8c68
2017-06-15 22:37:28 +08:00
Abel Lopez
8b90fb6d47
Change python interpreter
There is inconsistent use of either `/usr/bin/python` or
`/usr/bin/env python`. This makes for unexpected results when a
user might be using a virtualenv.

Change-Id: Ibb030f920a8869f9113ade70b66a921cc815060d
2017-02-16 13:39:36 -08:00
Jeffrey Zhang
910a50d888 Support multi key in merge_config module
Change-Id: Ibf9ee55c48a5181c5ba3aa46bef485cd3468f14c
Closes-Bug: #1647065
2017-01-04 17:06:02 +00:00
zeyu Zhu
f982d4a2ca Ansible2.0 changes: ansible_ssh_user to ansible_user
Ansible 2.0 has deprecated the 'ssh' from ansible_ssh_user to become ansible_user.

Change-Id: I15813f638accaa6a31f75dad0b854814264ac493
Closes-Bug: #1635145
2016-10-20 17:09:22 +08:00
Jeffrey Zhang
5cb0e00b77 Fix merge_configs.py file when not provide vars parameter
Use dict.pop(key, None) instead of del dict[key]. dict.pop will not
raise any error when the key is not exist.

TrivialFix

Change-Id: I3808fc865afe6936a5d93eff792e1d1a93ba2085
2016-09-26 11:22:50 +08:00
Nguyen Hung Phuong
253692630f Clean imports in code
In some part in the code we import objects. In the Openstack style
guidelines they recommend to import only modules.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I4b55cae8c2672f82025a95112b14d441d66f9d6d
2016-09-12 15:17:28 +07:00
Lu lei
46e8196fcf Use six.StringIO
In links: http://pythonhosted.org/six/, we know 'cStringIO' is
a module of python 2.x, but in python3.x module 'io' has the
same function as 'cStringIO' in python2.x. So here we use
six.stringIO instead.

TrivialFix.

Change-Id: I8022b92b186e239cd76a36dab7766301bf96d2c4
2016-08-29 12:03:15 +08:00
Jeffrey Zhang
3545e6d503 Fix the incompatibility for ansible 2.1.0
Ansible 2.1.0 has lots of change and the plugin is not compatible
between 2.0.0 and 2.1.0. This change fix the gap.

* fix the signature change for _make_tmp_path in ansible 2.1.0
* fix the common_options in the kolla_docker.py

Change-Id: I05f5f05581c8bd625cd868fa0db549d0c60a7043
Closes-Bug: #1586018
2016-05-30 23:02:09 +08:00
Jeffrey Zhang
491822c510 Bump the ansible to 2
DocImpact

Change-Id: I3cdfbf84919de80f535c030bd146787ecda40dec
partial-Implements: blueprint ansible2
2016-05-24 19:53:31 +08:00
SamYaple
4199634e98 pep8 the ansible modules
By ignoring the appropriate tests that pep8 does we can properly run
*most* of the pep8 tests on all of our modules allowing for a more
consistent coding style.

Closes-Bug: #1528431
Change-Id: I33f27a250d06d4f044267aa3ad189e092789b8df
2015-12-22 04:29:13 +00:00
SamYaple
ed82afa8e9 Simplify config creation
Convert config creation from a playbook to an action_plugin. This
reduces the complexity and confusion while retaining the same augment
structure and flexibility.

This allows us to remove the 0-byte files as requirements. They will
still be used if they are present (this means we require additional
documentation around them).

DocImpact
Closes-Bug: #1528430
Change-Id: I2c789f6be9f195c7771ca093a6d59499564b4740
2015-12-22 04:28:53 +00:00