Skip to content

Commit 140e88a

Browse files
committed
[Path] Remove deprecated "default_file", "default_link" and "default_directory" filters
1 parent 428fa56 commit 140e88a

9 files changed

Lines changed: 109 additions & 168 deletions

File tree

.github/workflows/_lint.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
debug:
7+
type: boolean
8+
required: false
9+
default: false
10+
collection:
11+
type: string
12+
required: true
13+
14+
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-24.04
18+
steps:
19+
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
23+
- name: Set up system
24+
uses: ./.manala/github/system/setup
25+
26+
- name: Lint
27+
uses: ./.manala/github/system/run
28+
with:
29+
run: |
30+
whoami
31+
pwd
32+
ls -lsa
33+
34+
- name: Debug
35+
uses: mxschmitt/action-tmate@v3
36+
if: ${{ inputs.debug && always() }}
37+
timeout-minutes: 15

.github/workflows/_test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
debug:
7+
type: boolean
8+
required: false
9+
default: false
10+
collection:
11+
type: string
12+
required: true
13+
14+
jobs:
15+
test:
16+
name: Test
17+
runs-on: ubuntu-24.04
18+
steps:
19+
20+
- name: Checkout
21+
uses: actions/checkout@v6
22+
23+
- name: Set up system
24+
uses: ./.manala/github/system/setup
25+
26+
- name: Test
27+
uses: ./.manala/github/system/run
28+
with:
29+
run: |
30+
whoami
31+
pwd
32+
ls -lsa
33+
34+
- name: Debug
35+
uses: mxschmitt/action-tmate@v3
36+
if: ${{ inputs.debug && always() }}
37+
timeout-minutes: 15

.github/workflows/path.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Path
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .manala.yaml
7+
- .github/workflows/_lint.yaml
8+
- .github/workflows/_test.yaml
9+
- .github/workflows/path.yaml
10+
- path/**
11+
workflow_dispatch:
12+
inputs:
13+
debug:
14+
type: boolean
15+
description: Run with tmate debugging
16+
required: false
17+
default: false
18+
19+
jobs:
20+
path_lint:
21+
name: Path - Lint
22+
uses: ./.github/workflows/_lint.yaml
23+
with:
24+
debug: ${{ inputs.debug == true }}
25+
collection: path
26+
path_test:
27+
name: Path - Test
28+
uses: ./.github/workflows/_test.yaml
29+
with:
30+
debug: ${{ inputs.debug == true }}
31+
collection: path

path/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
12+
- Remove deprecated "default_file", "default_link" and "default_directory" filters
13+
1014
## [1.9.0] - 2025-12-12
1115

1216
### Added

path/meta/runtime.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
11
---
22

33
requires_ansible: '>=2.16.0'
4-
5-
plugin_routing:
6-
filter:
7-
default_file:
8-
deprecation:
9-
removal_version: 2.0.0
10-
warning_text: Use "default" filter with state='file' instead.
11-
default_link:
12-
deprecation:
13-
removal_version: 2.0.0
14-
warning_text: Use "default" filter with state='link' instead.
15-
default_directory:
16-
deprecation:
17-
removal_version: 2.0.0
18-
warning_text: Use "default" filter with state='directory' instead.

path/plugins/filter/default.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -34,64 +34,10 @@ def _do_default(path, *default_paths, state=None):
3434
return result
3535

3636

37-
def _default_file(paths, *default_paths):
38-
if isinstance(paths, list):
39-
return [_do_default_file(path, *default_paths) for path in paths]
40-
41-
return _do_default_file(paths, *default_paths)
42-
43-
44-
def _do_default_file(path, *default_paths):
45-
if not isinstance(path, dict):
46-
raise AnsibleTemplateError(f"default_file input expects a dict but was given a {type(path).__name__}")
47-
48-
if _test_file(path):
49-
return _default(path, *default_paths)
50-
51-
return path
52-
53-
54-
def _default_link(paths, *default_paths):
55-
if isinstance(paths, list):
56-
return [_do_default_link(path, *default_paths) for path in paths]
57-
58-
return _do_default_link(paths, *default_paths)
59-
60-
61-
def _do_default_link(path, *default_paths):
62-
if not isinstance(path, dict):
63-
raise AnsibleTemplateError(f"default_link input expects a dict but was given a {type(path).__name__}")
64-
65-
if _test_link(path):
66-
return _default(path, *default_paths)
67-
68-
return path
69-
70-
71-
def _default_directory(paths, *default_paths):
72-
if isinstance(paths, list):
73-
return [_do_default_directory(path, *default_paths) for path in paths]
74-
75-
return _do_default_directory(paths, *default_paths)
76-
77-
78-
def _do_default_directory(path, *default_paths):
79-
if not isinstance(path, dict):
80-
raise AnsibleTemplateError(f"default_directory input expects a dict but was given a {type(path).__name__}")
81-
82-
if _test_directory(path):
83-
return _default(path, *default_paths)
84-
85-
return path
86-
87-
8837
class FilterModule(object):
8938
""" Manala path default jinja2 filters """
9039

9140
def filters(self):
9241
return {
9342
'default': _default,
94-
'default_file': _default_file,
95-
'default_link': _default_link,
96-
'default_directory': _default_directory,
9743
}

path/plugins/filter/default_directory.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

path/plugins/filter/default_file.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

path/plugins/filter/default_link.yaml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)