Commit Graph

56 Commits

Author SHA1 Message Date
Erik Johnson
069102b82d
Rename sentry returner test to match naming convention 2018-08-14 13:53:29 -05:00
rallytime
201031fa8a
Merge branch '2017.7' into '2018.3'
Conflicts:
  - 	doc/man/salt.7
  - 	doc/ref/configuration/minion.rst
  - 	salt/cloud/clouds/ec2.py
  - 	salt/returners/highstate_return.py
  - 	tests/support/gitfs.py
  - 	tests/unit/loader/test_loader.py
2018-08-10 13:12:14 -04:00
Erik Johnson
0441cd56ef
Add optimization_order to mocking 2018-08-08 11:22:52 -05:00
Daniel A. Wozniak
00f04cfd59
Skip test when syslog not available 2018-07-23 23:11:42 -07:00
Ch3LL
d8288a0ffc
add unicode type for syslog test for tag 2018-07-13 12:39:09 -04:00
Ch3LL
17e69382d5
Fix python2 syslog returner expecting string bytes not unicode 2018-07-13 12:35:41 -04:00
rallytime
3273bbdab7
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/ref/configuration/master.rst
  - doc/ref/modules/all/index.rst
  - doc/topics/grains/index.rst
  - doc/topics/releases/2016.3.4.rst
  - doc/topics/spm/spm_formula.rst
  - doc/topics/tutorials/cron.rst
  - doc/topics/tutorials/index.rst
  - doc/topics/tutorials/stormpath.rst
  - salt/engines/slack.py
  - salt/log/handlers/fluent_mod.py
  - salt/modules/cyg.py
  - salt/modules/junos.py
  - salt/modules/namecheap_dns.py
  - salt/modules/namecheap_domains.py
  - salt/modules/namecheap_ns.py
  - salt/modules/namecheap_ssl.py
  - salt/modules/namecheap_users.py
  - salt/modules/reg.py
  - salt/modules/tomcat.py
  - salt/modules/vault.py
  - salt/modules/win_file.py
  - salt/modules/zpool.py
  - salt/output/highstate.py
  - salt/renderers/pass.py
  - salt/runners/cache.py
  - salt/states/boto_apigateway.py
  - salt/states/boto_iam.py
  - salt/states/boto_route53.py
  - salt/states/msteams.py
  - salt/states/reg.py
  - salt/states/win_iis.py
  - tests/integration/modules/test_cmdmod.py
  - tests/integration/states/test_user.py
  - tests/support/helpers.py
  - tests/unit/cloud/clouds/test_openstack.py
  - tests/unit/fileserver/test_gitfs.py
  - tests/unit/modules/test_junos.py
  - tests/unit/pillar/test_git.py
  - tests/unit/states/test_win_path.py
  - tests/unit/test_pillar.py
  - tests/unit/utils/test_format_call.py
  - tests/unit/utils/test_utils.py
  - tests/unit/utils/test_warnings.py
2018-06-01 14:54:12 -04: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
rallytime
d0278345fc
Update old utils paths to new utils paths 2018-03-27 16:45:16 -04:00
rallytime
e312efb5e7
Merge branch '2017.7' into '2018.3'
Conflicts:
  - doc/man/salt-api.1
  - doc/man/salt-call.1
  - doc/man/salt-cloud.1
  - doc/man/salt-cp.1
  - doc/man/salt-key.1
  - doc/man/salt-master.1
  - doc/man/salt-minion.1
  - doc/man/salt-proxy.1
  - doc/man/salt-run.1
  - doc/man/salt-ssh.1
  - doc/man/salt-syndic.1
  - doc/man/salt-unity.1
  - doc/man/salt.1
  - doc/man/salt.7
  - doc/man/spm.1
  - salt/modules/cmdmod.py
  - salt/modules/pillar.py
  - salt/modules/yumpkg.py
  - salt/state.py
  - salt/utils/pkg/rpm.py
  - salt/utils/schedule.py
  - tests/integration/states/test_npm.py
  - tests/integration/states/test_pkgrepo.py
