community.zabbix icon indicating copy to clipboard operation
community.zabbix copied to clipboard

zabbix_map link label escaped quote character problem

Open alvinstarr opened this issue 3 years ago • 0 comments

SUMMARY

Trying to add a " to a label as part of the dot file causes errors

ISSUE TYPE
  • Bug Report
COMPONENT NAME

zabbix_map

ANSIBLE VERSION
ansible 2.9.1
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

CONFIGURATION
CACHE_PLUGIN(/etc/ansible/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/etc/ansible/ansible.cfg) = /var/lib/ansible-fact-cache/
CACHE_PLUGIN_TIMEOUT(/etc/ansible/ansible.cfg) = 3600
DEFAULT_GATHERING(/etc/ansible/ansible.cfg) = smart

OS / ENVIRONMENT / Zabbix Version

CentOS Linux release 7.3.1611 (Core)

STEPS TO REPRODUCE
- hosts: 
    - 127.0.0.1
  become: yes
  collections:
    - community.zabbix


  vars:
    zabbix_url: http://10.0.0.55/
    zabbix_api_user: 'API'
    zabbix_api_pass: 'password'

  tasks:

  - name: Create Zabbix map
    local_action:
      module: zabbix_map
      server_url: "{{ zabbix_url }}"
      login_user: "{{ zabbix_api_user }}"
      login_password: "{{ zabbix_api_pass }}"
      name: static map
      state: present
      data: "{{ lookup('template', 'map1.j2') }}"
      default_image: Server_(64)
      expand_problem: no
      highlight: no
      label_type: label
    run_once: yes
  
digraph G {
    graph [layout=dot splines=false overlap=scale]
    INTERNET [zbx_url="Google:https://google.com" zbx_image="Cloud_(96)"]
    web01 [zbx_host="zabbix-server"]
    INTERNET -> web01 [zbx_label="this is a \"label\""]
    web01 -> db01
    { 
    db01 [zbx_host="zabbix-server"]
    }
}


EXPECTED RESULTS

The command should suceed.

ACTUAL RESULTS
 ansible-playbook -i hosts  map1.yml

PLAY [127.0.0.1] ***************************************************************

TASK [Create Zabbix map] *******************************************************
fatal: [127.0.0.1 -> localhost]: FAILED! => {"changed": false, "msg": "Failed to build graph from DOT data: 'NoneType' object has no attribute 'create_dot'"}

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

alvinstarr avatar Sep 10 '20 16:09 alvinstarr