Commit Graph

551 Commits

Author SHA1 Message Date
Daniel Wallace
9ce14b2a12
pass opts to SSHClient for enable_ssh_minions
Also, use ckminions to get the minions from the roster, instead of doing it in
publish.
2018-02-20 16:06:00 -07:00
twangboy
cf1007bfc8
Fix stacktrace at the end of a test 2018-01-25 18:45:43 +00:00
Daniel Wallace
065ae4e61f
increase timeout for starting daemons 2018-01-11 10:45:47 -07: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
Erik Johnson
7b13a7df8b
Replace json module usage with a helper to ensure unicode content is handled properly
This adds wrappers for json.dump{,s} which disable `ensure_ascii` by
default.
2017-12-27 09:30:58 -06:00
rallytime
08c71f13e4
Merge branch '2017.7' into 'oxygen'
Conflicts:
  - doc/ref/configuration/minion.rst
  - doc/topics/thorium/index.rst
  - salt/beacons/__init__.py
  - salt/client/mixins.py
  - salt/client/ssh/wrapper/state.py
  - salt/daemons/masterapi.py
  - salt/grains/extra.py
  - salt/minion.py
  - salt/modules/cron.py
  - salt/modules/file.py
  - salt/modules/mac_user.py
  - salt/modules/napalm_network.py
  - salt/modules/state.py
  - salt/modules/win_file.py
  - salt/modules/win_pkg.py
  - salt/proxy/dummy.py
  - salt/state.py
  - salt/states/file.py
  - salt/states/lxc.py
  - salt/utils/__init__.py
  - salt/utils/schedule.py
  - tests/integration/modules/test_file.py
  - tests/integration/modules/test_groupadd.py
  - tests/integration/ssh/test_state.py
  - tests/integration/states/test_file.py
  - tests/unit/daemons/test_masterapi.py
  - tests/unit/grains/test_core.py
  - tests/unit/modules/test_disk.py
  - tests/unit/modules/test_napalm_network.py
  - tests/unit/modules/test_state.py
  - tests/unit/test_minion.py
  - tests/unit/utils/test_process.py
2017-12-11 18:24:41 -05:00
Nicole Thomas
0697ed0645
Merge branch 'develop' into accept-minions-from-grains 2017-12-04 16:10:32 -05:00
Ch3LL
9cc853e3d5
Add masterless state.highstate integration test 2017-11-29 10:15:56 -05:00
Ch3LL
b3b5ecc6ff
Add pillar.items test for masterless 2017-11-22 15:40:57 -05:00
rallytime
052b13c98e
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/cli/daemons.py
  - salt/client/ssh/__init__.py
  - salt/modules/win_pkg.py
  - salt/netapi/rest_cherrypy/app.py
  - salt/proxy/fx2.py
  - salt/utils/__init__.py
  - salt/utils/jinja.py
  - salt/utils/napalm.py
  - salt/utils/path.py
  - salt/utils/verify.py
  - tests/integration/modules/test_saltutil.py
  - tests/integration/states/test_service.py
  - tests/unit/utils/test_verify.py
2017-11-22 12:36:03 -05:00
twangboy
47114fdb30
Pass root_dirs to the win_verify_env function
Remove while loop that was hanging when `salt` wasn't in the path
Add salt.util.path.safe_path function to check for unsafe paths
Pass root_dir to all calls to `verify_env`
2017-11-13 13:05:23 -07:00
Mike Place
f2aa3539ef
Merge branch 'develop' into accept-minions-from-grains 2017-11-13 11:13:50 -07:00
rallytime
2c052e34b3
Merge branch '2017.7' into 'develop'
Conflicts:
  - .gitignore
  - salt/modules/win_lgpo.py
  - salt/utils/__init__.py
  - tests/integration/spm/test_build.py
  - tests/unit/test_pydsl.py
2017-11-05 20:28:51 -07:00
Benedikt Werner
c7ee766984
Fix test autosign_file permissions 2017-10-29 14:02:39 +01:00
Benedikt Werner
64e30ac0b2
Changed integration tests to use autosign_file to authenticate minions 2017-10-29 14:02:38 +01:00
Ch3LL
34e2955445
add saltutil.refresh_pillar test 2017-10-25 15:56:49 -04:00
Erik Johnson
554c685ce5
Move 4 functions from salt.utils
- salt.utils.reinit_crypto -> salt.utils.crypt.reinit_crypto
- salt.utils.appendproctitle -> salt.utils.process.appendproctitle
- salt.utils.daemonize -> salt.utils.process.daemonize
- salt.utils.daemonize_if -> salt.utils.process.daemonize_if
2017-10-11 14:49:50 -05:00
rallytime
29a763ffcb Lint: Remove extra space 2017-08-30 09:38:39 -04:00
rallytime
26f52bd2b8 Move get_colors and get_color_theme to salt.utils.color.py
Moves the `get_colors` and `get_color_theme` out of `salt.utils.py`
and into a new file named `salt.utils.color.py`.

