Running ansible --version now outputs git information when the
repo lives in .git in the root of the ansible source (coping with the case
where the git info is elsewhere is left as an exercise).
This uses gitpython where installed, otherwise it interrogates the files
in the .git directory to get the same information.
The gitpython path could be removed, but then people might ask 'why did
you do it like this when gitpython exists'
This adds user_password() to abstract how the user's password is looked
up. If spwd is not available, this will read the shadow file for the
user's shadow entry. This will then facilitate idempotent password
changes on hosts without spwd.
Basically if umask is set to something like 0007 then chmod +r and chmod +x
are not the same as chmod a+r and chmod a+x
Using os.path.basename rather than source.split should make ansible more
portable (and even if never ported, more readable)
git module used to check stderr for the string 'error' after calling
switch_version(). This changes that to just look at the return code to
determine whether the command failed. If the rc is not zero, the git
module will call fail_json().
The problem is that git checkout will summarize the commit message,
such as:
HEAD is now at ea38409... removing artificial error
When the string 'error' is the commit message, this check will
erroneously think the command failed.
This also removes the method switchLocalBranch() since it is no longer
used.
operations in the correct order, so the file module results overlay the original module results, not the other way
around (which keeps any failure msg's intact)