Commit Graph

6281 Commits

Author SHA1 Message Date
Daniel A. Wozniak
18b1730320
Skip test that requires pywin32 on *nix platforms 2018-03-27 11:38:20 -07:00
Daniel A. Wozniak
45dce1a485
Add reg module to globals 2018-03-26 12:00:39 -07:00
Daniel A. Wozniak
73d06f664b Fix linter error 2018-03-22 13:47:41 -07:00
Daniel A. Wozniak
009a8f56ea
Fix up environ state tests for Windows 2018-03-22 11:31:25 -07:00
Daniel A. Wozniak
b4be10b8fc
Fixing cleanUp method to restore environment
The clean-up method was not reliabliy restoring sys.environment on
windows. Using Mock's patch to cleanup more reliably.
2018-03-21 20:01:30 -07:00
Nicole Thomas
b7191b8782
Merge pull request #46413 from meaksh/2017.7-explore-result-in-depth
Explore 'module.run' state module output in depth to catch "result" properly
2018-03-12 14:49:06 -04:00
Nicole Thomas
cac096b311
Merge pull request #46434 from gtmanfred/highstate_return
split return key value correctly
2018-03-09 12:45:20 -05:00
Daniel Wallace
d18f1a55a7
fix pylint 2018-03-09 08:23:17 -07:00
Nicole Thomas
a188984cd9
Merge pull request #46446 from bdrung/fix-typos
Fix various typos
2018-03-08 16:11:46 -05:00
Daniel Wallace
9e2c3f7991
split return key value correctly 2018-03-08 13:38:52 -07:00
Nicole Thomas
e35fc5263c
Merge pull request #46309 from bdrung/dynamic-pillarenv
Support dynamic pillar_root environment
2018-03-08 14:15:35 -05:00
Nicole Thomas
35fe9827fe
Merge pull request #46430 from terminalmage/issue44032
Improve reliability/idempotence of file.blockreplace state
2018-03-08 10:41:37 -05:00
Benjamin Drung
a3c54b50f6 Fix various spelling mistakes
lintian found various spelling mistakes.

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-03-08 15:25:42 +01:00
Benjamin Drung
584b451fd1 Support dynamic pillar_root environment
Allow users to specify a __env__ pillar_root directory that applies
equally to all environments that are not explicitly specified.

fixes #20581
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-03-08 10:12:40 +01:00
Erik Johnson
f9f187e915
Improve reliability/idempotence of file.blockreplace state
This makes the following changes:

- The `append_newline` argument to the `file.blockreplace`
  remote-execution function has been modified so that if its value is
  `None`, it only appends a newline when the content block does not end
  in one.
- A couple of fixes were made to newline handling. The existing code
  normalized the newlines in the content block, replacing them with
  os.linesep. However, when the file contains newlines that don't match
  the OS (i.e. POSIX newlines in a file on a Windows box, or Windows
  newlines on a Linux/Mac/BSD/etc. box), then we would still end up with
  mixed newlines. The line separator is now detected when we read in the
  original file, and the detected line separator is used when writing
  the content block. Additionally, the same newline mismatch was
  possible when appending/prepending the content block. This has been
  fixed by using a common function for appending, prepending, and
  replacing the content block.
- Support for the `append_newline` argument has been added to the
  `file.blockreplace` state. The default value for the state is `None`.
  A `versionchanged` has been added to the remote execution function to
  let users know that the Fluorine release will change the default value
  of that variable.
- 20 new integration tests have been written to test the
  `file.blockreplace` state.
2018-03-07 22:29:39 -06:00
Pablo Suárez Hernández
885751634e
Add new unit test to check state.apply within module.run 2018-03-07 15:43:52 +00:00
Justin Findlay
d5561bedaf
tests.unit.grains.core add scoped IPv6 nameserver 2018-03-05 12:31:04 -08:00
Nicole Thomas
a8f2f1b063
Merge pull request #46322 from terminalmage/issue44935
yamlify_arg: don't treat leading dashes as lists
2018-03-05 10:40:16 -05:00
Nicole Thomas
88b5f7383d
Merge pull request #46242 from redbaron4/fix-46127
Pass env_vars to pip.freeze
2018-03-05 09:53:12 -05:00
Erik Johnson
85ac6a9893
yamlify_arg: don't treat leading dashes as lists
We had a similar check to ensure "foo: bar" isn't loaded as a dict, this
adds a check to ensure that we only load lists when there is a leading
bracket.
2018-03-03 15:02:12 -06:00
Nicole Thomas
c490a50452
Merge pull request #45874 from GwiYeong/2017.7-local-client-hotfix
fix for local client timeout bug
2018-03-01 14:39:35 -05:00
Dheeraj
727ebe1056
Merge branch '2017.7' into fix-46127 2018-03-01 10:19:38 +05:30
Nicole Thomas
da60399b8f
Merge pull request #46183 from oeuftete/fix-docker-container-running-host-config-ulimits
Fix docker_container.running HostConfig Ulimits comparison
2018-02-28 17:22:11 -05:00
Nicole Thomas
a97a3e6fb0
Merge pull request #46101 from jfindlay/openrc_ret
In OpenRC exec module, make sure to ignore retcode on status
2018-02-28 15:01:36 -05:00
Dheeraj Gupta
aa9d709015 Pass env_vars to pip.freeze
pip.installed state calls pip.freeze to check for existing installation
and to verify installation post-install. This patch propagates the
env_vars passed to pip.installed to the pip.freeze function. It also modifies
existing pip unit tests to test new functionality and adds an integration test
that verifies the expected correct behavior

Fixes #46127
2018-02-28 16:44:20 +05:30
Erik Johnson
586d8b0dcf
archive.extracted: don't check source file when if_missing path exists
This exits the state early with a True result when the if_missing path
exists.
2018-02-27 23:39:32 -06:00
Ken Crowell
5b09644429
Sort lists from Ulimits before comparing 2018-02-27 23:49:05 -04:00
Benjamin Drung
0b445f2a37 tests: Add unit tests for _parse_os_release()
Add tests cases to fully cover _parse_os_release().

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:38:23 +01:00
Benjamin Drung
f6069b77ed Fix osfinger grain on Debian
Rework _run_os_grains_tests() to check all os grains including osfinger.
Fix osfinger on Debian (e.g. use "Debian-9" instead of
"Debian GNU/Linux-9").

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
8dde55a761 tests: Add os_grains test cases for Debian
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
ff02ab9937 tests: Add Ubuntu 17.10 (artful) os_grains test case
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
77d5356aba Fix incorrect oscodename grain on Ubuntu
Use the full content of /etc/os-release for the Ubuntu 16.04 (artful)
os_grains test case. This reveals a bug that 'oscodename' is not
correctly calculated if /etc/os-release provides PRETTY_NAME:

FAIL: test_ubuntu_os_grains (tests.unit.grains.test_core.CoreGrainsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests/unit/grains/test_core.py", line 439, in test_ubuntu_os_grains
    self._run_ubuntu_os_grains_tests(_os_release_map)
  File "tests/unit/grains/test_core.py", line 446, in _run_ubuntu_os_grains_tests
    self._run_os_grains_tests(os_release_map)
  File "tests/unit/grains/test_core.py", line 262, in _run_os_grains_tests
    self.assertEqual(os_grains.get('oscodename'), os_release_map['oscodename'])
AssertionError: 'Ubuntu 16.04.3 LTS' != 'xenial'
- Ubuntu 16.04.3 LTS
+ xenial

fixes #34423 for Ubuntu
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
7e62dc9fd2 tests: Support reading os-release files from disk
Instead of storing pre-parsed os-release files, add support for reading
os-release files from disk.

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
a92ec0db1b Make _parse_os_release() always callable
To simplify running unit tests against os_data(), make the
_parse_os_release() function always callable to avoid needing to mock
os.path.isfile().

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
eee1fe5b38 tests: Dissolve _run_ubuntu_os_grains_tests
_run_ubuntu_os_grains_tests is only used once and does not provide any
useful abstraction since the introduction of _run_os_grains_tests.

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Benjamin Drung
1d6ef731fe tests: Deduplicate _run_os_grains_tests()
_run_suse_os_grains_tests() and _run_ubuntu_os_grains_tests() share most
of their logic. Combine the common part in _run_os_grains_tests() and
let the remaining small parts live in their origin functions.

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-26 13:36:33 +01:00
Nicole Thomas
705caa8cca
Merge pull request #46148 from rallytime/merge-2017.7
[2017.7] Merge forward from 2017.7.3 to 2017.7
2018-02-23 14:21:38 -05:00
rallytime
25deebf7a6
Merge branch '2017.7.3' into '2017.7'
Conflicts:
  - salt/modules/git.py
2018-02-22 10:22:22 -05:00
Erik Johnson
e2c4702e0c
Update tests to reflect changes to the SaltCacheLoader 2018-02-21 23:20:02 -06:00
Nicole Thomas
b92346645b
Merge pull request #46107 from amendlik/yumpkg-assumeyes
Add --assumeyes on YUM/DNF commands
2018-02-20 17:52:05 -05:00
Adam Mendlik
8d9a432fb2
Add --assumeyes to yum/dnf commands in yumpkg.refresh_db
Without --assumeyes, these commands can hang waiting for
user confirmation if there is an unaccepted repository key.
2018-02-19 17:51:11 -07:00
Justin Findlay
2eef3c65a6
tests.unit.modules.gentoo_service add retcode arg 2018-02-19 11:27:11 -08:00
Benjamin Drung
dd3f936557 Fix skipping Kubernetes tests if client is not installed
When the Kubernetes client is not installed, the import of
salt.modules.kubernetes will still succeed, but HAS_LIBS will be set to
False (since the library import will be covered by a try-except clause).

Therefore expect the salt.modules.kubernetes to always succeed and check
kubernetes.HAS_LIBS instead for the presence of the kubernetes library.

Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
2018-02-19 12:32:14 +01:00
Erik Johnson
e2140d9a84
Mock the ssh.key_is_encrypted utils func 2018-02-15 14:37:50 -06:00
Nicole Thomas
edcb64de76
Merge pull request #45763 from twangboy/win_fix_path_rehash
Fix rehash function in win_path.py
2018-02-15 15:05:15 -05:00
Erik Johnson
f2b69f703d
git.latest: Fix regression with identity file usage
Unit test included
2018-02-15 09:35:10 -06:00
Nicole Thomas
a1f4092811
Merge pull request #46015 from rallytime/bp-45785
Back-port #45785 to 2017.7
2018-02-14 13:16:08 -05:00
Nicole Thomas
1279924f5f
Merge pull request #45991 from terminalmage/fix-duplicate-extra-opts
yumpkg: Fix a couple issues with _get_extra_opts
2018-02-14 11:48:28 -05:00
Erik Johnson
916766f651
yumpkg: Fix a couple issues with _get_extra_opts
`_get_extra_opts()` and `_get_branch_option()` were unnecessarily
quoting the value, causing it to be interpreted as a literal quote by
`subprocess.Popen()`.

Also, because there were separate helpers for repo options,
disableexcludes, branch options, and extra options, and specifically
because `_get_extra_opts()` parses *all* kwargs, any of the options from
the other helper funcs would end up being added to the command line
twice if `_get_extra_opts()` was used.

This commit consolidates all of the kwarg inspection and CLI opts
construction to a single helper function. It also adds unit tests to
make sure that we are formatting our commands properly.

Additionally, it makes a minor fix in `refresh_db()` which was not
accounted for when we changed the osmajorrelease grain to an integer in
2017.7.0.
2018-02-13 22:46:27 -06:00
Ollie Armstrong
ef6ffb1492
Resolve linting errors 2018-02-13 13:27:38 -05:00