Giter Site home page Giter Site logo

Comments (18)

Sispheor avatar Sispheor commented on August 28, 2024

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.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

DatPenguin avatar DatPenguin commented on August 28, 2024

My bad, I tested it wrong. The warning is still here, right before the output of my role.

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

Sispheor avatar Sispheor commented on August 28, 2024

Be sure to install the last '6' version (inferior to Ansible 7). Not tested with this one but it should be fine.

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024

Just tried with 6.7.0, but no changes

from monkeyble.

Sispheor avatar Sispheor commented on August 28, 2024

Weird,
Could you share your ansible.cfg?

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

Sispheor avatar Sispheor commented on August 28, 2024

And ansible --version

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024
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.

Sispheor avatar Sispheor commented on August 28, 2024

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.

Sispheor avatar Sispheor commented on August 28, 2024

I tested on my side with Ansible 7 (core 2.14.1) and it works.

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

Sispheor avatar Sispheor commented on August 28, 2024

Could you start by testing the basic hello world from the doc?

from monkeyble.

DatPenguin avatar DatPenguin commented on August 28, 2024

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.

Sispheor avatar Sispheor commented on August 28, 2024

Yes an indentation error can produce the behavior you got.
Glad you found the issue.
Have fun with Monkeyble !

from monkeyble.

Sispheor avatar Sispheor commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.