Commit Graph

439 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov ca25191181 [doc] Document limitation and workaround for variables in mapping keys
Related-Bug: #2048036
Change-Id: Iadaab9c1d9af63bb32a2f9f6977b08fa7f643165
2024-01-04 13:45:34 +01:00
Elod Illes 04e621b5bd Fix releasenotes build
When building releasenotes (with 'tox -e releasenotes') the job fails
with the following error:

WARNING: Invalid configuration value found: 'language = None'. Update
your configuration to a valid language code. Falling back to 'en'
(English).

This caused publish-openstack-releasenotes-python3 post release job
failure as well. By removing the explicit set of language of None makes
the sphinx warning disappear.

Change-Id: I2482824f78901e14781bde49674bde4a9fd431ec
2023-11-13 16:56:52 +01:00
Zuul 4bf4d02cb2 Merge "Bump collection version in metafile" 2023-05-20 10:38:02 +00:00
Dmitriy Rabotyagov c272bc341a Revert "Publish openstack.config_template on galaxy"
This reverts commit d90989ef87.

Reason for revert: This job requires secret that can not be shared the way it is
originally supposed. So we should find other way around to publish collection to the galaxy.

Change-Id: I748bc0d2e476148c38f8305f15fd6e573eb7d008
2023-05-19 10:10:56 +00:00
Dmitriy Rabotyagov 130ecf68d5 Bump collection version in metafile
After merging dependant changes we need to release new minor version.

Depends-On: https://review.opendev.org/c/openstack/ansible-config_template/+/881668
Depends-On: https://review.opendev.org/c/openstack/ansible-config_template/+/881887
Change-Id: I049c6efc0ecf1eadeb014ead184b43e2d4609141
2023-05-18 18:11:15 +00:00
Zuul 36934a1181 Merge "Fix usage of {% raw %} tags and Jinja2 headers" 2023-05-18 18:10:56 +00:00
Zuul 8d14af7a2f Merge "Add support for start/end_string arguments" 2023-05-04 23:07:02 +00:00
niuke 2a59c043ed setup.cfg: Replace dashes with underscores
Setuptools v54.1.0 introduces a warning that the use of dash-separated
options in 'setup.cfg' will not be supported in a future version [1].
Get ahead of the issue by replacing the dashes with underscores. Without
this, we see 'UserWarning' messages like the following on new enough
versions of setuptools:

  UserWarning: Usage of dash-separated 'description-file' will not be
  supported in future versions. Please use the underscore name
  'description_file' instead

[1] https://github.com/pypa/setuptools/commit/a2e9ae4cb

Change-Id: I74130dab437c7ec7333d19bf2efc6f9b6095a0ff
2023-05-04 09:22:37 +08:00
Dmitriy Rabotyagov e528ed0e9e Fix usage of {% raw %} tags and Jinja2 headers
At the moment we do resolve template 2 times for some historical reasons

This leads to {% raw %} tag as well as any other content be not respected
on the second renderring, since after the first one these tags
are gone, so no escaping or whatsoever work.

At the same time there're no obvious reasons to render second time,
since all override content is being renderred already. So there should
not be anything left that indeed needs this second run.

Change-Id: I414b1b3b4e426316707dda23b9aeff6b6f4f7c2f
Closes-Bug: #1649381
2023-05-01 11:17:53 +02:00
Dmitriy Rabotyagov fdb572d0ba Add support for start/end_string arguments
In case template contains some Jinja content that we don't want to
resolve, there're not much options due to the bug, that ignores
{% raw %} tags. The other way to work it around is to override tags that
Jinja will use to detect the content it needs to render. This way
content that should be renderred can be placed in the same template
with the one that needs to stay intact.

