Commit Graph

71 Commits

Author SHA1 Message Date
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
Dmitry Kuzmenko
5a1bdd368e Py3: minor tests updates
Correct skipping explanation and correctly disable by proper conditions.
BTW, mysql works on Py3. There's a port of python-mysql and test passes.
2017-06-20 16:59:38 +03:00
Marlowe W
d66281bda6 pillar: fix tests 2017-05-26 13:41:21 +08:00
Pedro Algarvio
abe608d739
Drop @patch usage 2017-04-28 13:36:42 +01:00
Pedro Algarvio
61003bca0a
Take care of resource leakage on tests 2017-04-04 18:58:20 +01:00
Pedro Algarvio
8031ac0209
Move mixins to tests.support.mixins.
The adapted config mixin get config methods are not static methods
2017-04-04 17:29:34 +01:00
Pedro Algarvio
a15aa32404
Proper mocking. 2017-04-01 14:22:59 +01:00
Pedro Algarvio
a0245b049f
Proper mocking. 2017-04-01 14:22:59 +01:00
Pedro Algarvio
2dc9e1cfd0
Proper mocking. Py3 Compat. 2017-03-28 19:04:02 +01:00
Pedro Algarvio
d397763553
Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +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
1f7a0aa65b
Proper mocking 2017-03-28 19:00:51 +01:00
Pedro Algarvio
40a64191a1
Absolute imports and A LOT of code cleanup. 2017-03-01 01:33:07 +00:00
Pedro Algarvio
3beb3fb801
Move whatever we need from salttesting to salt.
Let's drop the salttesting dependency cycle.
2017-02-28 22:52:49 +00:00
Pedro Algarvio
15af4c9728
Test filenames conformity. Adjust for pytest. 2017-02-23 23:19:42 +00:00
rallytime
4595f81685 [PY3] Sort return data and mock data for testing stability 2017-02-02 22:56:00 +00:00
Thilo Schmalfuss
dba315c4b6
ext-pillar nodegroups works for all minions now. 2016-12-22 11:57:17 +01:00
Erik Johnson
16453e35f0 Fix legacy git_pillar tests (#35713)
* Add debug logging to legacy git_pillar tests

This is to aid in troubleshooting some failures on the branch builds

* Reverse monkey-patching after test completes

* Fix misspelling in git_pillar unit tests

* Ensure 2nd repo is updated

* Add logging for legacy git_pillar checkout func

* Explicitly set hash_type in opts for git_pillar tests

* Do not use dict.get() to get hash_type

This code is a relic from before we set a default value for this in
salt.config. There is no expectation that this value will be unset, so
there is no need to use dict.get() here.
2016-08-29 14:58:31 -06:00
rallytime
e14c930a74 Fixup errors in pillar consul unittests 2016-08-22 15:35:12 -06:00
Daniel Wallace
d2341654ea [PY3] actually test with nodegroup_comp function 2016-07-20 17:06:35 -05:00
Daniel Wallace
1e3429a3a2 [PY3] skip mysql tests
mysql-python is not compatible with python3 yet.
2016-07-20 17:05:49 -05:00
Dmitry Kuzmenko
17b03e9d8b Allow to blacklist/whitelist renderers. (#33358)
* Allow to blacklist/whitelist renderers.

* Fix tests.

* Unit test for renderer blacklisting.

* Minor tests fixes
2016-05-20 10:41:51 -07:00
Andrew Hammond
bc8f010489 add nodegroups ext_pillar (#33179)
* add nodegroups ext_pillar

* nodegroups ext_pillar documentation tweaks

* put name in AUTHORS rather than directly in module
2016-05-13 08:26:13 -06:00
rallytime
73d73e80c1 Merge branch '2016.3' into 'develop'
Conflicts:
  - doc/topics/releases/2015.8.4.rst
  - doc/topics/releases/2015.8.5.rst
  - doc/topics/thorium/index.rst
  - salt/cloud/clouds/opennebula.py
  - salt/engines/thorium.py
  - salt/loader.py
  - salt/modules/archive.py
  - salt/modules/boto_vpc.py
  - salt/modules/data.py
  - salt/modules/reg.py
  - salt/pillar/mysql.py
  - salt/runners/cache.py
  - salt/states/archive.py
  - salt/states/cron.py
  - salt/states/file.py
  - salt/states/glance.py
  - salt/states/reg.py
  - salt/thorium/__init__.py
  - salt/thorium/check.py
  - salt/thorium/file.py
  - salt/thorium/reg.py
  - salt/utils/jid.py
  - salt/utils/parsers.py
  - setup.py
2016-02-12 14:38:50 -07:00
Colton Myers
076b49a4ca Merge remote-tracking branch 'upstream/2015.8' into merge-forward-2016.3
Conflicts:
    README.rst
    doc/conf.py
    doc/ref/index.rst
    doc/ref/proxy/all/salt.proxy.ssh_sample.rst
    doc/topics/installation/rhel.rst
    doc/topics/releases/2015.8.4.rst
    doc/topics/tutorials/states_pt5.rst
    salt/cloud/clouds/ec2.py
    salt/cloud/clouds/opennebula.py
    salt/config/__init__.py
    salt/modules/boto_dynamodb.py
    salt/modules/boto_ec2.py
    salt/modules/boto_elasticache.py
    salt/modules/boto_elb.py
    salt/modules/boto_iam.py
    salt/modules/boto_rds.py
    salt/modules/boto_sns.py
    salt/modules/boto_sqs.py
    salt/modules/dracr.py
    salt/modules/git.py
    salt/modules/mine.py
    salt/modules/systemd.py
    salt/modules/win_pkg.py
    salt/modules/yumpkg.py
    salt/pillar/__init__.py
    salt/states/git.py
    salt/states/rabbitmq_vhost.py
    salt/states/saltmod.py
    salt/utils/pkg/rpm.py
    setup.py
    tests/unit/modules/systemd_test.py
    tests/unit/states/rabbitmq_vhost_test.py
2016-02-11 22:33:49 -07:00
justinta89
cfc7075c44 Lint and test fixes 2016-02-11 11:22:35 -07:00
justinta89
053ae0cae6 Updated tests to work with code deprecations 2016-02-11 11:22:35 -07:00
Colton Myers
67e17b3022 Revert "Deprecated code removed. " 2016-02-10 11:40:48 -07:00
justinta89
9b1e4b7ad7 Removed test for deprecated mysql_query 2016-02-04 15:33:08 -07:00
justinta89
a678b045e8 mysql pillar deprecated code removed 2016-02-04 15:26:28 -07:00
Benjamin Drung
56ce7479b1 Fix typo catched -> caught 2016-02-04 12:57:20 +01:00
Andrew Colin Kissa
b749b9faba Add Pillar SQLCipher module
Fixes #29781
2015-12-17 09:48:27 +02:00
Erik Johnson
a1ffa0c1c4 More test fixes 2015-07-22 10:40:49 -05:00
Erik Johnson
73192390a2 Test fixes 2015-07-22 00:48:43 -05:00
Brett Mack
6ca1dbd65c Don't split multiline values into a list if wrapped inside "
Use salt.utils.dictupdate to merge dictionaries
2015-06-12 03:46:28 +01:00