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

Added missing gtid_port to proxysql_backend_servers module #118

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/118-add-gtid_port.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- modules/proxysql_backend_servers - Added missing gtid_port to proxysql_backend_servers module (https://github.com/ansible-collections/community.proxysql/pull/118).
Comment on lines +1 to +2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bugfixes:
- modules/proxysql_backend_servers - Added missing gtid_port to proxysql_backend_servers module (https://github.com/ansible-collections/community.proxysql/pull/118).
minor_changes:
- proxysql_backend_servers - Added missing ``gtid_port`` argument to the module (https://github.com/ansible-collections/community.proxysql/pull/118).

@thanos-k @markuman I think it should be of the minor_changes: category as it adds a new argument.

15 changes: 14 additions & 1 deletion plugins/modules/proxysql_backend_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
- The port at which the mysqld instance can be contacted.
type: int
default: 3306
gtid_port:
description:
- The backend server port where ProxySQL Binlog Reader listens on for GTID tracking
type: int
Comment on lines +34 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gtid_port:
description:
- The backend server port where ProxySQL Binlog Reader listens on for GTID tracking
type: int
gtid_port:
description:
- The backend server port where ProxySQL Binlog Reader listens on for GTID tracking
type: int
version_added: 1.5.0

It should also be mentioned in the description, that the default value is 0, even if it's not set by the ansible module.

gtid_port INT CHECK ((gtid_port <> port OR gtid_port=0) AND gtid_port >= 0 AND gtid_port <= 65535) NOT NULL DEFAULT 0,

status:
description:
- ONLINE - Backend server is fully operational.
Expand Down Expand Up @@ -150,6 +154,7 @@
"max_latency_ms": "0",
"max_replication_lag": "0",
"port": "3306",
"gtid_port": "0",
"status": "ONLINE",
"use_ssl": "0",
"weight": "1"
Expand Down Expand Up @@ -181,6 +186,12 @@ def perform_checks(module):
msg="port must be a valid unix port number (0-65535)"
)

if module.params["gtid_port"] < 0 \
or module.params["gtid_port"] > 65535:
module.fail_json(
msg="gtid_port must be a valid unix port number (0-65535)"
)

if module.params["compression"]:
if module.params["compression"] < 0 \
or module.params["compression"] > 102400:
Expand All @@ -207,7 +218,8 @@ def __init__(self, module):
self.hostname = module.params["hostname"]
self.port = module.params["port"]

config_data_keys = ["status",
config_data_keys = ["gtid_port",
"status",
"weight",
"compression",
"max_connections",
Expand Down Expand Up @@ -413,6 +425,7 @@ def main():
hostgroup_id=dict(default=0, type='int'),
hostname=dict(required=True, type='str'),
port=dict(default=3306, type='int'),
gtid_port=dict(type='int'),
status=dict(choices=['ONLINE',
'OFFLINE_SOFT',
'OFFLINE_HARD']),
Expand Down