Change-Id: I4d28f5ab03858f5555f5e9e555da1dddc0f2b016
Related-Bug: #1649381
2023-04-29 02:54:36 +00:00
Takashi Kajinami 795122864b Remove TripleO jobs
We are tearing down TripleO master because of project removal.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-openstack_hosts/+/877665
Change-Id: I7b64e77a9a2939971cca965a8837ce0471bdac61
2023-03-16 14:46:46 +00:00
Takashi Kajinami 26a8d94352 Replace deprecated whitelist_externals
This option was deprecated in favor of the allowlist_externals option
and does no longer work in recent tox.

Change-Id: I1cbf545c382fdb4dda837699392e59061ccf8f75
2023-03-16 11:09:29 +09:00
Zuul b5e0cb2331 Merge "remove unicode prefix from code" 2022-10-12 13:27:58 +00:00
Marcus Klein 2ccc59fa13 document the removal of keys in ini files
which requires an empty dictionary in playbook YAML config_overrides
parameter

Change-Id: I3ab9c434883e743738b3e06d54c3c54c84bc7217
2022-09-28 15:18:41 +02:00
niuke e8a66da627 remove unicode prefix from code
Change-Id: I867dd90aba8f504137dee53b9ce4f025b75ff6de
2022-08-24 19:41:07 +08:00
Zuul dae35c0bc3 Merge "Publish openstack.config_template on galaxy" 2022-07-12 10:08:38 +00:00
Dmitriy Rabotyagov 29ddca2734 Update documentation about installation methods
config_template historically was published on PyPi during times before
collections were a thing. This was one of the installations methods
that is not relevant or preffered since collections are here.

That patch aims to update documentation about ways of plugin
installation as well as adding deprecation notice of PyPi.

In the futher releases we will drop publishing on PyPi.

Change-Id: Ie1cd7b305b4d82fd0fbf4568ef20ff3d0236c049
2022-06-23 12:16:24 +02:00
Dmitriy Rabotyagov d90989ef87 Publish openstack.config_template on galaxy
We try to re-use ansible-colelctions-openstack CI job [1] for
publishing config_template collection.

[1] 86b573883a/.zuul.yaml (L352-L373)

Change-Id: Ib0ba55190864bbb5544ae4ef58aea588d9f53d24
2022-06-20 19:10:52 +00:00
Zuul c24b5ad83d Merge "Add blank lines between functions and classes" 2022-06-20 16:25:58 +00:00
Zuul 15c29209f0 Merge "Add more complete examples with sample output" 2022-06-20 14:09:18 +00:00
Jesse Pretorius (odyssey4me) 17330e7558 Add more complete examples with sample output
The existing examples from code are not sufficient to explain
how the various features of the module can be used. This patch
hopes to add more practical examples to show some of the
features.

Hopefully this also sets a trend so that more examples are added
in the future.

Change-Id: I035ce06a2391904724aaf8b0a724d7b4fa8e27f0
2022-06-20 13:32:29 +01:00
Dmitriy Rabotyagov 3a4320c2e6 Add blank lines between functions and classes
Change-Id: Id178c7e7311f8e1e9950c94d2ab4fa46c396d6d0
2022-06-17 16:54:49 +02:00
Dmitriy Rabotyagov a17a949e99 Release config-template to 1.3.0
We have merged bunch of changes to the collection, so worth releasing it
now.

Change-Id: Icb839e648388ab4f12679e40f554a12d3461497d
2022-06-15 11:00:44 +00:00
Dmitriy Rabotyagov 3222aeda8f Use ensure SafeDumper used yaml configs
With ansible 2.12 they started using CSafeDumper instead of
SafeDumper which ignores indent in yaml files.
To preserver behaviour and config formats we fallback to original
behaviour with indenting.
For that we adjust parenting of AnsibleDumper and adding SafeDumper
when it's not present there.

[1] bfd93c835a/lib/ansible/module_utils/common/yaml.py (L30)

