Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] TypeError: 'str' object is not callable #91

Closed
ninhpham0902 opened this issue Nov 7, 2021 · 7 comments
Closed

[Bug report] TypeError: 'str' object is not callable #91

ninhpham0902 opened this issue Nov 7, 2021 · 7 comments
Labels

Comments

@ninhpham0902
Copy link

Describe the bug
When you run the ansible-playbook-grapher some_playbook.yml and the command return a TypeError

To Reproduce
ansible-playbook-grapher some_playbook.yml

Expected behavior
Generate svg file for the playbook

Screenshots
image

Versions:
Outputs of :

  • ansible --version

image

  • ansible-playbook-grapher --version
    ansible-playbook-grapher 0.11.1 (with ansible 2.11.6)
    Additional context
    Using Ubuntu 20.04 LTS WSL
@ninhpham0902
Copy link
Author

ninhpham0902 commented Nov 7, 2021

Content of the yml

- name: Validate Time Sync
  hosts: tag_os_windows:!tag_Role_AD
  ignore_errors: True
  vars_files:
    - vars/tenant.yml
  vars:
    ansible_connection: winrm
    ansible_winrm_server_cert_validation: ignore
  tasks:
    - name: Check w32tm status
      win_shell: (Get-Service w32Time).Status
      register: w32tm_status

    - name: Check time sync block
      block:
        - name: Check time sync
          win_shell: (w32tm /query /status )[7].trimStart('Source:').Trim().substring(5)
          register: timeSource
        
        - name: Get Domain
          win_shell: (wmic computersystem get domain)[2].Trim()
          register: getDomain

        - name: Time Sync Result
          set_fact: 
            time_sync_status_vm: "{% if timeSource.stdout == getDomain.stdout %}Success{% else %}Failed{% endif %}"
      when: w32tm_status.stdout_lines[0] == 'Running'

    - name: Save hostname when VM Time Sync check failed
      set_fact:
        temp_host: "{{ hostvars[inventory_hostname].tags.Name }}"
      when: time_sync_status_vm == 'Failed' or w32tm_status.stdout_lines[0] != 'Running'  

    - name: Save hostname when VM Time Sync check success
      set_fact:
        temp_host: null
      when: time_sync_status_vm == 'Success'

@haidaraM
Copy link
Owner

haidaraM commented Nov 7, 2021

Hi. Can you try with the latest version on main: pip install ansible-playbook-grapher==1.0.0.dev3 ? I have made several changes that will be released in the next major version

@haidaraM haidaraM added the bug label Nov 7, 2021
@ninhpham0902
Copy link
Author

This is what I got after the update
image

@haidaraM
Copy link
Owner

haidaraM commented Nov 7, 2021

I suspect a bug with graphviz. My tests in CI are failing with the same messages: https://github.com/haidaraM/ansible-playbook-grapher/runs/4131881442?check_suite_focus=true

Can you send me a pip freeze ?

@ninhpham0902
Copy link
Author

Here it is:

ansible==4.8.0
ansible-core==2.11.6
ansible-playbook-grapher==1.0.0.dev3
attrs==19.3.0
Automat==0.8.0
blinker==1.4
certifi==2019.11.28
chardet==3.0.4
Click==7.0
cloud-init==21.2
colorama==0.4.3
colour==0.1.5
command-not-found==0.3
configobj==5.0.6
constantly==15.1.0
cryptography==2.8
dbus-python==1.2.16
distro==1.4.0
distro-info===0.23ubuntu1
entrypoints==0.3
graphviz==0.18
httplib2==0.14.0
hyperlink==19.0.0
idna==2.8
importlib-metadata==1.5.0
incremental==16.10.1
Jinja2==2.10.1
jsonpatch==1.22
jsonpointer==2.0
jsonschema==3.2.0
keyring==18.0.1
language-selector==0.1
launchpadlib==1.10.13
lazr.restfulclient==0.14.2
lazr.uri==1.0.3
lxml==4.6.4
MarkupSafe==1.1.0
more-itertools==4.2.0
netifaces==0.10.4
oauthlib==3.1.0
packaging==21.2
pexpect==4.6.0
pyasn1==0.4.2
pyasn1-modules==0.2.1
PyGObject==3.36.0
PyHamcrest==1.9.0
PyJWT==1.7.1
pymacaroons==0.13.0
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyparsing==2.4.7
pyrsistent==0.15.5
pyserial==3.4
python-apt==2.0.0+ubuntu0.20.4.5
python-debian===0.1.36ubuntu1
PyYAML==5.3.1
requests==2.22.0
requests-unixsocket==0.2.0
resolvelib==0.5.4
SecretStorage==2.3.1
service-identity==18.1.0
simplejson==3.16.0
six==1.14.0
sos==4.1
ssh-import-id==5.10
systemd-python==234
Twisted==18.9.0
ubuntu-advantage-tools==27.2
ufw==0.36
unattended-upgrades==0.1
urllib3==1.25.8
wadllib==1.3.3
zipp==1.0.0
zope.interface==4.7.1

@haidaraM
Copy link
Owner

haidaraM commented Nov 7, 2021

Perfect thanks!. Your example is working on my local computer.

The issue is with the latest version of graphviz. It should work with an older version of graphiz. Try this: pip install graphviz==0.17.

I will check later graphviz CHANGELOG to see what changed in 0.18

@haidaraM
Copy link
Owner

haidaraM commented Nov 7, 2021

Released two versions: 1.0.0.dev4 and 0.11.2 with the fix.

@haidaraM haidaraM closed this as completed Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants