mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-27 10:40:22 -07:00
JC plugin (#750)
* initial commit * add contrib info * remove nonfunctional \n in error messate * add documentation and optional quiet and raw arguments * add changelog fragment * add aliases * add initial test * change folder name * add pip install jc for tests * simplify changelog since tests were failing * add newline to end of file * fix trailing whitespace in comment causing test failure * use pip3 since tests are failing using python2.6 pip * skip python 2.7 tests since jc only supports python 3 * use pip instead of pip3 * add python version requirement
This commit is contained in:
parent
fefc4b3423
commit
b2a222b136
6 changed files with 119 additions and 0 deletions
3
tests/integration/targets/filter_jc/aliases
Normal file
3
tests/integration/targets/filter_jc/aliases
Normal file
|
@ -0,0 +1,3 @@
|
|||
shippable/posix/group2
|
||||
skip/python2.6 # filters are controller only, and we no longer support Python 2.6 on the controller
|
||||
skip/python2.7 # jc only supports python3.x
|
12
tests/integration/targets/filter_jc/runme.sh
Executable file
12
tests/integration/targets/filter_jc/runme.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
|
||||
source virtualenv.sh
|
||||
|
||||
# Requirements have to be installed prior to running ansible-playbook
|
||||
# because plugins and requirements are loaded before the task runs
|
||||
|
||||
pip install jc
|
||||
|
||||
ANSIBLE_ROLES_PATH=../ ansible-playbook runme.yml "$@"
|
3
tests/integration/targets/filter_jc/runme.yml
Normal file
3
tests/integration/targets/filter_jc/runme.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
- hosts: localhost
|
||||
roles:
|
||||
- { role: filter_jc }
|
5
tests/integration/targets/filter_jc/tasks/main.yml
Normal file
5
tests/integration/targets/filter_jc/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: test jc key/value parser
|
||||
assert:
|
||||
that:
|
||||
- "('key1=value1\nkey2=value2' | community.general.jc('kv')) == {'key1': 'value1', 'key2': 'value2'}"
|
Loading…
Add table
Add a link
Reference in a new issue