lxc init fails on Python 3
Open
Nobody has claimed this yet.
bug
bytes-vs-strings
severity-medium
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description of Issue/Question
lxc.init fails with:
Passed invalid arguments to lxc.init: a bytes-like object is required, not 'str'
First I was not sure if this is a bug, but then I found issue #46299 , and symptoms seem to be similar and lxc.create works fine. See below.
Setup
Cloud provider with lxc driver and profiles for salt cloud (config) and lxc (pillar).
This works:
# salt myminion lxc.create container2 profile=alpine
myminion:
----------
result:
True
state:
----------
new:
stopped
old:
None
But this does not:
# salt myminion lxc.init container3 profile=alpine
myminion:
Passed invalid arguments to lxc.init: a bytes-like object is required, not 'str'
Initialize a new container.
This is a partial idempotent function as if it is already provisioned, we
will reset a bit the lxc configuration file but much of the hard work will
be escaped as markers will prevent re-execution of harmful tasks.
[.... whole docstring ....]
ERROR: Minions returned with non-zero exit code
Steps to Reproduce Issue
- Install salt from the
py3repo on Ubuntu 18.04 (bionic) - Run the
lxc.initmodule.
Versions Report
# salt-call --versions-report
Salt Version:
Salt: 2019.2.0
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: 2.0.3
gitpython: 2.1.8
ioflo: Not Installed
Jinja2: 2.10
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: Not Installed
Python: 3.6.7 (default, Oct 22 2018, 11:32:17)
python-gnupg: 0.4.1
PyYAML: 3.12
PyZMQ: 16.0.2
RAET: Not Installed
smmap: 2.0.3
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.5
System Versions:
dist: Ubuntu 18.04 bionic
locale: UTF-8
machine: x86_64
release: 4.15.0-46-generic
system: Linux
version: Ubuntu 18.04 bionic
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lxc.init entry point and compare its argument handling with lxc.create, then reproduce the failure using Python 3 on Ubuntu 18.04 as described. Done means lxc.init completes without the bytes-like-object error and initializes the container successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100