ohe ohe - 2 months ago 5
Git Question

UnboundLocalError triggered during the deployment of a salt minion

During a minion deployment, a

UnboundLocalError
is raised by the
git
library used as a dependency of
salt


An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1594, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1491, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/git.py", line 519, in latest
if remote_rev_type == 'sha1':
UnboundLocalError: local variable 'remote_rev_type' referenced before assignment


It is very unclear to know what happen here. Any clue?

Answer

This was a bug in the library. Variable remote_rev_type was not initialized in all execution paths.

From the looks of the current salt-stack source code, I'd say it has been fixed.