pkgrepo.managed: Invalid syntax when using [options]
When using the optional options parameter when adding an apt repository, a stray closing ] is added, causing a syntax error in the apt config.
Setup
{% for dist, config in salt['pillar.get']('repo', {}).iteritems() %}
install_our_repo:
pkgrepo.managed:
- humanname: our-repo
- name: deb [arch=amd64 trusted=yes] http://{{ config.hostname }}/ {{ dist }} main contrib
- file: /etc/apt/sources.list.d/platform-repository.list
{% endfor %}
Steps to Reproduce Issue
Run the above SLS. The file that is created comes out as:
deb [arch=amd64] trusted=yes] http://repository.staging.synety.local contrib main staging
There is a stray closing ] added
Versions Report
Master:
Salt Version:
Salt: 2015.8.8.2
Dependency Versions:
Jinja2: 2.7.3
M2Crypto: Not Installed
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
Python: 2.7.9 (default, Mar 1 2015, 12:57:24)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: debian 8.3
machine: x86_64
release: 3.16.0-4-amd64
system: debian 8.3
Minion:
Salt Version:
Salt: 2015.8.8.2
Dependency Versions:
Jinja2: 2.6
M2Crypto: Not Installed
Mako: Not Installed
PyYAML: 3.10
PyZMQ: 13.1.0
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 3.2.3
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: debian 7.8
machine: x86_64
release: 3.2.0-4-amd64
system: debian 7.8
@phil-lavin, thanks for reporting.
To add some more context, this only happens on Debian 7 minions. Debian 8 minions running the same version configure correctly. Output from a working Debian 8 minion is below:
phil@backend-lb-01:~$ salt-minion --versions-report
Salt Version:
Salt: 2015.8.8.2
Dependency Versions:
Jinja2: 2.7.3
M2Crypto: Not Installed
Mako: Not Installed
PyYAML: 3.11
PyZMQ: 14.4.0
Python: 2.7.9 (default, Mar 1 2015, 12:57:24)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
cffi: 0.8.6
cherrypy: Not Installed
dateutil: 2.2
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.2
mysql-python: 1.2.3
pycparser: 2.10
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: Not Installed
timelib: Not Installed
System Versions:
dist: debian 8.3
machine: x86_64
release: 3.16.0-4-amd64
system: debian 8.3
It is bug in python-apt package in Debian 7 - aptsources module
Debian 7
# python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from aptsources import sourceslist
>>> repo = 'deb [arch=amd64 trusted=yes] http://example.com/ wheezy main contrib'
>>> split = sourceslist.SourceEntry(repo)
>>> print(split.type, split.uri, split.dist, split.comps
... )
('deb', 'trusted=yes]', 'http://example.com/', ['wheezy', 'main', 'contrib'])
Debian 8
# python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from aptsources import sourceslist
>>> repo = 'deb [arch=amd64 trusted=yes] http://example.com/ wheezy main contrib'
>>> split = sourceslist.SourceEntry(repo)
>>> print(split.type, split.uri, split.dist, split.comps
... )
('deb', 'http://example.com/', 'wheezy', ['main', 'contrib'])
As the bug was not in Salt, and has since been fixed in Debian 8, (Debian 7 is no longer supported as of May 2018) this bug should probably be closed.
@terminalmage , could you close this please? Thanks.
Thanks for the heads-up!