pkg.installed sources option doesn't work for .deb
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
Using '- sources:' with a .rpm source works fine, but with a .deb, I get unpredictable results.
Setup
Nothing special, I put the .deb in a subdirectory with my SLS.
Steps to Reproduce the behavior
I was trying to install a fairly large .deb (the SentinelAgent client for the SentinelOne security package), but to exclude that I created a trivial .deb that just installs a README.
TrivialDeb:
pkg.installed:
- name: TrivialDeb
- sources:
- TrivialDeb: salt://Tricks/files/TrivialDeb.deb
Expected behavior
I can run exactly the same structure with an .rpm, and it installs fine every time.
Screenshots
This is what I end up with, occasionally, but it isn't deterministic. Sometimes I get partial success (it installs the file but 'fails', even though when I manually install the .deb with dpkg -i it doesn't generate an error.)
ID: TrivialDeb_Package
Function: pkg.installed
Name: TrivialDeb
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1626, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1492, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/pkg.py", line 1103, in installed
**kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/aptpkg.py", line 562, in install
deb_info = __salt__['lowpkg.bin_pkg_info'](pkg_source)
File "/usr/lib/python2.7/dist-packages/salt/modules/dpkg.py", line 64, in bin_pkg_info
if not os.path.exists(path):
File "/usr/lib/python2.7/genericpath.py", line 26, in exists
os.stat(path)
TypeError: coercing to Unicode: need string or buffer, bool found
Started: 17:21:55.284741
Duration: 1007.709 ms
Changes:
Versions Report
Salt Version:
Salt: 3000.1
Dependency Versions:
cffi: Not Installed
cherrypy: 3.5.0
dateutil: 2.4.2
docker-py: Not Installed
gitdb: 0.6.4
gitpython: 1.0.1
Jinja2: 2.8
libgit2: Not Installed
M2Crypto: 0.21.1
Mako: 1.0.3
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: 2.7.12 (default, Apr 15 2020, 17:07:12)
python-gnupg: 0.3.8
PyYAML: 3.11
PyZMQ: 15.2.0
smmap: 0.9.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: Ubuntu 16.04 xenial
locale: UTF-8
machine: x86_64
release: 4.4.0-96-generic
system: Linux
version: Ubuntu 16.04 xenial
Additional context
I know I'm running an older Python, I promise to upgrade ASAP. I spent a lot of time trying various things other than upgrading my master, but I couldn't isolate or identify any problems. Turning up the debug didn't seem to help.
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
Reproduce the .deb case with the shown SLS, then trace the failure through salt/states/pkg.py, salt/modules/aptpkg.py, and salt/modules/dpkg.py. Compare the .deb and .rpm source paths; done means a local .deb installs reliably through pkg.installed without the reported TypeError or a false result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100