This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solve deprecation warnings for using apt with items
- Loading branch information
1 parent
eaa169d
commit 778f577
Showing
2 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from ansible import errors | ||
from ansible.module_utils._text import to_text | ||
|
||
def prefix(value, prefix): | ||
''' | ||
Prefix each item in a list with a prefix | ||
''' | ||
|
||
try: | ||
return prefix + value | ||
except TypeError: | ||
raise errors.AnsibleFilterError('This filter only works on a string, offending value: ' + to_text(value)) | ||
|
||
|
||
class FilterModule(object): | ||
''' | ||
Custom jinja2 filter to prefix a string | ||
''' | ||
|
||
def filters(self): | ||
return { | ||
'prefix': prefix, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters