Commit Graph

80215 Commits

Author SHA1 Message Date
Pedro Algarvio
e7768705f9
Allow passing different loader_module_globals per loader_module 2017-03-28 19:02:51 +01:00
Pedro Algarvio
93ad2cc428
Proper mocking. Code is mocked! Runs on non windows too. 2017-03-28 19:02:51 +01:00
Pedro Algarvio
5c13f7b2bb
Proper mocking. 2017-03-28 19:02:50 +01:00
Pedro Algarvio
cb532fb9ef
Code cleanup. Proper mocking. 2017-03-28 19:02:50 +01:00
Pedro Algarvio
f23596cbd1
Proper mocking. Py3 Compat. 2017-03-28 19:02:50 +01:00
Pedro Algarvio
9b1e55aa85
Import the full module namespace to avoid import shadowing.
https://github.com/saltstack/salt/pull/39996#issuecomment-287857698
2017-03-28 19:02:47 +01:00
Pedro Algarvio
ff8cb0455f
Account for a timeout when resolving the future 2017-03-28 19:00:54 +01:00
Pedro Algarvio
f2b51cc22f
Always decode the response body to unicode 2017-03-28 19:00:53 +01:00
Pedro Algarvio
276f2dbb5f
More salt.loader import fixes 2017-03-28 19:00:53 +01:00
Pedro Algarvio
8325a58a35
Proper mocking but I'm lost as to what is actually being tests here 2017-03-28 19:00:53 +01:00
Pedro Algarvio
eaddf737f3
Add missing import and solve cycle import error. 2017-03-28 19:00:53 +01:00
Pedro Algarvio
a894eebf31
Code cleanup. Proper mocking!!! 2017-03-28 19:00:53 +01:00
Pedro Algarvio
5216ff0932
Code cleanup. Proper mocking 2017-03-28 19:00:52 +01:00
Pedro Algarvio
278275cf37
Fix StringVersion and LooseVersion. Add unit tests. 2017-03-28 19:00:52 +01:00
Pedro Algarvio
ea81540cce
Code cleanup. Proper mocking. 2017-03-28 19:00:52 +01:00
Pedro Algarvio
fb9c15ad07
Proper mocking. Code cleanup. 2017-03-28 19:00:52 +01:00
Pedro Algarvio
ccea1fb6a4
Proper mocking. Removed destructive tests decorator.
Creating or deleting files under a temporary directory does not apply as
a destructive test
2017-03-28 19:00:52 +01:00
Pedro Algarvio
30f62f22ec
Simplify the mock mixin required work
This approach does not require the user to call `super().setUp()`
2017-03-28 19:00:51 +01:00
Pedro Algarvio
1f7a0aa65b
Proper mocking 2017-03-28 19:00:51 +01:00
Pedro Algarvio
87e9f5e676
Mock patching. The right way. 2017-03-28 19:00:51 +01:00
Pedro Algarvio
b25b26e23d
Cleanup test attributes once finished 2017-03-28 19:00:51 +01:00
Pedro Algarvio
6f79dd6af3
Not an integration test 2017-03-28 19:00:51 +01:00
Pedro Algarvio
9731451a58
Use tests.support.unit instead 2017-03-28 19:00:50 +01:00
Pedro Algarvio
993c488ea7
Cleanup attributes 2017-03-28 19:00:50 +01:00
Pedro Algarvio
6b22c6419f
Fixed tests not written for py3
The tests happened to work because py2 does not default to absolute
imports, contrary to py3.
Additionally, with py3 absolute imports we must remove imported libs
from `sys.modules`(not salt loader modules)
2017-03-28 19:00:50 +01:00
Pedro Algarvio
7219a35656
These are not integration tests 2017-03-28 19:00:50 +01:00
Mike Place
9d11993f38 Merge pull request #40263 from deuscapturus/boto_elbv2
Add boto_elbv2 states and modules for de/registering targets and chec…
2017-03-28 11:15:38 -06:00
Mike Place
ebb925c843 Merge pull request #40359 from sergeizv/prevent-unbound-local-error
Fix potential unbound local error
2017-03-28 11:12:07 -06:00
Mike Place
d7e745a53a Merge pull request #40281 from terminalmage/rename-docker
Rename docker execution module to avoid shadowing in the loader
2017-03-28 11:06:08 -06:00
Mike Place
08d18152ba Merge pull request #40358 from mirceaulinic/patch-7
Add conf_proxy cross reference
2017-03-28 11:05:24 -06:00
Mike Place
d8cabca9a6 Merge pull request #40349 from ferringb/develop
ticket #40348: fix pillar include key nested support
2017-03-28 11:04:19 -06:00
rallytime
4f1543c2a1 Merge branch '2016.3' into '2016.11'
No conflicts.
2017-03-28 10:29:41 -06:00
Mike Place
b6032215e9 Merge pull request #40299 from amendlik/saltify-authtest
Saltify authtest
2017-03-28 10:17:02 -06:00
Mike Place
2d2cb5b837 Merge pull request #40333 from gtmanfred/2016.11
fix some test=True comments
2017-03-28 10:11:00 -06:00
Erik Johnson
774a3f1147 Rename docker execution module to avoid shadowing in the loader
With the merging of #39996, salt/modules/docker.py now imports
salt.utils.docker. However, our loader appends the module dir (in
this case salt/modules/) to sys.path temporarily for the length of the
loading process. So, as the docker execution module tries to import
salt.utils.docker, when salt.utils.docker attempts to do an "import
docker", and docker-py is *not* installed, this results in
salt/modules/docker.py (the docker execution module) being loaded in its
place, which results in tracebacks in the minion log.

