This fixes an edge case where an env blacklist/whitelist was updated
between masterless runs, or in later releases if an environment was
added via per-saltenv configuration. In these cases, if there are no
changes fetched, the env cache will remain intact, and will be returned
when envs() is called. This commit forces the env cache to be refreshed
on every update in masterless mode.
It also forces the env cache to be ignored when
salt.fileserver.Fileserver.envs() is executed in masterless mode (such
as via the fileserver.envs runner).
The "latest" keyword was only implemented when both "name" and "version"
were used, and not for "pkgs". But mod_aggregate puts all packages into
a single low chunk, within "pkgs". This means that using aggregation in
conjuntion with the "latest" keyword no longer resolves the latest
version and thus breaks these states.
This fixes the problem by moving the logic for resolving the "latest"
keyword into _find_install_targets(). It also makes some improvements to
the logic we use to ensure only one package DB refresh is performed per
Salt run, by making the pkg.refresh_db functions handle removing the
rtag file, instead of requiring a call to a helper function everywhere
in the pkg state where we might be calling a function that refreshes the
package DB.
I mixed up the test that was actually failing for Arch. I originally
submitted #41074 to skip the test_salt_documentation test in the
shell matcher tests. This is the wrong test to skip.
I reverted the previous commit, and applied the skipTest to the
correct test that is failing on Arch, which is the
test_salt_documentation_arguments_not_assumed test.
The "head_ref" variable is not used anywhere in the code, and should
be "head_rev" instead. Without setting "head_rev" to "None", there is
a potential to hit an UnboundLocalError further down in the file.
This was caught by a test in the nitrogen branch, but the bug is present
on 2016.11 as well. Here's the output from the integration test failure:
```
-> integration.states.test_git.GitTest.test_latest_updated_remote_rev .........................................
Traceback (most recent call last):
File "/testing/tests/integration/states/test_git.py", line 365, in test_latest_updated_remote_rev
self.assertSaltTrueReturn(ret)
File "/testing/tests/support/mixins.py", line 547, in assertSaltTrueReturn
**(next(six.itervalues(ret)))
AssertionError: False is not True. Salt Comment:
An exception occurred in this state: Traceback (most recent call last):
File "/testing/salt/state.py", line 1822, in call
**cdata['kwargs'])
File "/testing/salt/loader.py", line 1727, in wrapper
return f(*args, **kwargs)
File "/testing/salt/states/git.py", line 727, in latest
if head_rev is not None:
UnboundLocalError: local variable 'head_rev' referenced before assignment
```