Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
bugbroken, incorrect, or confusing behaviordependencyunderlying Salt dependency issuedoc-correctiondocu page has an error or deadlinkdocumentationRelates to Salt documentationpython3regarding Python 3 supportseverity-low4th level, cosemtic problems, work around existstime-estimate-single-day
Milestone
Description
Setup
haproxyctl-0.3.1 from pip3 install haproxyctl
Salt Version:
Salt: 3000.3
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.1
libgit2: Not Installed
M2Crypto: 0.35.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.8 (default, Apr 2 2020, 13:34:55)
python-gnupg: Not Installed
PyYAML: 3.13
PyZMQ: 15.3.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: centos 7.8.2003 Core
locale: UTF-8
machine: x86_64
release: 3.10.0-1127.8.2.el7.x86_64
system: Linux
version: CentOS Linux 7.8.2003 Core
Steps to Reproduce the behavior
salt-call --local haproxy.show_backends -l debug
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[WARNING ] The 'environment' minion config option has been renamed to 'saltenv'. Using dev as the 'saltenv' config value.
[DEBUG ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG ] Grains refresh requested. Refreshing grains.
[DEBUG ] Reading configuration from /etc/salt/minion
[DEBUG ] Including configuration from '/etc/salt/minion.d/_schedule.conf'
[DEBUG ] Reading configuration from /etc/salt/minion.d/_schedule.conf
[DEBUG ] Loading static grains from /etc/salt/grains
[DEBUG ] LazyLoaded zfs.is_supported
[DEBUG ] Determining pillar cache
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] pillarenv 'dev' not found in the configured pillar environments (base)
[DEBUG ] LazyLoaded jinja.render
[DEBUG ] LazyLoaded yaml.render
[DEBUG ] LazyLoaded haproxy.show_backends
[DEBUG ] LazyLoaded direct_call.execute
Passed invalid arguments: a bytes-like object is required, not 'str'.
Usage:
Show HaProxy Backends
socket
haproxy stats socket, default ``/var/run/haproxy.sock``
CLI Example:
.. code-block:: bash
salt '*' haproxy.show_backends
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/cli/caller.py", line 218, in call
ret['return'] = self.minion.executors[fname](self.opts, data, func, args, kwargs)
File "/usr/lib/python3.6/site-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/modules/haproxyconn.py", line 373, in show_backends
return ha_conn.sendCmd(ha_cmd)
File "/usr/local/lib/python3.6/site-packages/haproxy/conn.py", line 33, in sendCmd
self.sock.send(cmd.getCmd())
TypeError: a bytes-like object is required, not 'str'
Metadata
Metadata
Assignees
Labels
bugbroken, incorrect, or confusing behaviordependencyunderlying Salt dependency issuedoc-correctiondocu page has an error or deadlinkdocumentationRelates to Salt documentationpython3regarding Python 3 supportseverity-low4th level, cosemtic problems, work around existstime-estimate-single-day
Activity
[-]haproxyconn Module : typeError: a bytes-like object is required, not 'str'[/-][+][BUG] haproxyconn Module : typeError: a bytes-like object is required, not 'str'[/+]dmurphy18 commentedon Jun 3, 2020
@Nerigal The last commit on the haproxyctl was 'Latest commit 8a10db7 on Aug 24, 2015'
Are you sure that this module is compatible with Python 3.6 which you are using on Redhat 7, since this appears to be a bytes vs str usage issue, typically not an issue in Py 2.7 but not in Python 3.
Noting that support for Python 3 was released in May 2015, but still quite some time ago, Py 3.4 and Py 3.5 where active then, but Py 3.4 is EOL'd
Noting that the error is occurring in haproxy code
Nerigal commentedon Jun 3, 2020
it is the version installed from
pip3 install haproxyctlat least from CentOS 7haproxyctl-0.3.1
and yes i figured that the version on the repo work fine but the pip version is still broken with the encoding of
cmd.getCmd()Nerigal commentedon Jun 3, 2020
Also, i say here because i dont know where but in the official documentation
there is no mention on what are and how to install the requirements to make
salt.modules.haproxyconnwork properlyhttps://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.haproxyconn.html#module-salt.modules.haproxyconn
dmurphy18 commentedon Jun 4, 2020
@Nerigal You state it is pip3 installed, then it is not from CentOS 7 haproxyctl-0.3.1 since it will have been installed from PyPI, and you then state that the pip version is broken.
SaltStack is not in control of haproxyctl especially the version installed from PyPi. You can log the error with upstream for haproxyctl.
As for haproxyctl-0.3.1, I fail to find that package on either Centos 7 or Redhat / Fedora sites when searching for it, http://rpms.remirepo.net/rpmphp/zoom.php?rpm=haproxy and http://rpms.remirepo.net/rpmphp/zoom.php?rpm=haproxyctl
Lastly SaltStack only packages a limit amount of modules when creating a package for a platform, additionally functionality can be pip installed from PyPi. This is done in interest to reduce the size of packages delivered to users with the packages containing the functionality that most users typically use.
Nerigal commentedon Jun 4, 2020
@dmurphy18 i think you don't get my point here, Yes it is installed by pip 3 and i say at least on CentOS 7 because i have not validated if pip3 would use a different repos / version of the package for example on Ubuntu or else
so i cannot relate if the same behavior will occur from a pip3 installation under a Debian or such
No its not a RPM packaged
like i said, haproxyctl-0.3.1 is installed that way
pip3 install haproxyctlThat's fine, as long as the requirements are correctly documented to make the module word properly
dmurphy18 commentedon Jun 4, 2020
I expect Ubuntu 20.04 version is more up to date and functions correctly with Python 3 since they are shipping https://packages.ubuntu.com/focal/haproxyctl v1.4.3-1 (Debian versioning)
it’s not spelled out that you have to install it yourself, but on the top of any module documentation that has 3rd party deps it says something to that effect.
Nerigal commentedon Jun 4, 2020
i don't see anything about that here
https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.haproxyconn.html#module-salt.modules.haproxyconn
15 remaining items
dmurphy18 commentedon Sep 23, 2022
This might be a good candidate for salt extensions
dwoz commentedon Oct 15, 2026
Thanks for the original report. This issue has been open for more than three years without recent activity and carries a severity label below
severity-high. As part of a backlog cleanup, we're closing older low- and medium-severity issues so triage can focus on reports against currently supported releases.Closing isn't a judgement that the problem wasn't real — only that the codebase has moved through several releases since this was filed, and much of the surrounding code has changed.
If you — or anyone else — can still reproduce this on the 3008.x LTS release, please leave a comment with a reproduction and a maintainer will reopen. The original reporter can also reopen directly.
dwoz commentedon Oct 17, 2026
Reopening — there is an open PR tracking a fix for this: #69554.
dwoz commentedon Oct 24, 2026
Closing as part of a backlog cleanup — this bug was reported against a version that is no longer supported (pre-3005). The underlying code has moved through several major releases since, and in many cases been rewritten or extracted into a saltext extension.
If you can still reproduce this on 3006.x LTS or 3008.x LTS, please comment with:
salt --versions-reportand a maintainer will reopen. The original reporter can also reopen directly.