The command sudo salt "host.*" state.highstate terse=true
causes the following error when the appropriate option is already present in the .ini file:
Function: ini.options_present
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/states/ini_manage.py", line 90, in options_present
__salt__['ini.set_option'](name, {section_name: section_body}, separator)[section_name])
KeyError: 'server'
Started: 08:58:11.641259
Duration: 42.412 ms
Changes:
ini.options_present:
- sections:
server:
root_url: 'https://someurl'
Create init.sls with options_present, a section and a key as shown above (Setup).
Make sure that the .ini file going to be updated already contains the appropriate values.
Execute sudo salt "host.*" state.highstate terse=true
The command throws an error until the root_url
is deleted manually from the .ini file.
Salt Version:
Salt: 2017.7.0
Dependency Versions:
cffi: Not Installed
cherrypy: unknown
dateutil: Not Installed
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.4.3
pygit2: Not Installed
Python: 2.7.5 (default, Nov 6 2016, 00:28:07)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4
System Versions:
dist: centos 7.3.1611 Core
locale: ANSI_X3.4-1968
machine: x86_64
release: 3.10.0-514.16.1.el7.x86_64
system: Linux
version: CentOS Linux 7.3.1611 Core
+1 Experienced the same error after upgrading to 2017.7.0
Same issue with 2017.7.0 here as well.
Function: ini.options_present
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 1837, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/ini_manage.py", line 90, in options_present
__salt__['ini.set_option'](name, {section_name: section_body}, separator)[section_name])
KeyError: 'useDemoClinicInfoOnInvoice'
+1 for me:
ID: influxdb-conf
Function: ini.options_present
Name: /etc/influxdb/influxdb.conf
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/states/ini_manage.py", line 90, in options_present
__salt__['ini.set_option'](name, {section_name: section_body}, separator)[section_name])
KeyError: 'http'
Started: 05:56:17.449547
Duration: 152.932 ms
Changes:
for:
influxdb-conf:
ini.options_present:
- name: '/etc/influxdb/influxdb.conf'
- separator: '='
- strict: True
- sections:
'http':
enabled: 'true'
bind-address: "':8086'"
I am running CentOS Linux release 7.3.1611
same here.
/etc/yum.conf:
ini.options_present:
- sections:
main:
obsoletes: 0
timeout: 120
local:
----------
ID: /etc/yum.conf
Function: ini.options_present
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/salt/states/ini_manage.py", line 90, in options_present
__salt__['ini.set_option'](name, {section_name: section_body}, separator)[section_name])
KeyError: 'main'
Started: 06:38:50.864061
Duration: 3.889 ms
Changes:
cc @m03
this is fixed by. just tested it on my side
commit 9478729120270b2b2b2b2f41a4517fe0de7b11bd
Author: m03 moe.winnett@gmail.com
Date: Sun Jun 11 17:22:35 2017 -0700
Fix #34245 ini.options_present reporting changes
I guess we just need to backport it to 2017.7
Hi @christianbader and @mvyletel - I have back-ported the referenced pull request to 2017.7 with #42618. Does that fully resolve this issue?
+1 Experienced the same error after upgrading to 2017.7.0
Thanks for your work to fix the issue.
@rallytime I can confirm it works for me
$ git branch
* (HEAD detached at origin/2017.7)
develop
$ git log --oneline -8
b7cd30d3ee (HEAD, origin/2017.7) Merge pull request #42621 from rallytime/merge-2017.7
d48749b476 Merge pull request #42618 from rallytime/bp-41690
e671242a4f Merge pull request #42619 from rallytime/bp-42589
58dcb58a47 Merge branch '2016.11' into '2017.7'
cd5eb93903 Fix ssh-salt calls with scan roster for uncached clients
cbf752cd73 (origin/2016.11) Merge pull request #42515 from gtmanfred/backslash
22c6a7c7ff Improve output precision
ee4ea6b860 Fix #34245 ini.options_present reporting changes
$ sudo python2.7 scripts/salt-call --local state.sls yum.conf
[INFO ] Loading fresh modules for state activity
[INFO ] Running state [/etc/yum.conf] at time 01:14:44.409165
[INFO ] Executing state ini.options_present for [/etc/yum.conf]
main
OrderedDict([('obsoletes', 0), ('timeout', 120)])
[INFO ] No changes take effect
[INFO ] Completed state [/etc/yum.conf] at time 01:14:44.413982 duration_in_ms=4.817
local:
Summary for local
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 4.817 ms
Does anyone know when the backported fix will hit the salt-latest yum repo?
This problem is still present in 2017.7.1
@rallytime's fix got merged into the 2017.7 branch (#42618). Unfortunately, it did not get merged forward to the 2017.7.1 branch upon which salt-2017.7.1-1.el7.noarch.rpm from the RHEL/CentOS 7 repos appears to have been built.
Because of this regression, I was unable to use 2017.7 and am still unable to use 2017.7.1. Is there any way we could get the fix merged forward and a new rpm built and pushed to the repo?
Hi @nhavens - apologies for missing the question about when the fix will be released. This fix will be available in the 2017.7.2
release.
In the mean time, you can patch the state file and place it in your _states
directory and use it like a custom state module: https://docs.saltstack.com/en/latest/ref/states/writing.html#using-custom-state-modules
@mvyletel Thanks for the confirmation! Since this issue is confirmed to be fixed, I'll close this.
@rallytime, Thanks for the info! Very helpful!
Most helpful comment
Hi @nhavens - apologies for missing the question about when the fix will be released. This fix will be available in the
2017.7.2
release.In the mean time, you can patch the state file and place it in your
_states
directory and use it like a custom state module: https://docs.saltstack.com/en/latest/ref/states/writing.html#using-custom-state-modules@mvyletel Thanks for the confirmation! Since this issue is confirmed to be fixed, I'll close this.