2018-03-27 16:31:55 -04:00
Nicole Thomas
6c80d90bb6
Merge pull request #46693 from dwoz/test_smtp_return
File and Pillar roots are dictionaries
2018-03-26 11:15:37 -04:00
Daniel A. Wozniak
5bf850c67f
File and Pillar roots are dictionaries
Fixes test_smtp_return test cases.
2018-03-23 11:42:14 -07:00
twangboy
8d93156604
Fix unit.returners.test_local_cache for Windows
time.time is only precise to 3 decimal places in Windows. This adds a
sleep for .25 seconds to allow the test to pass
Also fixes a lint error
2018-03-21 16:00:52 +00:00
rallytime
8886b61576
Update old utils paths to new paths 2018-03-15 17:31:29 -04:00
rallytime
8d1e1e7f94
Merge branch '2017.7' into '2018.3'
Conflicts:
  - .kitchen.yml
  - Gemfile
  - pkg/windows/build_env_2.ps1
  - pkg/windows/build_env_3.ps1
  - pkg/windows/req.txt
  - salt/client/ssh/__init__.py
  - salt/client/ssh/ssh_py_shim.py
  - salt/modules/boto_vpc.py
  - salt/modules/file.py
  - salt/modules/heat.py
  - salt/modules/smartos_vmadm.py
  - salt/modules/win_dsc.py
  - salt/returners/elasticsearch_return.py
  - salt/runners/salt.py
  - salt/states/module.py
  - salt/utils/win_functions.py
  - setup.py
  - tests/integration/modules/test_state.py
  - tests/unit/grains/test_core.py
  - tests/unit/test_pillar.py
