During a deployment, we bump version from 3.2.5 to 3.3 and we get weird git error: ``` State: - git Name: git@github.com:**/**.git Function: latest Result: False Comment: cannot concatenate 'str' and 'float' objects Changes: ``` I try to dig into the code and thinks I found the problem: https://github.com/saltstack/salt/blob/7bb7ff8f2b2688dddb90d801965a8654c3a51776/salt/states/git.py#L216 I tried to add some log before this line and revision is parsed as a float. With this patch, state.highstate ends successfully: ``` diff --git a/salt/states/git.py b/salt/states/git.py index cc7b26e..1a75a46 100644 --- a/salt/states/git.py +++ b/salt/states/git.py @@ -213,7 +213,7 @@ def latest(name, identity=identity) elif rev: - cmd = "git rev-parse " + rev + '^{commit}' + cmd = "git rev-parse %s ^{commit}" % rev retcode = __salt__['cmd.retcode'](cmd, cwd=target, runas=user) ``` If it's the problem and the patch works, I will push a pull-request.
Activity
basepi commentedon Jan 13, 2014
Yes, this is the correct fix, except that we want to use
.formatinstead of the%syntax:Note the double brackets (
{{commit}}) so that the format call doesn't try to insert a value for commit.Please feel free to submit a pull request with this modified fix.
Make git state compatible with numeric tag. Fix saltstack#9718
Merge pull request #9754 from Lothiraldan/bugfix/9718-git-numeric-tag
Make git state compatible with numeric tag. Fix saltstack#9718
Make git state compatible with numeric tag. Fix #9718