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

haproxy -v do not respect -q #2509

Open
aqueos opened this issue Mar 29, 2024 · 8 comments
Open

haproxy -v do not respect -q #2509

aqueos opened this issue Mar 29, 2024 · 8 comments
Labels
type: feature This issue describes a feature request / wishlist.

Comments

@aqueos
Copy link

aqueos commented Mar 29, 2024

Detailed Description of the Problem

hi,

there is a lot of time where we need to know the version of haproxy but we have to play with regex to get it from the command line :)

 HAProxy version 2.4.25-1~bpo10+1 2023/12/16 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-2.4.25.html
Running on: Linux 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64

logicaly haproxy -v -q should only output

2.4.25

but haproxy ignore the -q

Expected Behavior

-q should be taken in account and return only the version

Steps to Reproduce the Behavior

type haproxy -v and haproxy -v -q

Do you have any idea what may have caused this?

No response

Do you have an idea how to solve the issue?

add -q case in the -v code :D

What is your configuration?

haproxy 18 to 2.8

Output of haproxy -vv

not necessary

Last Outputs and Backtraces

No response

Additional Information

No response

@aqueos aqueos added status: needs-triage This issue needs to be triaged. type: bug This issue describes a bug. labels Mar 29, 2024
@wtarreau wtarreau added type: feature This issue describes a feature request / wishlist. and removed type: bug This issue describes a bug. labels Mar 29, 2024
@wtarreau
Copy link
Member

Switched this to a feature request as you're requesting a change of behavior.

Interestingly you expect to see "2.4.25" being returned while most others would expect to see the full version, which is "2.4.25-1bpo10+1" in your case. I'm not for changing the default output format as it would break for basically all those who, like you, parse the output. But maybe we could add new "-v*" fields, e.g. -vq to display "2.4.25-1bpo10+1" and maybe -vqs to show the shorter version "2.4.25". These are just ideas on the top of my head, I haven't thought about this deeper.

@aqueos
Copy link
Author

aqueos commented Mar 29, 2024

hi,

fine with me :)

About the revision number of debian if i want the package version i could use dpkg for that, here this is haproxy version.

I think the most intresting part for -vq ( or -vqq ;p) is the major/minor version because haproxy is feature compatible by major+minor version, so the shorter return could be the one returning the "feature version" like 2.2, 2.9 3.0 etc... corresponding to the feature and compatibility of it.

best regards,
Ghislain

@TimWolla
Copy link
Member

Do you need to know the version or do you just need to know whether it is higher or lower than a given version? The latter is already possible via:

haproxy -cc "version_atleast(2.4)"

@wtarreau
Copy link
Member

I agree with Tim here, when checking for compatibility, -cc is definitely the way to go. We're using it extensively in the regression tests now, that's super convenient.

@aqueos
Copy link
Author

aqueos commented Mar 29, 2024

it does not seems to work for me in version less than 2.7 (i dont have all versions but...)

LXD_GUEST:root@:[~]: haproxy -v
HAProxy version 2.4.25-1~bpo11+1 2023/12/16 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-2.4.25.html
Running on: Linux 6.6.17-060617-generic #202402161835 SMP PREEMPT_DYNAMIC Fri Feb 16 18:55:44 UTC 2024 x86_64
LXD_GUEST:root@:[~]: haproxy -cc "version_atleast(2.4)"
HAProxy version 2.4.25-1~bpo11+1 2023/12/16 - https://haproxy.org/
Status: long-term supported branch - will stop receiving fixes around Q2 2026.
Known bugs: http://www.haproxy.org/bugs/bugs-2.4.25.html
Running on: Linux 6.6.17-060617-generic #202402161835 SMP PREEMPT_DYNAMIC Fri Feb 16 18:55:44 UTC 2024 x86_64
Usage : haproxy [-f <cfgfile|cfgdir>]* [ -vdVD ] [ -n <maxconn> ] [ -N <maxpconn> ]
        [ -p <pidfile> ] [ -m <max megs> ] [ -C <dir> ] [-- <cfgfile>*]
        -v displays version ; -vv shows known build options.
        -d enters debug mode ; -db only disables background mode.
        -dM[<byte>] poisons memory with <byte> (defaults to 0x50)
        -V enters verbose mode (disables quiet mode)
        -D goes daemon ; -C changes to <dir> before loading files.
        -W master-worker mode.
        -Ws master-worker mode with systemd notify support.
        -q quiet mode : don't display messages
        -c check mode : only check config files and exit
        -n sets the maximum total # of connections (uses ulimit -n)
        -m limits the usable amount of memory (in MB)
        -N sets the default, per-proxy maximum # of connections (0)
        -L set local peer name (default to hostname)
        -p writes pids of all children to this file
        -de disables epoll() usage even when available
        -dp disables poll() usage even when available
        -dS disables splice usage (broken on old kernels)
        -dG disables getaddrinfo() usage
        -dR disables SO_REUSEPORT usage
        -dL dumps loaded object files after config checks
        -dr ignores server address resolution failures
        -dV disables SSL verify on servers side
        -dW fails if any warning is emitted
        -dD diagnostic mode : warn about suspicious configuration statements
        -sf/-st [pid ]* finishes/terminates old pids.
        -x <unix_socket> get listening sockets from a unix socket
        -S <bind>[,<bind options>...] new master CLI

@TimWolla
Copy link
Member

it does not seems to work for me in version less than 2.7 (i dont have all versions but...)

It's available as of HAProxy 2.5.

@wtarreau
Copy link
Member

Which means that if not supported, it's <2.5 hence possibly 2.4 for you :-)

@aqueos
Copy link
Author

aqueos commented Mar 29, 2024

yes most of my installs are 2.4, i will jump to 2.8.
FYI i use the version in a puppet fact then use this fact to create the config file with a template and i was thinking it would be great if the "quiet" flag worked with -v so it just not look a bunch of grep |cut that could break anytime if the output format change :)

@capflam capflam removed the status: needs-triage This issue needs to be triaged. label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature This issue describes a feature request / wishlist.
Projects
None yet
Development

No branches or pull requests

4 participants