Skip to content

Commit 153c8e6

Browse files
authored
Assorted CI fixes for scaffolded content (#233)
* assorted CI fixes for scaffoled content Signed-off-by: NilashishC <[email protected]> * fixes for ansible-project Signed-off-by: NilashishC <[email protected]> * more fixes Signed-off-by: NilashishC <[email protected]> * fix lint Signed-off-by: NilashishC <[email protected]> * more lint fixes Signed-off-by: NilashishC <[email protected]> --------- Signed-off-by: NilashishC <[email protected]>
1 parent 2f6c733 commit 153c8e6

File tree

13 files changed

+67
-20
lines changed

13 files changed

+67
-20
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ lines-between-types = 1 # Separate import/from with 1 line
342342
[tool.ruff.lint.per-file-ignores]
343343
"_version.py" = ["SIM108"]
344344
"src/ansible_creator/resources/new_collection/tests/**" = ["SLF001", "S101", "S602", "T201"]
345+
"src/ansible_creator/resources/new_collection/tests/unit/__init__.py" = ["D104"]
345346
"tests/**" = ["SLF001", "S101", "S602", "T201"]
346347

347348
[tool.ruff.lint.pydocstyle]

src/ansible_creator/resources/ansible_project/collections/requirements.yml.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ collections:
99
- name: ansible.utils
1010
version: 4.0.0
1111

12+
- name: cisco.ios
13+
1214
- name: https://github.com/redhat-cop/network.backup
1315
type: git
1416

src/ansible_creator/resources/new_collection/README.md.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
This repository contains the `{{ namespace }}.{{ collection_name }}` Ansible Collection.
44

5-
## Tested with Ansible
6-
7-
Tested with ansible-core >=2.14 releases and the current development version of ansible-core.
5+
<!--start requires_ansible-->
6+
<!--end requires_ansible-->
87

98
## External requirements
109

1110
Some modules and plugins require external libraries. Please check the requirements for each plugin or module you use in the documentation to find out which requirements are needed.
1211

1312
## Included content
1413

15-
Please check the included content on the [Ansible Galaxy page for this collection](https://galaxy.ansible.com/{{ namespace }}/{{ collection_name }}).
14+
<!--start collection content-->
15+
<!--end collection content-->
1616

1717
## Using this collection
1818

19-
```
19+
```bash
2020
ansible-galaxy collection install {{ namespace }}.{{ collection_name }}
2121
```
2222

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
collection_root: "{{ lookup ( 'env', 'MOLECULE_PROJECT_DIRECTORY' ) }}/.."
1+
collection_root: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/.."
22
integration_tests_path: "{{ collection_root }}/tests/integration/targets/"
33
molecule_scenario_name: "{{ molecule_scenario_directory | basename }}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
requires_ansible: ">=2.14.0"
2+
requires_ansible: ">=2.15.0"

src/ansible_creator/resources/new_collection/plugins/filter/hello_world.py.j2

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,39 @@
11
"""A hello-world filter plugin in {{ namespace }}.{{ collection_name }}."""
22

3-
from __future__ import absolute_import, division, print_function
3+
from __future__ import absolute_import, annotations, division, print_function
44

5-
from __future__ import annotations
65

76
__metaclass__ = type # pylint: disable=C0103
87

98
from typing import TYPE_CHECKING
109

10+
1111
if TYPE_CHECKING:
1212
from typing import Callable
1313

1414

15+
DOCUMENTATION = """
16+
name: hello_world
17+
author: {{ namespace | capitalize }} {{ collection_name | capitalize }}
18+
version_added: "1.0.0"
19+
short_description: Demo filter plugin that returns a Hello message.
20+
description:
21+
- This is a demo filter plugin designed to return Hello message.
22+
options:
23+
name:
24+
description: Value specified here is appended to the Hello message.
25+
type: str
26+
"""
27+
28+
EXAMPLES = """
29+
# hello_world filter example
30+
{% raw %}
31+
- name: Display a hello message
32+
ansible.builtin.debug:
33+
msg: "{{ 'ansible-creator' {%- endraw %} | {{ namespace }}.{{ collection_name }}.hello_world }}"
34+
"""
35+
36+
1537
def _hello_world(name: str) -> str:
1638
"""Returns Hello message.
1739

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
"""Unit tests for the collection."""

tests/fixtures/collection/testorg/testcol/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
This repository contains the `testorg.testcol` Ansible Collection.
44

5-
## Tested with Ansible
6-
7-
Tested with ansible-core >=2.14 releases and the current development version of ansible-core.
5+
<!--start requires_ansible-->
6+
<!--end requires_ansible-->
87

98
## External requirements
109

1110
Some modules and plugins require external libraries. Please check the requirements for each plugin or module you use in the documentation to find out which requirements are needed.
1211

1312
## Included content
1413

15-
Please check the included content on the [Ansible Galaxy page for this collection](https://galaxy.ansible.com/testorg/testcol).
14+
<!--start collection content-->
15+
<!--end collection content-->
1616

1717
## Using this collection
1818

19-
```
19+
```bash
2020
ansible-galaxy collection install testorg.testcol
2121
```
2222

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
collection_root: "{{ lookup ( 'env', 'MOLECULE_PROJECT_DIRECTORY' ) }}/.."
1+
collection_root: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/.."
22
integration_tests_path: "{{ collection_root }}/tests/integration/targets/"
33
molecule_scenario_name: "{{ molecule_scenario_directory | basename }}"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
requires_ansible: ">=2.14.0"
2+
requires_ansible: ">=2.15.0"

0 commit comments

Comments
 (0)