Skip to content

fix mysql_version command #60

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

Merged
merged 2 commits into from
Oct 20, 2020
Merged

fix mysql_version command #60

merged 2 commits into from
Oct 20, 2020

Conversation

rndmh3ro
Copy link
Member

Gem::Version.new only supports MAJOR.MINOR.PATCH, no metadata (the part after the +).
We need to remove it.

before:

inspec> inspec.command("mysql -sN -e 'SHOW VARIABLES WHERE variable_name = \"version\"'").stdout.strip.split("\t")[1].to_s
=> "10.3.23-MariaDB-0+deb10u1"

after:

inspec> inspec.command("mysql -sN -e 'SHOW VARIABLES WHERE variable_name = \"version\"'").stdout.strip.split("\t")[1].split("-")[0]
=> "10.3.23"

Signed-off-by: Sebastian Gumprich github@gumpri.ch

Gem::Version.new only supports MAJOR.MINOR.PATCH, no metadata (the part after the +).
We need to remove it

before:
```
inspec> inspec.command("mysql -sN -e 'SHOW VARIABLES WHERE variable_name = \"version\"'").stdout.strip.split("\t")[1].to_s
=> "10.3.23-MariaDB-0+deb10u1"
```

after:
```
inspec> inspec.command("mysql -sN -e 'SHOW VARIABLES WHERE variable_name = \"version\"'").stdout.strip.split("\t")[1].split("-")[0]
=> "10.3.23"
```

Signed-off-by: Sebastian Gumprich <github@gumpri.ch>
Copy link
Member

@micheelengronne micheelengronne left a comment

Choose a reason for hiding this comment

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

Agreed. Just replace " with ' around \t and -

Copy link
Member

@micheelengronne micheelengronne left a comment

Choose a reason for hiding this comment

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

It's ok for me.

@micheelengronne micheelengronne merged commit 87d76c4 into master Oct 20, 2020
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

Successfully merging this pull request may close these issues.

2 participants