Git Product home page Git Product logo

Comments (13)

haidaraM avatar haidaraM commented on September 15, 2024 1

Released in 1.0.1

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Thanks for reporting the issue. I reproduced it locally. I will make a release soon

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Can you test with the latest dev release: pip install ansible-playbook-grapher==1.0.1.dev0 ?

from ansible-playbook-grapher.

netopsengineer avatar netopsengineer commented on September 15, 2024

@haidaraM sure!

I get the following on 1.0.1.dev0, I tried two different playbooks that are both setup very similar in regards to the pre_tasks, both result in same exception. Let me know what else you would like me to test, would love to help straighten it out.

ansible-playbook-grapher nist_dsr_link_launch.yml -i inventory/hosts --vault-password-file $VAULT --include-role-tasks -e '@dsr_play_args.yml' --view
[WARNING]: ansible.utils.display.initialize_locale has not been called, this may result in incorrectly calculated text widths that can cause Display to print incorrect line lengths

Parsing Play: all (805) ********************************************************************************************************************************************************************************


Done parsing Play: all (805) ***************************************************************************************************************************************************************************


Parsing Play: all (805) ********************************************************************************************************************************************************************************
Traceback (most recent call last):
  File "/Users/myUserName/.pyenv/versions/venvGraphAnsible/bin/ansible-playbook-grapher", line 8, in <module>
    sys.exit(main())
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/cli.py", line 126, in main
    cli.run()
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/cli.py", line 43, in run
    playbook_node = parser.parse()
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/parser.py", line 154, in parse
    self._include_tasks_in_blocks(current_play=play, parent_nodes=[play_node], block=pre_task_block,
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/parser.py", line 284, in _include_tasks_in_blocks
    self._include_tasks_in_blocks(current_play=current_play, parent_nodes=parent_nodes, block=b,
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/parser.py", line 230, in _include_tasks_in_blocks
    self._include_tasks_in_blocks(current_play=current_play, parent_nodes=parent_nodes, block=task_or_block,
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/parser.py", line 308, in _include_tasks_in_blocks
    self._add_task(task=task_or_block, task_vars=play_vars, node_type=node_type,
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/parser.py", line 86, in _add_task
    parent_node.add_node(target_composition=f"{node_type}s", node=edge_node)
  File "/Users/myUserName/.pyenv/versions/3.10.0/envs/venvGraphAnsible/lib/python3.10/site-packages/ansibleplaybookgrapher/graph.py", line 58, in add_node
    raise Exception(
Exception: The target composition 'pre_tasks' is unknown. Supported are: ['tasks']

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Can you send me a minimal example that is failing and the output of ansible-playbook-grapher --version?

from ansible-playbook-grapher.

netopsengineer avatar netopsengineer commented on September 15, 2024

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Yes, there is a more verbose mode: ansible-playbook-grapher -vvvv .... Can you send me the output with this flag ?

Are you using some includes or imports inside your pre_tasks ?

from ansible-playbook-grapher.

netopsengineer avatar netopsengineer commented on September 15, 2024

The verbose mode helped track it down further!

When I comment out the pre_tasks the tool does run with no exceptions, but gives me this error, and the resulting graph line headings and identifiers are all misaligned.

[WARNING]: ansible.utils.display.initialize_locale has not been called, this may result in incorrectly
calculated text widths that can cause Display to print incorrect line lengths

I am using includes and imports in pre_tasks, and that appears to be where it fails, it hits my pre_tasks, which does an include of analyze, inside analyze, the main.yml does import of 3 task files from the analyze role, and it fails when it hits that first task file, which also has a block.

Here is the exception and setup when pre_tasks is in the play:

Parsing Play: all (805) *********************************************************************************
Parsing pre_tasks...
Adding pre_task 'Verify Vars Needed For This Playbook At Initial Launch Are Present.' to the graph
Adding pre_task 'Verify Reachability and Authentication, Or FAIL The Host.' to the graph
Adding pre_task 'pre_task_work : Assert The User Provided Email Address Was Formatted Correctly As A List Or Fail The Host.' to the graph
Adding pre_task 'pre_task_work : Assert The User Provided Email Addresses Do Not Contain White Space And Are Addressed To @.com Domains Only Or Fail The Host.' to the graph
Adding pre_task 'pre_task_work : Set Fact Containing The User Provided Email List Plus default address WHEN: user_email_list > 0, ELSE Skipped.' to the graph
Adding pre_task 'pre_task_work : Set Fact Containing The default address Email WHEN: user_email_list == 0, ELSE Skipped.' to the graph
An 'include_role' found. Including tasks from the role 'analyze'
statically imported: myProjectDir/roles/analyze/tasks/analyze_cpm_filter_status.yml
Loading collection ansible.utils from myProjectDir/collections/ansible_collections/ansible/utils
statically imported: myProjectDir/roles/analyze/tasks/analyze_ip_filter_action.yml
statically imported: myProjectDir/roles/analyze/tasks/analyze_ipv6_filter_action.yml
Adding pre_task 'analyze : Gather Current Configured CPM State.' to the graph
Traceback (most recent call last):
  File "/Users/myUserName/.pyenv/versions/venvGraphAnsible/bin/ansible-playbook-grapher", line 8, in <module>
    sys.exit(main())

role/tasks/analyze/main.yml

- name: 'Include Validate CPM filter State.'
  ansible.builtin.import_tasks: analyze_cpm_filter_status.yml

- name: 'Include: Validate IP Filters And Associated Actions.'
  ansible.builtin.import_tasks: analyze_ip_filter_action.yml
  when:
    - inventory_hostname not in groups['mtso']

- name: 'Include: Validate IPv6 Filters And Associated Actions.'
  ansible.builtin.import_tasks: analyze_ipv6_filter_action.yml
  when:
    - inventory_hostname in groups['mgmtspe']

analyze_cpm_filter_status.yml

- name: 'Analyzing CPM Filter State(s).'
  block:
    - name: 'Gather Current Configured CPM State.'
      ansible.netcommon.cli_command:
        command: show system security cpm-filter ip-filter
      connection: ansible.netcommon.network_cli
      register: nokia_show_system_security_cpmfilter_ipfilter

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Can you try the latest version on the branch fix/blocks with pip install git+https://github.com/haidaraM/ansible-playbook-grapher@fix/blocks?

The warning on display should have no impact on the generated graph. Can you share a screenshot with the misaligned headlings ?

from ansible-playbook-grapher.

netopsengineer avatar netopsengineer commented on September 15, 2024

Same result with the new pip installed library version from Git, do you have an email address I can send the screenshots to? I would prefer not to have some of the content out in the open.

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Hmm there should be another case I'm not testing at the moment... Can you just uninstall and start from scratch with the latest version on the branch ? Just to be sure

My email: [email protected]

from ansible-playbook-grapher.

netopsengineer avatar netopsengineer commented on September 15, 2024

Emailed you @haidaraM

from ansible-playbook-grapher.

haidaraM avatar haidaraM commented on September 15, 2024

Just saw your mail and replied to it. So a complete reinstall fixed the main issue. For the rendering issue with big playbooks and large number of tasks, I will create another issue.

from ansible-playbook-grapher.

Related Issues (20)

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.