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

API configuration.import behavior changed in 5.4 #412

Closed
Tracked by #392
D3DeFi opened this issue Jun 28, 2021 · 3 comments
Closed
Tracked by #392

API configuration.import behavior changed in 5.4 #412

D3DeFi opened this issue Jun 28, 2021 · 3 comments
Labels
bug Something isn't working module The issue or pull request is related to Zabbix module

Comments

@D3DeFi
Copy link
Contributor

D3DeFi commented Jun 28, 2021

Seems that Zabbix 5.4 has made something different as our CI is failing even after implementing #407.

Also read #407 (comment)

Referenced template is https://github.com/ansible-collections/community.zabbix/blob/main/tests/integration/targets/test_zabbix_template/files/template1_52_higher.json

Now this is very interesting. If I FIRST upload template manually via Import button in Zabbix GUI and then try to print template diff I get:

[]

Buut, if I run ansible-test integration test_zabbix_template and then try to print template diff:

{
  "templates": {
    "added": [
      {
        "after": {
          "template": "ExampleHost",
          "name": "ExampleHost",
          "macros": [
            {
              "macro": "{$EXAMPLE_MACRO1}",
              "value": "1000"
            },
            {
              "macro": "{$EXAMPLE_MACRO2}",
              "value": "text"
            }
          ],
          "templates": [
            {
              "name": "FTP Service"
            },
            {
              "name": "Zabbix Proxy"
            }
          ],
          "uuid": "c1a80829556941e4a1ff307b39130b5a"
        }
      }
    ]
  }
}

This is my current test script:

import json

zbx = ZabbixAPI('http://localhost:8080')
zbx.login('Admin', 'zabbix')


update_rules = {
    'discoveryRules': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'graphs': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'groups': {
        'createMissing': True
    },
    'httptests': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'items': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'templates': {
        'createMissing': True,
        'updateExisting': True
    },
    'templateLinkage': {
        'createMissing': True,
        'deleteMissing': True
    },
    'templateDashboards': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'triggers': {
        'createMissing': True,
        'updateExisting': True,
        'deleteMissing': True
    },
    'valueMaps': {
        'createMissing': True,
        'updateExisting': True
    }
}

with open('tests/integration/targets/test_zabbix_template/files/template1_52_higher.json', 'r') as f:
    source_json = json.load(f)

x = zbx.configuration.importcompare(dict(format='json', source=json.dumps(source_json), rules=update_rules))
print(json.dumps(x, indent=2))

zbx.logout()

Now I am lost :)

Originally posted by @D3DeFi in #407 (comment)

@D3DeFi D3DeFi added bug Something isn't working module The issue or pull request is related to Zabbix module labels Jun 28, 2021
@D3DeFi
Copy link
Contributor Author

D3DeFi commented Sep 12, 2021

Oh my, they have switched from using IDs to UUIDs! See #451

@pyrodie18
Copy link
Collaborator

@D3DeFi I am assuming that this is no longer an issue?

@D3DeFi
Copy link
Contributor Author

D3DeFi commented Sep 6, 2022

Honestly I have no idea. But CI for zabbix_template is no longer failing and we are preparing to drop 5.4 as well, so lets ignore this and whoever finds this and disagrees can reopen :)

@D3DeFi D3DeFi closed this as completed Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working module The issue or pull request is related to Zabbix module
Projects
None yet
Development

No branches or pull requests

3 participants