Comments (18)
Hi,
If you have this error it means that the callback has been well called.
What is your Ansible version?
On my side:
ansible --version
ansible [core 2.13.6]
ansible python module location = /home/nico/.local/pipx/venvs/ansible/lib/python3.10/site-packages/ansible
ansible collection location = /home/nico/Documents
executable location = /home/nico/.local/bin/ansible
python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
jinja version = 3.1.2
libyaml = True
from monkeyble.
Hi,
Mine looks to be 3.4.0 with ansible-base being 2.10.17 (all "classic" Ansible, not core).
I updated it and now it seems to work. I did not manage to find any version requirements when installing Monkeyble, though, I guess I should have updated it first.
Thank you
from monkeyble.
My bad, I tested it wrong. The warning is still here, right before the output of my role.
from monkeyble.
Here is the output, as well as the content of the related files : (I see Chinese ideograms but I guess this is related to the emoji encoding)
(ansible) user-ansible@monkeyble:~$ ANSIBLE_CONFIG=ansible.cfg ansible-playbook demo_monkeyble.yml -i inventaire.ini -e @test_monkeyble.yml -e monkeyble_scenario=validate_test_1 --ask-pass
SSH password:
PLAY [Test Monkeyble] ***************************************************************************************************************************************
馃惖 Starting Monkeyble callback
monkeyble_scenario: validate_test_1
Monkeyble scenario: Monkeyble hello world
TASK [monkeymonkey : Test debug] ****************************************************************************************************************************
[WARNING]: Failure using method (v2_runner_on_start) in callback plugin (<ansible.plugins.callback.monkeyble_callback.CallbackModule object at
0x7f81e52f7a30>): 'NoneType' object is not subscriptable
ok: [localhost] => {
msg: I am a debug
}
TASK [monkeymonkey : Ping localhost] ************************************************************************************************************************
ok: [localhost]
PLAY RECAP **************************************************************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
馃惖 Monkeyble - ALL TESTS PASSED 鉁� - scenario: Monkeyble hello world
(ansible) user-ansible@monkeyble:~$ cat demo_monkeyble.yml
- name: Test Monkeyble
hosts:
- localhost
gather_facts: false
roles:
- role: monkeymonkey
(ansible) user-ansible@monkeyble:~$ cat test_monkeyble.yml
monkeyble_scenarios:
validate_test_1:
name: Monkeyble hello world
tasks_to_test:
- task: Test debug
test_input:
- assert_equal:
arg_name: msg
expected: Hello Monkeyble
(ansible) user-ansible@monkeyble:~$ cat monkeymonkey/tasks/main.yml
---
# tasks file for monkeymonkey
- name: Test debug
debug:
msg: I am a debug
- name: Ping localhost
ping:
(ansible) user-ansible@monkeyble:~$
from monkeyble.
Be sure to install the last '6' version (inferior to Ansible 7). Not tested with this one but it should be fine.
from monkeyble.
Just tried with 6.7.0, but no changes
from monkeyble.
Weird,
Could you share your ansible.cfg?
from monkeyble.
Sure, here it is :
[defaults]
library = /home/user-ansible/monkeyble/plugins/module
module_utils = /home/user-ansible/monkeyble/plugins/module_utils
callback_plugins = /home/user-ansible/monkeyble/plugins/callback
callbacks_enabled = monkeyble_callback
jinja2_native = True
/home/user-ansible/monkeyble/
is, of course, where I cloned the repo.
from monkeyble.
And ansible --version
from monkeyble.
ansible [core 2.14.1]
config file = /home/user-ansible/ansible.cfg
configured module search path = ['/home/user-ansible/monkeyble/plugins/module']
ansible python module location = /home/user-ansible/ansible/lib/python3.9/site-packages/ansible
ansible collection location = /home/user-ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /home/user-ansible/ansible/bin/ansible
python version= 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/home/user-ansible/ansible/bin/python)
jinja version = 3.1.1
libyaml = True
from monkeyble.
So you are using Ansible "7".
Could you reinstall with pip3 install ansible <7
.
And so the corresponding core version should be 2.13.
If it works it means that I need to update the tool to have Ansible 7 support🙂
from monkeyble.
I tested on my side with Ansible 7 (core 2.14.1) and it works.
from monkeyble.
I tried on a brand new VM and still got the same result.
Here are the exact steps I followed :
- Created a virtualenv named ansible
- Installed ansible with
pip install ansible
- Copied my files (only the ones I already sent here)
- Ran the playbook with the following command-line :
ansible-playbook demo_monkeyble.yml -i inventory.ini -e "@test_monkeyble.yml" -e "monkeyble_scenario=validate_test_1" --ask-pass
For testing purposes, I can provide a zip file containing all of the files inside my working folder, just in case I forgot to mention something. Would that be useful?
from monkeyble.
I misread because the first part of the error line is the same, but it appears that since the first update (this morning) the error has changed : it is now NoneType object is not subscriptable
(cf. #14 (comment))
from monkeyble.
Could you start by testing the basic hello world from the doc?
from monkeyble.
I believe I have found the problem. In the test var file, the indent between the 4 first levels (from monkeyble_scenarios
to assert_equal
) is 2 spaces per level.
In the last level, though (that is inside of assert_equal
), the indent is 4 spaces. I copied the template by hand, so I just put the same indent as the lines before.
I am quite new to Yaml, but is it common for indentation to change like this?
Thank you for the time you spent fixing this issue.
from monkeyble.
Yes an indentation error can produce the behavior you got.
Glad you found the issue.
Have fun with Monkeyble !
from monkeyble.
BTW, you should use vscode with the plugin ansible from Red Hat. It will protect you from this kind of error.
And don't forget to star the project if it helps you 😉🙏
Cya !
from monkeyble.
Related Issues (7)
- The should_failed check should preferably read should_fail instead HOT 1
- ✨Feature Request - support for generating coverage reports HOT 7
- ✨Feature Request - generate flow charts from test scenarios HOT 3
- CLI: add test name to be executed HOT 1
- CLI: add monkeyble list command HOT 1
- When task is skipped: test if it should have failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from monkeyble.