2018-03-15 17:22:05 -04:00
Daniel Wallace
d18f1a55a7
fix pylint 2018-03-09 08:23:17 -07:00
Daniel Wallace
9e2c3f7991
split return key value correctly 2018-03-08 13:38:52 -07:00
Ch3LL
280dc9a2b6
Mock file_client call in smtp return test 2018-02-27 16:36:38 -05:00
twangboy
e137775c1f
Fix race condition in Windows with the creation time 2018-01-12 16:22:35 -07:00
Erik Johnson
c65d4714e5
[PY3] Add unicode_literals to renderers and returners 2017-12-15 00:17:26 -06:00
Nicole Thomas
b0008b8ec3
Merge branch 'develop' into sentry_return 2017-12-05 14:48:58 -05:00
rrroo
e3897e4820 Use assertEqual 2017-11-22 16:35:38 +01:00
Roald Nefs
ac1a4d0817
Updated Telegram returner test
- Removed trailing newlines
2017-11-20 10:41:08 +01:00
Roald Nefs
47147e2769
Added new Telegram module
Added a new Telegram module, which allows to send a message via Telegram
using the Telegram Bot API. The commit also includes:
- Update for the Telegram returner (merged in #44148); the Telegram
returner now fully utilizes the Telegram module.
- Update to the documentation in order to add the Telegram module to the
list list of all modules.
- Updated Telegram returner test.
- New Telegram module test.
2017-11-20 08:47:57 +01:00
rrroo
f10d04c8af Add unittest for sentry_return
Move functions to top level to improve testability.
2017-11-15 16:06:56 +01:00
Roald Nefs
f430e1e33c
Added simple test for Telegram returner 2017-10-20 20:55:54 +02:00
Eric Radman
617c5b72ac Fix DeprecationWarning for use of 'salt.utils.is_windows' 2017-09-26 15:13:18 -04:00
rallytime
bfcfcd75e8 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/fileclient.py
  - salt/loader.py
  - salt/minion.py
  - salt/modules/alternatives.py
  - salt/modules/genesis.py
  - tests/unit/modules/test_hosts.py
  - tests/unit/modules/test_ini_manage.py
2017-09-13 15:15:04 -04: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
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
twangboy
9b61533b09 Get more accurate currnet time in local_cache 2017-07-05 12:19:20 -06:00
twangboy
844e3f65bc Fix unit tests for Windows 2017-07-05 12:03:13 -06:00
Pedro Algarvio
abe608d739
Drop @patch usage 2017-04-28 13:36:42 +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
e2a5b1bf54
Use a temporary configuration instead 2017-04-01 18:56:46 +01:00
Pedro Algarvio
d05028e88c
These are not integration tests 2017-04-01 14:22:51 +01:00
Pedro Algarvio
8560d8a6d3
Proper mocking. Tests are not destructive. 2017-03-28 19:04:03 +01:00
Pedro Algarvio
d397763553
Adjust to the new LoaderModuleMockMixin usage 2017-03-28 19:03:59 +01:00
Pedro Algarvio
e7768705f9
Allow passing different loader_module_globals per loader_module 2017-03-28 19:02:51 +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
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
Nicole Thomas
336fbb03bc [develop] Merge forward from 2016.3 to develop (#33408)
* Fix master hanging after a request from minion with removed key. (#33333)

* ZMQ monitor for MWorker connections.

* Reauth minion if the key was removed on the master side.

* Allow concurrency mode in state runs if using sudo (#33325)

Closes #30130

* Disambiguate non-exact matches when checking if sysv service is enabled (#33324)

Fixes #33323

* remove redundant, incorrect sudo_runas config documentation (#33318)

* remove sudo_runas documentation

`sudo_runas` was renamed to `sudo_user` and the documentation was not
updated accordingly.

* conf/minion: update sudo_user description

The description from sudo_runas was better.

* import ps from psutil_compat in beacons (#33334)

* beacons.network_info: import gate psutil

* beacons.ps: import gate psutil

* Add docs for mine_functions config var (#33326)

* Add docs for mine_functions config var

* Note that mine_enabled essentially just doesn't add the mine
update function to the scheduler.

* Bp 28467 calm mine (#33327)

* make minion mine update behavior more configurable

* Add docs for mine_functions config var

* Remove config dup from mine config options

Refs #28467

* 2015.8 does not have _DFLT_MULTIPROCESSING_MODE

* This won't be in until 2015.8.10.

* Fix network.managed for windows (#33312)

* Fix some link errors in the test writing tutorial (#33347)

* Describes parameters in register_instances function (#33339)

* Fix UnboundLocalError in git.latest (#33340)

Resolves #32260.

* Expanded documentation for boto_elb state and module (#33341)

* Describes what happens when the CNAME parameter is given.

* Describes what the recognized attributes are for for ELBs.

* Properly detect newer Linux Mint distros (#33359)

* Properly detect newer Linux Mint distros

LMDE 2 and Linux Mint 17.3 changed the DISTRIB_ID in /etc/lsb-release to
``LinuxMint``, breaking OS detection for these distros.

This commit fixes that by adding an entry to the OS_NAME_MAP in the core
grains.

* Remove LinuxMint os_family from aptpkg.py

It is no longer necessary as the distro is now detected properly, which
will lead to an os_family of Debian.

* Update job_cache and keep_jobs docs to be more specific to their behavior (#33328)

* Update job_cache and keep_jobs docs to be more specific to their behavior

Also fixed a bug discovered when investigating job_cache/keep_jobs functionality
where the jid directory and files were removed by the cache cleaner, but not the
original jid clash detection directory created in /var/cache/salt/master/jobs/.

Fixes #29286

* Add testcase for the changes in the local_cache.clean_old_jobs func

* Mark tests as destructive

* Put destructive test decorator in correct location

* Remove mentions of windows not supporting pkgs param (#33361)

Fixes #33313

* Updates docs version to 2015.8.9
Adds note regarding the os grain on Mint Linux
Adds an FAQ regarding grains that change due to upstream changes

* revved 2015.8 branch to .9 in version selector

* Add initscripts, SystemD service units and environment files for Debian (#32857)

* Add note to docs about api settings for Hipchat API v2 (#33365)

Fixes #27779

* Add win_pkg to list of modules that support "version" in pkg.installed (#33362)

Fixes #32913

* Add note about name parameter in git_pillar docs (#33369)

Fixes #27737

* Better YAML syntax error handling (#33375)

Closes #26574

* Improve doc clarity for disable_modules documentation (#33379)

* Improve doc clarity for disable_modules documentation

* Additional clarification on blacklisted name

* maintain the fallabck because I am totally sick of this crap

* blast, put the try/except int he right place

* restore whitespace

* Fix traceback in logging for config validation (#33386)

* 2015.8.10 release notes

* Sync pillarstack to latest upstream version (#33391)

* Don't lay down all available opts (#33385)

* Don't lay down all available opts

* We need at least one opt in there

* Condense defaults

* Put the default hash type back
2016-05-20 13:48:40 -07: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
Erik Johnson
855bed36c1 Check rendered YAML for invalid keys (#33213)
* Check rendered YAML for invalid keys

PyYAML will for some reason allow improper YAML, specifically double
curly-braces like ``{{ }}``, to be formed into an unhashable dict (that
is, one with a dict as a key). This commit will change the YAML renderer
such that the rendered data is recursively checked for keys that are
dicts, and raises an SaltRenderError if such a key is encountered.

Resolves #33073.

* Fix smtp returner test

This test was using jinja placeholders but was not passing the template
through the jinja renderer. This commit adds the use of the jinja
renderer to this test to fix the failure caused by the addition of
verification of the loaded YAML inthe previous commit.
2016-05-13 09:22:43 -07:00
Justin Findlay
0d8f865c9f update smtp returner unit tests 2015-05-11 00:23:28 -06:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Gareth J. Greenaway
c87d91ee82 Consolidating the _get_options function from all the returners that were using it into the config module. Additionally some cleanup and ability to pass defaults to the get_returner_options function.
fixing lint issues

moving the get_options function into a utils.py under returners.  previous attempt at using a call to the salt config module doesn't work if the returner is called from the scheduler.

adding missing docstring

Unit tests were failing for SMTP returner because __opts__ was not available.  Ensuring it's available, empty, if it doesn't already exist.

removing the check and population with an empty dict for __salt__ and __opts__.  Adding an empty __opts__ to the smtp returner unit tests.
2014-09-03 13:56:48 -07:00
Mike Place
11e6ddf33c Fix SMTP test
Magic or ugly hack? You decide.
2014-05-29 16:38:59 -06:00