Change-Id: Iadddef84eae31fab9478ad02220ae49d1c91fa4c
2022-06-15 10:59:42 +00:00
Jesse Pretorius (odyssey4me) ed68c9d67d Remove orphaned releasenotes
These releasenotes appear to be originally from
https://opendev.org/openstack/openstack-ansible-plugins
and do not pertain to anything in the config_template
module.

Change-Id: I23f0395d52e2c639dc987b37e0f251b8f3ea418b
2022-06-13 17:51:48 +01:00
Dmitriy Rabotyagov 78e7f22caa Replace include for newer ansible version
In order to pass functional tests on newer ansible we need to replace
dropped inlcude with proper import_playbook module.

Change-Id: I2bf9ca6003b66d5f7b8be9d7b54e12cb9b56f3c6
2022-04-15 11:54:45 +02:00
Zuul 5070371edd Merge "Remove python2.7 workaround" 2022-04-11 15:35:35 +00:00
OpenStack Proposal Bot 743cb18d9b Updated from OpenStack Ansible Tests
Change-Id: I3580edf2ea3c49b8d81c25d964cea1f7571f57f6
2022-04-04 15:12:10 +00:00
Jonathan Rosser 20e1ba08b9 Remove python2.7 workaround
Change-Id: I077f793d3102fa5ff3e90cb16c1d7a560e36bf8c
2022-04-04 12:55:10 +00:00
Jonathan Rosser 8ca0706565 Set py_modules to an empty list in setup.py
This prevents setuptools 61.0.0 doing autodiscovery and failing
as this is an ansible role, not a python module.

Change-Id: I5ef8a23aed6193bc61e52f0b069a835d229597d5
2022-04-04 12:53:47 +00:00
Bhagyashri Shewale bd7543a736 Move zuul jobs layout to centos9 only for master branch
See topic branch [1] for related reviews.

[1] https://review.opendev.org/q/topic:c8_teardown_master
Depends-On: https://review.opendev.org/c/openstack/tripleo-ci/+/829236

Change-Id: Iaea2b36f0de339067c07c9d02e7d39d7f220248b
2022-02-15 13:38:47 +00:00
Dmitriy Rabotyagov 461379169d Copy refactor of code quality issues
The following commit copy implemented by ceph-ansible [1] code quality
issues detected by DeepSource:
- Use literals instead of function calls to create data structure.
- Refactor useless else block in the loop.

[1] a0bc5afe26 (diff-ee824655f36c314a50f7dfe3f4c5ed7b41d4168ce17ec243139c6913192c6d66)

Change-Id: Ied7219f215cbbd7c2eb131234d59992a68f59e81
2022-01-13 18:05:00 +02:00
OpenStack Proposal Bot 2aee98fc28 Updated from OpenStack Ansible Tests
Change-Id: I90dd0406976fe62c67cb9d02b08aa9dce03deb0c
2021-12-17 16:50:07 +00:00
Dmitriy Rabotyagov 7422a0941b Move config_template to plugins/action
Unlike to the modules, ansible-galaxy tool does not respect symlinks,
which results in collection brokeness after it installation as plugin
itself is just missing there.
In the meanwhile, symlinks are respected by regular git clone which
is used for regular module retrievment.

Change-Id: I747b217e6b0706c05e5fae98bc5b89be3cbb5930
2021-11-23 20:37:39 +02:00
Dmitriy Rabotyagov 87410f1de2 Fix repository URL in galaxy.yml
Change-Id: I8d82a93e752baf7fe1392b6f2f9c769b7685d0b3
2021-11-12 11:15:07 +02:00
Dmitriy Rabotyagov bb1d445a08 Add option to install as collection
We create symlink and galaxy.yml file so that this module
could be installed as an ansible collection in addition
to already used methods.

