Closed mehyedes closed 9 years ago
@midihenry, thanks for the report.
@midihenry This looks like a duplicate scenario of #26882 and #26280 and should be fixed by #27681. The fix will be available in 2015.5.6 and is already fixed in 2015.8.0.
Update: It appears that I mis-remembered when my back-porting PR went into the 2015.5 branch and it missed the 2015.5.6 release tag. However, the initial stacktrace reported by @zer0def about the KeyError should be fixed at the HEAD of the 2015.5 branch. The fix is in 2015.8.0, though, so that statement remains true.
I ran your sample tests on a 2015.5.6 minion and could reproduce the stacktrace:
root@rallytime:~# salt rally-u12-2015-5-6 state.sls postgres
rally-u12-2015-5-6:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/minion.py", line 1198, in _thread_return
return_data = func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/state.py", line 708, in sls
ret = st_.state.call_high(high_)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 2068, in call_high
ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call_chunks
running = self.call_chunk(low, running, chunks)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1770, in call_chunk
self._mod_init(low)
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 613, in _mod_init
self.states['{0}.{1}'.format(low['state'], low['fun'])] # pylint: disable=W0106
File "/usr/lib/python2.7/dist-packages/salt/utils/lazy.py", line 90, in __getitem__
raise KeyError(key)
KeyError: 'postgres_user.present'
But when I ran it on a minion with the HEAD of 2015.5. installed, I don't see the stacktrace anymore where the packages to be installed fail, and so the requiring state also failed, as expected:
root@rallytime:~# salt rally-u12-2015-5 state.sls postgres
rally-u12-2015-5:
----------
ID: postgresql_install
Function: pkg.installed
Name: postgresql-9.3
Result: False
Comment: The following packages failed to install/update: postgresql-9.3
Started: 10:32:52.459382
Duration: 6430.904 ms
Changes:
----------
ID: add_user
Function: postgres_user.present
Name: user
Result: False
Comment: One or more requisite failed: postgres.postgresql_install
Started:
Duration:
Changes:
Summary for rally-u12-2015-5
------------
Succeeded: 0
Failed: 2
------------
Total states run: 2
Total run time: 6.431 s
I had this problem when trying to run this state file:
Postrgresql fails to install because of missing dependencies found on the minion log:
But instead of the
postgresql_install
state failing, theadd_user
state is executed and I get a KeyError which is caused by the absence of the psql command (postgresql failed to install in the first place):It may be a bug with the pkg state module. I'm using salt-master version 2015.5.5 and 2015.5.3 for the salt-minion