Commit Graph

186 Commits

Author SHA1 Message Date
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
Pedro Algarvio
61003bca0a
Take care of resource leakage on tests 2017-04-04 18:58:20 +01:00
Mike Place
1c65cdcbc4 Splay sleeps inside jenkins 2015-12-16 14:48:51 -07:00
Erik Johnson
f4e232bc01 tests/jenkins.py: remove raw string formatting 2015-08-26 23:26:08 -05:00
Justin Findlay
5dadaec775 add tcp transport to jenkins and runtests 2015-07-20 16:56:00 -06:00
Michael Steed
83a96367a4 Manual merge of #24414 per thatch45 2015-06-06 07:47:52 -06:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Mike Place
75c067432f Add debugging to jenkins script 2015-01-06 15:29:21 -07:00
Pedro Algarvio
a6b5011cb7 Typo 2014-12-15 19:28:26 +00:00
Pedro Algarvio
e4f39ed32f Fix variable ref 2014-12-08 18:07:04 +00:00
Pedro Algarvio
9bf2f77b2e Make coverage reports optional 2014-12-08 17:32:28 +00:00
Erik Johnson
5c864fa003 Always run download_packages() after executing buildpackage SLS
By restricting this function call to when the script is successful, we
end up losing the log file from buildpackage.py when it fails, making it next to
impossible to troubleshoot. This commit makes jenkins retrieve at least
the log file, no matter what happens.
2014-12-02 17:49:50 -06:00
rallytime
022d2dbbfb Remove unused import 2014-11-24 13:02:08 -07:00
rallytime
512f07303a Put the parser variable in the correct place 2014-11-24 12:13:38 -07:00
rallytime
d2e5443860 Add parser to jenkins.py 2014-11-24 11:58:24 -07:00
Pedro Algarvio
6e0f4da593 Fix syntax errors 2014-11-22 02:16:26 +00:00
Pedro Algarvio
74e23b9e26 And also the base branch of the incoming PR's branch 2014-11-21 23:35:37 +00:00
Pedro Algarvio
672e98cf0f Use requests instead of github package. Also output the PR incoming branch. 2014-11-21 23:33:29 +00:00
Mike Place
6b0e9c4e29 Provide nbopen poller default and increase interval in jenkins 2014-11-19 12:30:00 -07:00
Colton Myers
0edf446903 Remove unused imports 2014-10-02 13:52:24 -06:00
Tarjei Husøy (via Travis CI)
25ea6060b7 Replace random.randint() with os.urandom() 2014-10-02 10:20:20 -06:00
Erik Johnson
c69d47d062 Revert "Revert "Re-enable test run SLS""
This reverts commit fcfa1a244e and
re-enables tests in jenkins.py. They had been left commented out while I
was testing.
2014-09-11 18:08:29 -05:00
Erik Johnson
fcfa1a244e Revert "Re-enable test run SLS"
This reverts commit 8bcc418aa2.
2014-09-11 17:44:00 -05:00
Erik Johnson
8883f974a8 Add command-line options for package build options
Also add these to pillar data so they make it to the buildpackage SLS
2014-09-11 17:05:09 -05:00
Erik Johnson
8bcc418aa2 Re-enable test run SLS
Now that the buildpackage stuff is ready, this no longer needs to be
commented out.
2014-09-11 13:35:40 -05:00
Erik Johnson
cb31726500 Download packages only when buildpackage.py was run 2014-09-11 13:19:44 -05:00
Erik Johnson
a146a80034 Fix tarfile name 2014-09-11 12:56:45 -05:00
Erik Johnson
2256dc786a Fix path to cached packages 2014-09-11 12:42:40 -05:00
Erik Johnson
12ca973f10 Fix path for cp.push 2014-09-11 12:07:00 -05:00
Erik Johnson
8c89d7e193 Fix block comment
I wasn't letting the prep sls run when testing package auto-builds
2014-09-11 11:33:49 -05:00
Erik Johnson
07a58c4bae Revert "Uncomment test run code"
This reverts commit e45b816341.
2014-09-10 17:20:08 -05:00
Erik Johnson
e45b816341 Uncomment test run code
I was unaware that the tests run using a hard-coded jenkins.py, so
commenting it out as I did has no effect.
2014-09-08 14:02:27 -05:00
Erik Johnson
ec842a754c Add RPM building to jenkins.py
This is a work-in-progress commit. The running of the actual test suite
has been commented out to facilitate quicker testing of the RPM builds,
I will need to uncomment this before this is merged.
2014-09-08 12:23:44 -05:00
rallytime
bd59d3a6b2 Correct cloud_prep_sls reference 2014-08-31 09:31:12 -06:00
rallytime
520e5e6676 Remove 'is True' 2014-08-30 20:18:12 -06:00
rallytime
61478de6e8 First pass at allowing jenkins.py to only run cloud tests 2014-08-30 17:38:39 -06:00
rallytime
e7a09640fa put -C tar command back in 2014-08-20 10:07:12 -06:00
rallytime
286de2466d Remove compound matching from jenkins.py 2014-08-20 09:49:49 -06:00
Pedro Algarvio
9df6dd669d Allow triggering test runs using RAET for transport 2014-06-16 11:19:14 +01:00
Pedro Algarvio
e4591c4e27 Remove unnecessary comma 2014-06-07 13:53:02 +01:00
Pedro Algarvio
31a997e994 Provide a way to specify which minion version is bootstrapped
NOTE: This does not change which version is tested
2014-06-07 13:06:09 +01:00
Pedro Algarvio
e02a931894 Print stderr 2014-06-06 12:25:01 +01:00
Pedro Algarvio
9a20d4f43a Fix logic 2014-04-30 16:07:23 +01:00
Pedro Algarvio
7278635f28 Don't pip stderr to stdout 2014-04-30 08:39:49 +01:00
Pedro Algarvio
18df3d63b0 Don't fail when no JSON can be loaded 2014-04-30 00:46:21 +01:00
Pedro Algarvio
38493bae47 Strip empty strings. 2014-04-30 00:41:18 +01:00
Pedro Algarvio
a13632cd46 Don't fail hard of version comparison 2014-04-29 23:58:37 +01:00
Pedro Algarvio
a564874bb0 Since we now include the code name, check for presence of the commit info instead. 2014-04-23 13:25:43 +01:00
Pedro Algarvio
6206175bea Provide a way to specify the VM's name prefix. 2014-04-17 19:19:40 +01:00