This PR moves the original functions, adds a deprecation warning to
the old function paths, and updates any references to the functions
in Salt code to the new location. This includes moving a test as well.
2017-08-29 17:33:01 -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
C. R. Oldham
4540f82aaa Port salt-proxy tests to the testsuite changes in Nitrogen. 2017-06-06 13:49:16 -06:00
Erik Johnson
3751881f07 Remove iproute/ifconfig warning from test suite startup
Recent changes in the test suite no longer rely on listing IPv4
addresses to confirm that the daemons have started, so this warning is
now spurious.
2017-05-26 08:53:14 -05:00
rallytime
5b27c2daf8 Comment out/remove proxy pieces from integration tests file
This was left over from a merge-forward. The proxy minion testing
pieces could not be completely merged-forward due to large conflicts
in this file. Please see the comment in PR #41113 for more information.
2017-05-24 09:51:00 -06:00
rallytime
616ac7289b Merge branch '2016.11' into 'nitrogen'
Conflicts:
  - salt/config/__init__.py
  - salt/modules/elasticsearch.py
  - tests/integration/__init__.py
2017-05-23 10:36:41 -06:00
Erik Johnson
03b5420988 Remove git_pillar warning from integration suite startup
This is no longer needed since the git_pillar configuration has been
removed from the suite's master config file now that git_pillar
integration tests have been added.
2017-05-10 11:13:43 -05:00
C. R. Oldham
3be90cc9f4 Rescue proxy_auto_tests PR from git rebase hell 2017-05-05 17:04:00 -06:00
Pedro Algarvio
2c6725d96e
Tell python that we're done with this dictionary 2017-04-28 13:33:37 +01:00
Pedro Algarvio
86536e64c5
Make sure files are closed 2017-04-04 18:58:20 +01:00
Pedro Algarvio
6a638620ba
Move base test case modules to tests.support.case 2017-04-04 18:04:39 +01:00
Pedro Algarvio
b94992f544
Some more RUNTIME_CONFIGS and RUNTIME_VARS fixes 2017-04-04 18:04:38 +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
26e60e825c
Allow creating a temporary configuration to be used for a single test 2017-04-01 14:25:55 +01:00
Pedro Algarvio
9a11538b54
Stop using deprecated TestCase methods 2017-04-01 14:22:57 +01:00
Pedro Algarvio
0bf7684b8c
Make the option properties available in the config mixin instead 2017-04-01 14:22:51 +01:00
Pedro Algarvio
c436d9f2f6
This no longer applies. 2017-03-08 18:34:31 +00: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
08804932c3
Using pytest start_daemon 2017-02-28 22:52:48 +00:00
Mike Place
a73a5f9c1f Merge pull request #39646 from terminalmage/zh921
Handle deprecation of passing string args to load_args_and_kwargs
2017-02-28 14:59:33 -07:00
Erik Johnson
5a3c099e4f Rewrite the tests_valid_docs test
This uses a function in the runtests_helpers custom module to perform
all the logic, and only returns what failed the test. This saves us from
having to return the entire contents of sys.doc (as well as log all of
the function calls), and also removes the need to run sys.doc in batches
to get around the "max message size" issue.
2017-02-26 12:21:00 -06:00
Erik Johnson
9f6d08d606 Update tests which used string kwargs 2017-02-25 20:11:06 -06:00
Erik Johnson
503216e5c5 Add warnings to test suite when requisites are not installed
Since we have recently changed the test suite to use new-style
git_pillar, GitPython or Pygit2 is a hard dep for the test suite.

Additionally, when starting up the daemons, if no IPv4 addresses can be
detected (which can happen on docker containers which tend to have
minimal installs) then the suite will time out trying to detect whether
or not the minion/sub-minion has connected, which while it does not
prove fatal for the test suite, it does make the suite take several
minutes to start up and begin running tests. This is because the test
suite invokes the manage.joined runner, which in turn invokes
salt.utils.network.ip_addrs() to get the system's IP addresses to match
against those which are connected. If it can't get the IP addresses,
then the manage.joined runner returns an empty list, and the test suite
believes that no minions have connected, and the function that
periodically runs manage.joined will eventually time out.

This commit adds messages to the console when no suitable gitfs provider
is installed, and when salt.utils.network.ip_addrs() returns an empty
list, to hopefully prompt the user to install the missing requisites.
2017-02-25 19:49:44 -06:00
Pedro Algarvio
26b17fb044
Make sure the minion sync's modules/states/grains/etc when starting 2017-02-13 10:18:57 +00:00
Pedro Algarvio
b264114901
Restore full user permissions when failing to delete 2017-02-09 18:06:27 +00:00
twangboy
c704eaa175 Fix geteuid stacktrace on Windows 2017-01-30 15:36:08 -07:00
rallytime
49f57ba3f1 Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/utils/win_functions.py
2017-01-25 09:59:29 -07:00
Pablo Suárez Hernández
4311b0b6de Increasing timeouts for running integrations tests 2017-01-23 16:55:48 +00:00
rallytime
9ad362fbde Merge branch '2016.11' into 'develop'
Conflicts:
  - salt/states/kapacitor.py
2017-01-03 10:17:18 -05:00
twangboy
e96bfe8fa2 Change OSX/OS X to macOS where possible 2016-12-28 14:49:46 -07:00