Change-Id: I2f49028fbea09a2f38b54544ae96dee9d0156f6f
2021-10-21 08:51:34 +00:00
Jonathan Rosser 8a9b9622d5 Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: If4aa4ee0d63a046635f7236cf35aa6125133adab
2021-06-12 19:47:05 +00:00
Dmitriy Rabotyagov 331d8932aa Add PKI role to functional testing
Change-Id: I5b1f1fcaef6cab54b3ad4ba3c31afeccf66f97d3
2021-06-12 22:46:36 +03:00
Zuul 57efa55efb Merge "Remove references to unsupported operating systems" 2021-05-17 19:00:40 +00:00
Zuul 59a80f9a44 Merge "Updated from OpenStack Ansible Tests" 2021-04-19 19:26:03 +00:00
Jonathan Rosser cf28065134 Remove references to unsupported operating systems
All references to Gentoo, SUSE, Debian stretch and Centos-7  are removed.
Conditional tasks, ternary operators and variables are simplified where possible
OS specific variables files are generalised where possible

Change-Id: I705b1ea8907a12d30a05a7b3ebbbfb7a8a021325
2021-03-30 15:07:10 +00:00
Jonathan Rosser 62812dedc0 Run tests against localhost and container
Use localhost and container1 as proper targets for the test playbook
rather than a combination of import_tasks/delegate_to for container1.

The previous code did not run the imported tasks against container1,
but instead a second time against localhost. This makes the handlers
checking the output from ansible diff fail as on the second run
against localhost there are no changes, giving an empty diff.

Changing the test play targets to localhost:container1 makes it more
obvious that the whole test playbook should be run against the host
and the container. It is not clear from the old code if the original
intent was to specifically test config_template tasks delegated from
the host to a container.

Change-Id: Ibc72868d9957567fe86a9d3205a80ec33441baff
2021-03-29 15:39:59 +01:00
OpenStack Proposal Bot 53d5f40e93 Updated from OpenStack Ansible Tests
Change-Id: I5bc89c4dd29d30b0e0f516d6b75ddfcd86759e7f
2021-03-22 08:53:10 +00:00
OpenStack Proposal Bot a6347c3811 Updated from OpenStack Ansible Tests
Change-Id: I7f0d68dd4ca0b8ac41f6b52ea742f14eab78780b
2020-09-24 16:59:45 +00:00
Dmitriy Rabotyagov ea07ed008f Fix section overrides when commented option persist
In cases, when key already exist, but commented out without space
(ie "#key) and is not in default section, it's not updated with
sectdict.insert statement. That is possible happens because
self._sections keys are protected and can't be overwritten (at least
new assignment makes no difference)

Change-Id: Ie0c588a2d559bd38c68b3d018e547a036d83214c
Closes-Bug: #1889547
2020-07-30 20:18:07 +03:00
Kevin Carter 4ed672e399 Update config_template to use the builtin _get_remote_user function
This change will ensure the config_template module is able to pull the appropriate
remote use when creating a temp file or directory.

Related-Bug: #1884816
Change-Id: I36b13db4d0b722e7c6c7244ab142003193a56ffe
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2020-06-29 13:05:57 +00:00
Zuul 51356b811c Merge "Stop to use the __future__ module." 2020-06-24 12:31:28 +00:00
Dmitriy Rabotyagov 4e6d993457 Make code compatible with older ansible versions
Change-Id: I42b04b5a70aeba0eba0ca9444079cddc0a95e2ae
2020-06-18 12:14:15 +03:00
Jonathan Rosser 802cafb7fd Modernise tox.ini and run OSA metal jobs in CI
There was no coverage of an actual OSA deployment in CI, so we
add this. Also remove the legacy python3 functional test
and move all tox environments to be python3.

Change-Id: I36cee01b9a14adf1840d35c3a8934de8a994f399
2020-06-16 12:07:52 +01:00
Dmitriy Rabotyagov 170e46b44d Templar: use available_variables
This aims to resolve deprecation warning: set_available_variables is
being deprecated. Use "@available_variables.setter" instead

Change-Id: I95191ad596656051bd6a2ba8dd720823ea3434ec
2020-06-13 01:00:24 +03:00