[MXS-4078] maxctrl commands exception with file .maxctrl.cnf Created: 2022-04-06  Updated: 2022-04-13  Resolved: 2022-04-07

Status: Closed
Project: MariaDB MaxScale
Component/s: maxctrl
Affects Version/s: 6.2.4
Fix Version/s: 6.3.0

Type: Bug Priority: Major
Reporter: suresh ramagiri Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None


 Description   

With the .maxctrl.cnf file created, having the details like below:

[maxscale@test001 ~]$ cat .maxctrl.cnf
[maxctrl]
--hosts=test001:8989
--user=admin123
--password=password

Note: I have created a user admin123.

Trying to run maxctrl -h <hostname>:8989 -u <user> -p <pass> show maxscale or any commands like show servers, list servers are throwing following error.

example:
====
[maxscale@test001 ~]$ maxctrl -h 127.0.0.1:8989 -u admin123 -p password show maxscale
(node:28803) UnhandledPromiseRejectionWarning: TypeError: undefined is not a function
at /snapshot/maxctrl/lib/common.js
at Object.handler (/snapshot/maxctrl/lib/show.js)
at /snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:9114
at j (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:4993)
at M.applyMiddlewareAndGetResult (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:9083)
at M.runCommand (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:7268)
at Jt.[runYargsParserAndExecuteCommands] (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:56059)
at M.parseAndUpdateUsage (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:8035)
at M.applyBuilderUpdateUsageAndParse (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:7744)
at M.runCommand (/snapshot/maxctrl/node_modules/yargs/build/index.cjs:1:7115)
(Use `maxctrl --trace-warnings ...` to show where the warning was created)
(node:28803) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:28803) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

If we remove the .maxctrl.cnf file, all commands with maxctrl are working fine.

example:
======
[maxscale@test001 ~]$ mv .maxctrl.cnf .maxctrl.cnf_old
[maxscale@test001 ~]$ maxctrl -h 127.0.0.1:8989 -u admin123 -p password show maxscale
┌──────────────┬──────────────────────────────────────────────────────────┐
│ Version │ 6.2.4 │
├──────────────┼──────────────────────────────────────────────────────────┤
│ Commit │ 6e1317be296490366b7bf11b8e9b1864acc365d6 │
├──────────────┼──────────────────────────────────────────────────────────┤
│ Started At │ Wed, 06 Apr 2022 00:30:16 GMT │
├──────────────┼──────────────────────────────────────────────────────────┤
│ Activated At │ Wed, 06 Apr 2022 00:30:16 GMT │



 Comments   
Comment by markus makela [ 2022-04-06 ]

This is a problem with the configuration file, it uses the wrong format for the options: the values must be defined without the -- part.

Comment by suresh ramagiri [ 2022-04-06 ]

ha, that looks like the problem here.

Tested out, after removing – part defined at the maxctrl.cnf file, it worked normally, no error found which is noted here.

maxscale@test001 ~]$ cat .maxctrl.cnf
[maxctrl]
hosts=test001:8989
user=admin123
password=password

[maxscale@test001 ~]$ maxctrl -h 127.0.0.1:8989 -u admin123 -p password show maxscale
┌──────────────┬──────────────────────────────────────────────────────────┐
│ Version │ 6.2.4 │
├──────────────┼──────────────────────────────────────────────────────────┤
│ Commit │ 6e1317be296490366b7bf11b8e9b1864acc365d6 │
├──────────────┼──────────────────────────────────────────────────────────┤
│ Started At │ Wed, 06 Apr 2022 00:30:16 GMT │

Thank You!

Comment by suresh ramagiri [ 2022-04-06 ]

It's not a bug.
Configuration file - maxctrl.cnf content format issue.

Removing the "--" part from the file, made the things work as expected.
https://mariadb.com/kb/en/mariadb-maxscale-6-maxctrl/#maxctrlcnf doesn't explicitly mentioned as '' or '' to avoid, but the example shows there is no "" used.

Comment by markus makela [ 2022-04-06 ]

It's sort of a bug in the way that maxctrl doesn't give an error for the wrong format. We'll fix it so that it will notify the user about the wrong format.

Generated at Thu Feb 08 04:26:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.