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

Unable to change monitor notifications from one to multiple #43

Open
Yabzik opened this issue Dec 4, 2023 · 2 comments
Open

Unable to change monitor notifications from one to multiple #43

Yabzik opened this issue Dec 4, 2023 · 2 comments

Comments

@Yabzik
Copy link

Yabzik commented Dec 4, 2023

Hi, first of all I would like to thank you for this collection, it has been very useful for me and has saved a huge amount of time, really appreciate your work.

While configuring my server I found a probable bug related to setting multiple notifications for monitors. The thing is that if I already have a monitor with just one notification rule enabled, then when I try to enable two or more notification rules using playbook task, the task crashes with an error. At the same time, if I manually disable this single notification rule or delete a monitor, the task enables multiple notification rules. Thus switching one -> multiple notifications does not work, but zero -> multiple, and multiple -> one works. I attach the error log below.

I will be glad to help if you need any more information or help in fixing it. Thanks!

The full traceback is:
  File "/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/monitor.py", line 578, in main
  File "/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/monitor.py", line 425, in run
  File "/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/module_utils/common.py", line 28, in object_changed
    if value[i] != value2[i]:
fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "accepted_statuscodes": [
                "200-299"
            ],
            "api_headers": null,
            "api_password": null,
            "api_ssl_verify": true,
            "api_timeout": 10.0,
            "api_token": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "api_url": "http://XXXXXX",
            "api_username": null,
            "api_wait_events": 0.2,
            "authDomain": null,
            "authMethod": null,
            "authWorkstation": null,
            "basic_auth_pass": null,
            "basic_auth_user": null,
            "body": null,
            "databaseConnectionString": null,
            "databaseQuery": null,
            "description": null,
            "dns_resolve_server": null,
            "dns_resolve_type": null,
            "docker_container": null,
            "docker_host": null,
            "expectedValue": null,
            "expiryNotification": null,
            "game": null,
            "gamedigGivenPortOnly": null,
            "grpcBody": null,
            "grpcEnableTls": null,
            "grpcMetadata": null,
            "grpcMethod": null,
            "grpcProtobuf": null,
            "grpcServiceName": null,
            "grpcUrl": null,
            "headers": null,
            "hostname": null,
            "httpBodyEncoding": null,
            "id": null,
            "ignoreTls": null,
            "interval": null,
            "invertKeyword": null,
            "jsonPath": null,
            "kafkaProducerAllowAutoTopicCreation": null,
            "kafkaProducerBrokers": null,
            "kafkaProducerMessage": null,
            "kafkaProducerSaslOptions": null,
            "kafkaProducerSsl": null,
            "kafkaProducerTopic": null,
            "keyword": null,
            "maxredirects": null,
            "maxretries": null,
            "method": null,
            "mqttPassword": null,
            "mqttSuccessMessage": null,
            "mqttTopic": null,
            "mqttUsername": null,
            "name": "Google",
            "notificationIDList": [
                8,
                9
            ],
            "oauth_auth_method": null,
            "oauth_client_id": null,
            "oauth_client_secret": null,
            "oauth_scopes": null,
            "oauth_token_url": null,
            "packetSize": null,
            "parent": 3,
            "port": null,
            "proxyId": null,
            "radiusCalledStationId": null,
            "radiusCallingStationId": null,
            "radiusPassword": null,
            "radiusSecret": null,
            "radiusUsername": null,
            "resendInterval": null,
            "retryInterval": null,
            "state": "present",
            "timeout": null,
            "tlsCa": null,
            "tlsCert": null,
            "tlsKey": null,
            "type": "http",
            "upsideDown": null,
            "url": "https://google.com"
        }
    },
    "msg": "Traceback (most recent call last):\n  File \"/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/monitor.py\", line 578, in main\n  File \"/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/modules/monitor.py\", line 425, in run\n  File \"/tmp/ansible_lucasheld.uptime_kuma.monitor_payload_zfr4xyx_/ansible_lucasheld.uptime_kuma.monitor_payload.zip/ansible_collections/lucasheld/uptime_kuma/plugins/module_utils/common.py\", line 28, in object_changed\n    if value[i] != value2[i]:\nIndexError: list index out of range\n"
}

Versions:

  • uptime-kuma-api = 1.1.0
  • lucasheld.uptime_kuma = 1.2.0
  • Uptime Kuma = 1.22.1
@obfusk
Copy link
Contributor

obfusk commented Jan 3, 2024

Looks like the same bug #38 fixes.

@gothchibjo
Copy link

Hello guys!
Is there a chance to fix the bug with the monitors' notification channel replacement?
It's definitely annoying to rebuild a monitor (and lose its stats) if I want to replace only one channel in a list of the monitor's channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants