Forking the systemd-notify command is known to be unreliable at least
with older versions of the kernel and/or systemd. When systemd receives
the notification the systemd-notify process may have already exited
causing an error in the logs while waiting for a (90 seconds) timeout.
This patch instead notifies the systemd NOTIFY_SOCKET synchronously in
case the systemd.daemon python library is not available.
The Testinfra module had a line where the collection of passed arguments was silently overwritten so that it would not actually perform any assertions. Updated the variable names to address the issue of the parameters being clobbered so that asertions are performed properly.
The git.latest state runs a `git ls-remote` on the remote repo to
discover which SHA it should end up at, and whether or not it needs to
fetch from the repo to get the commit it needs. However, since we
fast-forward using a `git merge` to the branch specified in the `rev`
argument, this leaves the state susceptible to a race condition when
someone pushes to the remote repo between when we run the `git
ls-remote` and when we fetch the remote repo. We will successfully
fast-forward to the head of the branch, but that branch will be pointing
to a different commit than the one identified in the `git ls-remote`, so
we will report the state as having failed.
This commit fixes that race condition by fast-forwarding to the commit
identified in the `git ls-remote`, rather than to the branch named by
`rev`.
NOTE: This means that in these edge cases, we will report a `True`
result despite the head of the branch having advanced past the commit to
which we fast-forwarded, but that seems like a reasonable trade-off for
avoiding a race condition. If we repeated the `git ls-remote` after
fetching, we'd just be opening up a window (albeit a smaller one) for
another race condition.
The TestInfra library changed the package layout recently which caused
the extension module to stop working. This patch addresses those
updates and will work across all versions of the library.