-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ansible-pull does not recognize git updated branches #604
Comments
Assigning to sfromm, though if you'd like to help figure it out that would be welcome. |
I will try to debug the code. But my python skills are very poor. |
was this repo originally copied instead of cloned? Currently the git module expects a repo that was cloned with the "git clone" command. |
see #601 |
Could be related to #601 |
Not necessarily related to this issue, but -U means --url with ansible-pull. Not --sudo-user as it does with ansible-playbook. |
closing as duplicate of #601 since I haven't heard anything, let me know if you disagree at this repo was originated in some way other than a git clone (in which case it's not a dup) |
It was cloned by ansible-pull script, because the local dir was empty before the first run. |
ok, reopening, git module has additional things to fix probably |
@go2sh, please provide the output of git branch -a. Thanks. |
@go2sh: One more question: what version of ansible are you using? |
I can replicate the problem by if I update the local repository with git (git pull) and then try to update it with ansible's git module. The latter step fails. It appears the git module is basically doing the following:
The first step, git checkout master, is called by switchLocalBranch() from inside pull(), line 154 in my ansible repo. My repo is at 13abe50, a little bit behind. If the module doesn't check out master, the pull step will work as expected and the repo will go to HEAD for the desired branch. One other thing I would add: when creating the local branch at line 151 (git checkout -b %s origin/%s), I think it should also use the option --track since it is meant to track the upstream branch. |
I use ansible 0.6 . |
The git module probably needs some deeper work, but I opted to fix this specific issue instead. I'd appreciate comments on skipping the step switchLocalBranch( branch ) in pull(). |
This drops the branch option. The version option is overloaded to mean either a sha1, branch, or tag. This also adds the option 'remote' which defaults to 'origin'. clone() was simplified by removing the checkout operation. That happens later when switch_version() is called. Added the methods get_branches(), is_remote_branch(), and is_local_branch(). get_branches() returns an array listing all of the branches for the git repository. is_remote_branch() checks whether the arguments supplied correspond to a remote branch. Similarly, is_local_branch() checks for a local branch. The pull() method now checks to see if it is on the desired branch. If not, it checks out the requested branch and then does a pull. This should keep issue #604 still fixed. switch_version(), formerly switchver(), looks to see if it is checking out a branch. If a branch, it checks it out with the --track option. This type of checkout was in pull() before. Updated pull, clone, and switch_version to return (rc, out, err).
I'm using ansible-pull as cron.daily job for syncing new packages to my clients.
But right now it fails to pull updates from the remote host.
I run ansible-pull like this:
ansible-git is defind in my ssh_config. The Output from ansible-pull is:
But git status shows:
The text was updated successfully, but these errors were encountered: