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.
Fixes the test failure happening on the SUSE Leap build in the nitrogen
branch.
Version can be an empty dictionary and pass the check, but then we hit
a key error on the next line. Let's avoid that.
This failure was caused by the changes in #41086.
Fixes https://github.com/saltstack/salt-jenkins/issues/332
We need to mock the calls to `salt.client.get_local_client` in the
tests.unit.test_auth.py file. Without these mocks, there are many tests
that fail when the entire set of unit tests runs. (Specifically, these fail
with both the module and state boto_apigateway unit tests run.)
This mocked patch is similar to the change in PR #41082 and fixes all 16 test
failures reported in https://github.com/saltstack/salt-jenkins/issues/326.
The previous way of calling `str.split(path, '/')` was causing a
TypeError in the test runs of the boto_apigateway state and
module unit tests. Switching this to `path.split('/')` instead
avoids this type of error.
```
Traceback (most recent call last):
File "/testing/tests/unit/states/test_boto_apigateway.py", line 584, in test_present_when_stage_is_to_associate_to_new_deployment
**conn_parameters)
File "/testing/salt/states/boto_apigateway.py", line 310, in present
authorization_type=authorization_type)
File "/testing/salt/states/boto_apigateway.py", line 1660, in deploy_resources
**self._common_aws_args)
File "/testing/salt/modules/boto_apigateway.py", line 358, in create_api_resources
path_parts = str.split(path, '/')
TypeError: descriptor 'split' requires a 'str' object but received a 'unicode'
```
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
```