Skip to content

Command parsing when map id is negative #5

Description

@shauntarves

I am running my haproxy in a container with a volume-mounted socket directory, and when listing maps via the stats socket, the map id is -1. This creates a problem because the command-line parsing doesn't work (in any way that I've tried) and the actual map file is inside of the container, so the os.path.isfile check fails as well. I'm at a loss how to deal with this:

[root]# echo "show map" | socat stdio /var/lib/docker/volumes/run/_data/haproxy.sock
# id (file) description
-1 (/usr/local/etc/haproxy/domain-to-backend.map) pattern loaded from file '/usr/local/etc/haproxy/domain-to-backend.map' used by map at file '/usr/local/etc/haproxy/haproxy.cfg' line 77, by map at file '/usr/local/etc/haproxy/haproxy.cfg' line 94

[root]# echo "show map /usr/local/etc/haproxy/domain-to-backend.map" | socat stdio /var/lib/docker/volumes/run/_data/haproxy.sock
0x555fa64b4d00 xx1 yy1
0x555fa64b4dc0 xx2 yy2
0x555fa64b4ea0 xx3 yy3

[root]# echo "show map #-1" | socat stdio /var/lib/docker/volumes/run/_data/haproxy.sock
0x555fa64b4d00 xx1 yy1
0x555fa64b4dc0 xx2 yy2
0x555fa64b4ea0 xx3 yy3

[root]#  haproxytool map -F /var/lib/docker/volumes/run/_data/haproxy.sock --list
# id (file) description
-1 (/usr/local/etc/haproxy/domain-to-backend.map) pattern loaded from file '/usr/local/etc/haproxy/domain-to-backend.map' used by map at file '/usr/local/etc/haproxy/haproxy.cfg' line 77, by map at file '/usr/local/etc/haproxy/haproxy.cfg' line 94

[root]#  haproxytool map -F /var/lib/docker/volumes/run/_data/haproxy.sock -s -1
Usage:
    haproxytool map [-D DIR | -F SOCKET] -l
    haproxytool map [-D DIR | -F SOCKET] (-s | -c ) MAPID
    haproxytool map [-D DIR | -F SOCKET] -g MAPID KEY
    haproxytool map [-D DIR | -F SOCKET] (-S | -A) MAPID KEY VALUE
    haproxytool map [-D DIR | -F SOCKET] -d MAPID KEY

[root]#  haproxytool map -F /var/lib/docker/volumes/run/_data/haproxy.sock -s "-1"
Usage:
    haproxytool map [-D DIR | -F SOCKET] -l
    haproxytool map [-D DIR | -F SOCKET] (-s | -c ) MAPID
    haproxytool map [-D DIR | -F SOCKET] -g MAPID KEY
    haproxytool map [-D DIR | -F SOCKET] (-S | -A) MAPID KEY VALUE
    haproxytool map [-D DIR | -F SOCKET] -d MAPID KEY

[root]# haproxytool map -F /var/lib/docker/volumes/run/_data/haproxy.sock --show=-1
--show must not have an argument
Usage:
    haproxytool map [-D DIR | -F SOCKET] -l
    haproxytool map [-D DIR | -F SOCKET] (-s | -c ) MAPID
    haproxytool map [-D DIR | -F SOCKET] -g MAPID KEY
    haproxytool map [-D DIR | -F SOCKET] (-S | -A) MAPID KEY VALUE
    haproxytool map [-D DIR | -F SOCKET] -d MAPID KEY

[root]# haproxytool map -F /var/lib/docker/volumes/run/_data/haproxy.sock -s "/usr/local/etc/haproxy/domain-to-backend.map"
Invalid input

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions