Skip to content

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