Renaming the docker execution module keeps this import shadowing from
occurring. Note that we don't need to do this for the placeholder
salt/states/docker.py as it does not import salt.utils.docker.
2017-03-28 10:50:47 -05:00
Sergei Zviagintsev
25bdc70b2b Fix potential unbound local error
If the condition is false, the 'state' var will not be defined and
referencing it in the subsequent code will produce UnboundLocalError.
Use dict.get() to initialize the 'state' variable.
2017-03-28 17:31:26 +02:00
Mircea Ulinic
240178d241 Add conf_proxy cross reference 2017-03-28 18:24:02 +03:00
Mike Place
9187df8a33 Merge pull request #40222 from cloudflare/terms-list
Many improvements and changes for the netacl modules
2017-03-28 09:10:27 -06:00
zer0def
d68067f1d7 Merge remote-tracking branch 'main/2016.11' into pip-cache-fixes 2017-03-28 16:39:19 +02:00
Sergei Zviagintsev
b0ee554b8b Rename HAS_WIN32 to HAS_WIN_FUNCTIONS in salt/utils/__init__.py
If HAS_WIN32 is True that only means that the import of
salt.utils.win_functions succeeded. To ensure that required win libs are
available one has to check salt.utils.win_functions.HAS_WIN32 instead.
For instance, HAS_WIN32 is True even on POSIX:

    (py2-env) salt-test@tommynaut:~> uname -a
    Linux tommynaut 4.9.11-1-default #1 SMP PREEMPT Sat Feb 18 17:59:27 UTC 2017 (cf9c670) x86_64 x86_64 x86_64 GNU/Linux
    (py2-env) salt-test@tommynaut:~> python
    Python 2.7.13 (default, Jan 03 2017, 17:41:54) [GCC] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import salt.utils
    >>> salt.utils.HAS_WIN32
    True

Rename HAS_WIN32 to HAS_WIN_FUNCTIONS to reflect that.
2017-03-28 14:56:17 +02:00
Sergei Zviagintsev
e7f59dda7b Check salt.utils.win_functions.HAS_WIN32 in salt.utils.get_user
Commit f3b010ebe5 ("Fix imports") fixed an import issue introduced in
commit 96afc0b6cf ("fix: no more test against SYSTEM user") by
removing salt.utils.win_functions.HAS_WIN32 check from
salt/utils/__init__.py and setting HAS_WIN32 to True if
salt.utils.win_functions was successfully imported. However,
salt.utils.win_functions doesn't raise ImportError if required libs
aren't available but sets salt.utils.win_functions.HAS_WIN32 to False in
such a case.

So after commit f3b010ebe5 ("Fix imports") salt.utils.HAS_WIN32 is
always true:

    (py2-env) salt-test@tommynaut:~> uname -a
    Linux tommynaut 4.9.11-1-default #1 SMP PREEMPT Sat Feb 18 17:59:27 UTC 2017 (cf9c670) x86_64 x86_64 x86_64 GNU/Linux
    (py2-env) salt-test@tommynaut:~> python
    Python 2.7.13 (default, Jan 03 2017, 17:41:54) [GCC] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import salt.utils
    >>> salt.utils.HAS_WIN32
    True

salt.utils.get_user thus calls salt.utils.win_functions.get_current_user
without ensuring that all required libs were imported.

Explicitly check salt.utils.win_functions.HAS_WIN32 in get_user(), so it
properly raises CommandExecutionError if required libs aren't available.
2017-03-28 14:50:56 +02:00
zer0def
4f23a23ca8 Fixed the test_install_download_cache_argument_in_resulting_command to accomodate introduced cache directory argument fixes and renamed it to test_install_download_cache_dir_arguments_in_resulting_command. 2017-03-28 11:53:54 +02:00
zer0def
9d0f94eeba Fixed unnecessary API changes introduced with suggested changes. 2017-03-28 10:45:04 +02:00
Theodore Cowan
5dfcb853ce make error message useful for boto_elbv2.target_group_exists 2017-03-27 23:13:27 -06:00
Nicole Thomas
863a9b96fb Merge pull request #40302 from cloudflare/nitorgen-doc
Add NAPALM section in Nitrogen release notes
2017-03-27 20:45:46 -06:00
Nicole Thomas
bb37f133fc Merge pull request #40347 from rallytime/merge-2016.11
[2016.11] Merge forward from 2016.3 to 2016.11
2017-03-27 20:39:30 -06:00
Adam Mendlik
6c6e8d17bc Update unit test for Saltify with credential verification 2017-03-27 19:20:38 -06:00
Adam Mendlik
f1c5991971 Add documentation for saltify credential verification mode 2017-03-27 18:41:38 -06:00
Adam Mendlik
1f9f0e47f7 Allow saltify cloud provider to verify credentials
When deploy=False in the cloud configuration, saltify will
attempt to log on to the system and return True on success,
False on failure.
2017-03-27 18:41:38 -06:00
Mike Place
75565df5da Merge pull request #39884 from Juniper/develop
unit tests for junos specific code
2017-03-27 18:35:58 -06:00