mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-04-08 11:40:33 -07:00
add mysql_full_version and suffix return variable
add changelog fragment
This commit is contained in:
parent
bd86e249d0
commit
61c652da3b
3 changed files with 36 additions and 6 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- mysql_info - add mysql_full_version and suffix return variable (https://github.com/ansible-collections/community.mysql/issues/114)
|
|
@ -57,6 +57,7 @@ seealso:
|
||||||
|
|
||||||
author:
|
author:
|
||||||
- Andrew Klychkov (@Andersson007)
|
- Andrew Klychkov (@Andersson007)
|
||||||
|
- Sebastian Gumprich (@rndmh3ro)
|
||||||
|
|
||||||
extends_documentation_fragment:
|
extends_documentation_fragment:
|
||||||
- community.mysql.mysql
|
- community.mysql.mysql
|
||||||
|
@ -121,7 +122,7 @@ version:
|
||||||
description: Database server version.
|
description: Database server version.
|
||||||
returned: if not excluded by filter
|
returned: if not excluded by filter
|
||||||
type: dict
|
type: dict
|
||||||
sample: { "version": { "major": 5, "minor": 5, "release": 60 } }
|
sample: { "version": { "major": 5, "minor": 5, "release": 60, "suffix": "MariaDB", "full_version": "5.5.60-MariaDB" } }
|
||||||
contains:
|
contains:
|
||||||
major:
|
major:
|
||||||
description: Major server version.
|
description: Major server version.
|
||||||
|
@ -138,6 +139,16 @@ version:
|
||||||
returned: if not excluded by filter
|
returned: if not excluded by filter
|
||||||
type: int
|
type: int
|
||||||
sample: 60
|
sample: 60
|
||||||
|
suffix:
|
||||||
|
description: Server suffix, for example MySQL, MariaDB, other or none.
|
||||||
|
returned: if not excluded by filter
|
||||||
|
type: str
|
||||||
|
sample: "MariaDB"
|
||||||
|
full_version:
|
||||||
|
description: Full server version.
|
||||||
|
returned: if not excluded by filter
|
||||||
|
type: str
|
||||||
|
sample: "5.5.60-MariaDB"
|
||||||
databases:
|
databases:
|
||||||
description: Information about databases.
|
description: Information about databases.
|
||||||
returned: if not excluded by filter
|
returned: if not excluded by filter
|
||||||
|
@ -353,13 +364,30 @@ class MySQL_Info(object):
|
||||||
for var in res:
|
for var in res:
|
||||||
self.info['settings'][var['Variable_name']] = self.__convert(var['Value'])
|
self.info['settings'][var['Variable_name']] = self.__convert(var['Value'])
|
||||||
|
|
||||||
ver = self.info['settings']['version'].split('.')
|
# version = ["5", "5," "60-MariaDB]
|
||||||
release = ver[2].split('-')[0]
|
version = self.info['settings']['version'].split('.')
|
||||||
|
|
||||||
|
# full_version = "5.5.60-MariaDB"
|
||||||
|
full_version = self.info['settings']['version']
|
||||||
|
|
||||||
|
# release = "60"
|
||||||
|
release = version[2].split('-')[0]
|
||||||
|
|
||||||
|
# check if a suffix exists by counting the length
|
||||||
|
if len(version[2].split('-')) > 1:
|
||||||
|
# suffix = "MariaDB"
|
||||||
|
suffix = version[2].split('-', 1)[1]
|
||||||
|
else:
|
||||||
|
suffix = ""
|
||||||
|
|
||||||
self.info['version'] = dict(
|
self.info['version'] = dict(
|
||||||
major=int(ver[0]),
|
# major = "5"
|
||||||
minor=int(ver[1]),
|
major=int(version[0]),
|
||||||
|
# minor = "5"
|
||||||
|
minor=int(version[1]),
|
||||||
release=int(release),
|
release=int(release),
|
||||||
|
suffix=str(suffix),
|
||||||
|
full_version=str(full_version),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __get_global_status(self):
|
def __get_global_status(self):
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result.changed == false
|
- result.changed == false
|
||||||
- result.version != {}
|
- "mysql_version in result.version.full_version"
|
||||||
- result.settings != {}
|
- result.settings != {}
|
||||||
- result.global_status != {}
|
- result.global_status != {}
|
||||||
- result.databases != {}
|
- result.databases != {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue