Commit Graph

105 Commits

Author SHA1 Message Date
Daniel A. Wozniak
0e61cf39e4
Fix linter errors/warnings 2019-03-04 14:48:33 -07:00
Daniel A. Wozniak
8c641c66fb
make LDAP attr defaults string types on py2 2019-03-04 14:36:14 -07:00
Gareth J. Greenaway
9c04986641
Merge branch '2018.3' into merge-fluorine
Conflicts:
	doc/conf.py
	doc/topics/development/dunder_dictionaries.rst
	salt/client/ssh/ssh_py_shim.py
	salt/grains/core.py
	salt/modules/mysql.py
	salt/modules/state.py
2018-12-20 17:20:42 -08:00
Ch3LL
89b4e096db
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/topics/development/dunder_dictionaries.rst
  - salt/grains/core.py
  - salt/netapi/rest_tornado/saltnado.py
2018-12-14 11:15:48 -05:00
Brandon Ewing
9931a41955
Fix last key detection in pepa key_value_to_tree
pepa.key_value_to_tree only checks the name of the key when attempting
to identify the last key in a flattened key.  This can lead to strange
behavior when the final key name also occurs earlier in the flatkey.

This change explicitly checks that we are the final key in flatkey
prior to setting value.  Test included.

Also see mickep76/pepa#11 and mickep76/pepa#12
2018-12-04 20:35:34 -06:00
rallytime
274697d0b3
Remove the test_saltclass_list_expasion unit test file
The tests contained in this file have been moved to the test_saltclass
unit test file. This is necessary for filename_map to work correctly.
2018-10-29 15:53:11 -04:00
rallytime
96a225d501
Revert "Remove saltclass pillar unit test for list expansion"
This reverts commit 85a9395c2a.
2018-10-29 13:05:09 -04:00
Erik Johnson
80dcb44a0d
Merge remote-tracking branch 'upstream/2018.3' into merge-fluorine
Conflicts:
- salt/utils/mac_utils.py
- tests/unit/config/test_config.py
- tests/unit/loader/test_globals.py
- tests/unit/ssh/test_ssh.py
- tests/unit/templates/test_jinja.py
- tests/unit/utils/vmware/test_host.py
- tests/unit/utils/vmware/test_license.py
2018-08-17 07:52:59 -05:00
Erik Johnson
5a0990b087
Rename pillar unit test modules to reflect naming convention 2018-08-14 13:53:30 -05:00
rallytime
6e6091c3ba
Merge branch '2018.3' into 'fluorine'
Conflicts:
  - tests/integration/runners/test_cache.py
  - tests/support/case.py
2018-08-14 09:57:37 -04:00
rallytime
83a15cb623
Add optimization_order config to mocked opts 2018-08-13 12:06:48 -04:00
Erik Johnson
0441cd56ef
Add optimization_order to mocking 2018-08-08 11:22:52 -05:00
Doug Clow
c7db8523bd
* moved pillar nesting into ext_pillar()
* added test case for pillar key nesting
* added test case for disabling yaml deserialization
2018-07-10 16:42:09 -07:00
Bo Maryniuk
9c73c355ce Fix unit tests 2018-06-27 09:55:13 +02:00
rallytime
b63743346f
Fix bug found by saltclass unit tests
A stacktrace occurs when hitting the pillar line added in #47082 if
`expanded_classes[klass].get('pillars', {})` is executed on an empty
unicode type. This avoids the stacktrace and only tries the dict_merge
if there new pillars are present.
2018-06-19 13:41:05 -04:00
rallytime
f23207002d
Merge branch '2018.3' into 'develop'
Conflicts:
  - salt/states/file.py
  - tests/unit/beacons/test_btmp_beacon.py
  - tests/unit/beacons/test_wtmp_beacon.py
  - tests/unit/grains/test_core.py
2018-06-15 17:00:59 -04:00
Max Arnold
3d4fcbe3aa Add test for issue #48145 2018-06-15 23:48:14 +07:00
Erik Johnson
93ee5ee2b0
Fix all Sphinx warnings
Well, all but one, which we expect to see
2018-05-31 15:28:25 -05:00
Olivier Mauras
27ac59f83c Fix #47634 and refactor variable expansions 2018-05-24 06:50:18 +00:00
rallytime
bd184a257f
Merge branch '2018.3' into 'develop'
Conflicts:
  - tests/unit/grains/test_core.py
2018-05-02 15:28:21 -04:00
rallytime
c7b73d132e
Merge branch '2017.7' into '2018.3'
No conflicts.
2018-04-27 13:45:13 -04:00
rallytime
13e8124031
Merge branch '2017.7' into '2018.3'
Due to the many merge conflicts created from #47106 against the 2017.7 branch
and #46002 against the 2018.3 branch, the changes from #47106 have been largely
removed from this merge forward and the HEAD of 2018.3 was taken.

A separate fix for Tornado 5.0 support will need to be made directly against the
2018.3 branch.

Conflicts:
  - doc/topics/development/conventions/formulas.rst
  - salt/master.py
  - salt/minion.py
  - salt/netapi/rest_tornado/saltnado.py
  - salt/states/zfs.py
  - salt/transport/ipc.py
  - salt/transport/tcp.py
  - salt/transport/zeromq.py
  - salt/utils/async.py
  - tests/support/helpers.py
  - tests/support/parser/cover.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_ssh.py
  - tests/unit/test_minion.py
  - tests/unit/utils/test_safe_walk.py
2018-04-27 13:38:35 -04:00
Daniel A. Wozniak
add78fb618
Fix linter warnings 2018-04-27 09:04:01 -07:00
Daniel A. Wozniak
2644cc7553
Fix linter nits 2018-04-27 01:22:39 -07:00
Daniel A. Wozniak
799c601184
Proper fix for mysql tests 2018-04-27 00:22:50 -07:00
Daniel A. Wozniak
7496f4c5a8
Fix mysql test cases 2018-04-26 15:42:46 -07:00
Maximilian Meister
e83e98d968
fall back to PyMySQL
same is already done in modules (see #26803)

Signed-off-by: Maximilian Meister <mmeister@suse.de>
2018-04-13 09:08:57 +02:00
twangboy
317146537c
Fix paths 2018-01-25 00:43:43 +00:00
Erik Johnson
1dc6e79638
[PY3] Add unicode_literals to ext_pillar modules 2018-01-04 08:46:40 -06:00
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
pjcreath
518e709f35 Merge branch 'develop' into add_file_tree_environments 2017-12-04 11:46:36 -05:00
pjcreath
0e6028e09f Make requested changes, fix inaccurate test description. 2017-12-04 11:35:04 -05:00
pjcreath
4ad01ba739 Fix file_tree py3 incompatibility and update test
The incompatibility was introduced in 2015.8.4, but there wasn't any
test case to catch it.
2017-11-16 10:16:28 -05:00
pjcreath
89a198fe98 salt.pillar.file_tree: add support for environments, add test
This modifies this ext_pillar with basic support for environments
by treating a relative root_dir as relative to the pillar_roots
of the environment specified by pillarenv.

The behavior for absolute paths is unchanged.

Also adds a unit test for file_tree testing both old and new
behavior.

Resolves #44458.
2017-11-15 13:28:14 -05:00
Olivier Mauras
61f30a9d80 Correct when dict is NoneType because of the value doesn't exist
Example:

``` yaml
pillars:
  default:
    commands:
{% if grains['os'] == 'RedHat' %}
      pkg_grains: /usr/bin/rpm_grains
{% endif %}
```

In this case `pkg_grains` wouldn't be found on anything else that RedHat systems and would be NoneType which would return an error and break the module.
2017-11-13 19:49:25 +01:00
Alexandru Bleotu
503cb9c93a pylint 2017-09-28 11:32:03 -04:00
Alexandru Bleotu
8c5b021519 Added * as an include all wildcard in extra_minion_data_in_pillar external pillar (+ test) 2017-09-28 11:32:01 -04:00
Alexandru Bleotu
998c4a95fa Added tests for salt.pillar.extra_minion_data_in_pillar 2017-09-28 09:14:30 -04:00
Olivier Mauras
139e065ce9 New pillar/master_tops saltclass module 2017-09-12 15:53:39 +02:00
Mike Place
bb8bffde1a Merge pull request #42915 from garethgreenaway/missing_minions_branch
Show missing minions in lists & nodegroups
2017-09-11 13:38:55 -06:00
rallytime
c48801095f Remove tests for old git_pillar syntax.
These tests were testing things present in the legacy git pillar syntax
and are no longer needed. The new git pillar syntax has many more integration
tests to cover various cases.
2017-08-23 16:49:58 -04:00
rallytime
5901b10c14 Remove deprecated Legacy Git Pillar code 2017-08-23 16:49:58 -04:00
Gareth J. Greenaway
869599cb42 Updating another test for nodegroups in pillar. 2017-08-15 20:24:40 -07:00
Erik Johnson
3184168365 Use explicit unicode strings + break up salt.utils
This PR is part of what will be an ongoing effort to use explicit
unicode strings in Salt. Because Python 3 does not suport Python 2's raw
unicode string syntax (i.e. `ur'\d+'`), we must use
`salt.utils.locales.sdecode()` to ensure that the raw string is unicode.
However, because of how `salt/utils/__init__.py` has evolved into the
hulking monstrosity it is today, this means importing a large module in
places where it is not needed, which could negatively impact
performance. For this reason, this PR also breaks out some of the
functions from `salt/utils/__init__.py` into new/existing modules under
`salt/utils/`. The long term goal will be that the modules within this
directory do not depend on importing `salt.utils`.

A summary of the changes in this PR is as follows:

* Moves the following functions from `salt.utils` to new locations
  (including a deprecation warning if invoked from `salt.utils`):
  `to_bytes`, `to_str`, `to_unicode`, `str_to_num`, `is_quoted`,
  `dequote`, `is_hex`, `is_bin_str`, `rand_string`,
  `contains_whitespace`, `clean_kwargs`, `invalid_kwargs`, `which`,
  `which_bin`, `path_join`, `shlex_split`, `rand_str`, `is_windows`,
  `is_proxy`, `is_linux`, `is_darwin`, `is_sunos`, `is_smartos`,
  `is_smartos_globalzone`, `is_smartos_zone`, `is_freebsd`, `is_netbsd`,
  `is_openbsd`, `is_aix`
* Moves the functions already deprecated by @rallytime to the bottom of
  `salt/utils/__init__.py` for better organization, so we can keep the
  deprecated ones separate from the ones yet to be deprecated as we
  continue to break up `salt.utils`
* Updates `salt/*.py` and all files under `salt/client/` to use explicit
  unicode string literals.
* Gets rid of implicit imports of `salt.utils` (e.g. `from salt.utils
  import foo` becomes `import salt.utils.foo as foo`).
* Renames the `test.rand_str` function to `test.random_hash` to more
  accurately reflect what it does
* Modifies `salt.utils.stringutils.random()` (née `salt.utils.rand_string()`)
  such that it returns a string matching the passed size. Previously
  this function would get `size` bytes from `os.urandom()`,
  base64-encode it, and return the result, which would in most cases not
  be equal to the passed size.
2017-08-08 13:33:43 -05:00
Erik Johnson
2fb986f5ca Merge pull request #42367 from rallytime/files-util
Move file-related utilities out of init file and into salt.utils.files.py
2017-07-19 16:55:52 -05:00
rallytime
ccf790a83f Update all references for moved functions to use "files" util
- fopen
- flopen
- fpopen
- safe_rm
- is_empty
- is_fcntl_available
2017-07-18 10:31:01 -06:00
rallytime
f59ecb7ffe Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/executors/sudo.py
2017-07-18 08:57:55 -06:00
twangboy
45be32666a Add error-handling function to shutil.rmtree 2017-07-11 13:08:00 -06:00
rallytime
e512a29f08 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/state.py
  - salt/modules/yumpkg.py
  - salt/modules/zypper.py
  - salt/states/pkg.py
  - salt/version.py
  - tests/unit/config/test_config.py
  - tests/unit/modules/test_zypper.py
2017-06-28 11:31:53 -06:00
Dmitry Kuzmenko
ea1a351f5f Code review fixup. 2017-06-20 20:26:58 +03:00