Commit Graph

6322 Commits

Author SHA1 Message Date
twangboy
fbe54c9a33 Remove unused import six (lint) 2017-08-17 15:54:38 -06:00
twangboy
7f5ee55f57 Fix unit.utils.test_url for Windows
Detect escaped urls in Windows
Unescape urls in Windows
Fix tests to deal with sanitized Windows paths
2017-08-17 14:20:25 -06:00
twangboy
b04d1a2f18 Fix unit.utils.test_find for Windows
Fix skipIf statements
Use sys.maxsize instead of sys.maxint
2017-08-17 11:55:00 -06:00
Adam Mendlik
f87fe54b7b Fix linter errors for kernelpkg modules and states 2017-08-17 11:27:57 -06:00
Adam Mendlik
8f575ade60 Add kernelpkg.remove function for APT-based systems 2017-08-17 11:27:57 -06:00
Adam Mendlik
5c4a5ca59a Add kernelpkg.remove function for YUM-based systems 2017-08-17 11:27:57 -06:00
Erik Johnson
4089b7b1bc Use socket.AF_INET6 to get the correct value instead of doing an OS check
This builds on #43014 with a more future-proof solution.
2017-08-17 12:12:27 -05:00
Ch3LL
b8eee4401e Change AF_INET6 family for mac in test_host_to_ips 2017-08-17 10:55:53 -04:00
rallytime
93c11d827a Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/engines/slack.py
  - salt/minion.py
2017-08-17 09:30:50 -04:00
rallytime
8a0f948e4a Merge branch '2016.11' into '2017.7'
Conflicts:
  - salt/utils/versions.py
  - tests/unit/modules/test_boto_elb.py
  - tests/unit/modules/test_boto_secgroup.py
  - tests/unit/states/test_boto_vpc.py
2017-08-17 09:10:31 -04:00
twangboy
92dc3c0ece Use os.sep for path 2017-08-16 15:59:10 -06:00
Tarjei Husøy
6f19fc023c Fix broken negation in iptables
Introduced in 7c6ff77c and released with 2017.7.
2017-08-16 10:30:55 -07:00
twangboy
201ceae4c4 Fix lint, remove debug statement 2017-08-16 10:29:26 -06:00
Andrew Bulford
d3f792d47d Remove check_duplicates from create_network call
The create_network function in dockermod.py doesn't take a
check_duplicates argument so passing it here causes a failure.

Fixes #42976
2017-08-16 14:05:31 +01:00
Gilbert Gilb's
08d453eb37 Fix unit tests. 2017-08-16 09:00:26 +02:00
twangboy
e9febe4893 Fix unit.test_fileclient
Use os.sep instead of hard-coded, unix-style paths
2017-08-15 16:34:03 -06:00
Mike Place
40c4323593 Merge branch 'develop' into modularise-tokens 2017-08-15 15:48:25 -06:00
Nicole Thomas
abac36d907 Merge pull request #42450 from pwdng/ldap_fix
Use OrderedSet instead of set to allow handling of OpenLDAP X-ORDERED…
2017-08-15 17:30:35 -04:00
twangboy
37029c1a16 Fix unit.test_doc test
Use findstr instead of grep on Windows
Use os.linesep for file paths
2017-08-15 15:30:13 -06:00
Nicole Thomas
275122d04e Merge pull request #42834 from terminalmage/salt.utils.versions
Move 4 functions from salt.utils to salt.utils.versions
2017-08-15 17:28:24 -04:00
Mike Place
f881aa5117 Merge branch 'develop' into nfs-exports 2017-08-15 13:28:12 -06:00
Mike Place
4f406602cf Merge branch 'develop' into ldap_fix 2017-08-15 12:36:47 -06:00
rallytime
c6b9ca4b9e Lint fix: add missing space 2017-08-15 14:26:44 -04:00
rallytime
5597b1a30e Skip 2 failing tests in Python 3 due to upstream bugs 2017-08-15 14:26:44 -04:00
rallytime
a0b19bdc27 Update account id value in boto_secgroup module unit test
This value was updated in moto 1.0.0 with the following commit:

5f3fbff627
2017-08-15 14:23:00 -04:00
rallytime
60b406e088 @mock_elb needs to be changed to @mock_elb_deprecated as well 2017-08-15 14:23:00 -04:00
rallytime
6ae1111295 Replace @mock_ec2 calls with @mock_ec2_deprecated calls
moto versions >= 1.0.0 have changed the way the mocked connections through
boto are handled with the @mock_ec2 decorator. They use the boto3 connection
method. However, since we are still using boto in many places, we need to use
the new @mock_ec2_deprecated decorator instead to handle the boto connection
functions for the unit tests.

Versions of moto < 1.0.0 are not Python 3 compatible, so salt-jenkins should
be installing newer versions of moto for those tests. Unfortunately, we cannot
install an older version of moto for Python2 that use the original @mock_ec2 call
and also import the @mock_ec2_deprecated function for newer versions of moto
simultaneously as the @mock_ec2_deprecated function doesn't exist in older
versions of moto.
2017-08-15 14:22:59 -04:00
Erik Johnson
2b76029ded Move 4 functions from salt.utils to salt.utils.versions
This moves the following functions from salt.utils to salt.utils.versions:

- warn_until
- kwargs_warn_until
- compare_versions (as salt.utils.versions.compare)
- version_cmp
2017-08-15 12:53:57 -05:00
Nicole Thomas
47ff9d5627 Merge pull request #42812 from terminalmage/yaml-loader-tests
Update custom YAML loader tests to properly test unicode literals
2017-08-15 13:50:22 -04:00
Erik Johnson
9d8486a894 Add test for custom YAML loader with unicode literal strings 2017-08-15 11:06:20 -05:00
Erik Johnson
a0118bcece Remove bytestrings and use textwrap.dedent for readability
PyYAML works with and without bytestrings on PY3, and Python 3 can read
all of the test data as regular strings, so bytestrings are unnecessary
here.

This also adds use of textwrap.dedent to make the YAML easier to read,
so it can be indented away from the far left side of the line.
2017-08-15 11:05:48 -05:00
garethgreenaway
8b48341a36 Merge branch 'develop' into fixing_beacons 2017-08-15 09:00:09 -07:00
Mike Place
db32d81d8a Merge pull request #42917 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-08-14 21:53:18 -06:00
Nicole Thomas
4fcdab3ae9 Merge pull request #42657 from nhavens/2017.7
back-port #42612 to 2017.7
2017-08-14 15:42:25 -04:00
garethgreenaway
bbaae409b5 Merge branch 'develop' into postgres-valid-until 2017-08-14 12:09:43 -07:00
Gareth J. Greenaway
ed742bb506 Updating mock from salt.utils to salt.utils.files for fopen. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
bf1aefa47b Updating memusage, ps and diskusage beacons for python3 related failures. Updating respective tests as well. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
fe5dd1e7b9 Removing unused import from ps beacon. Fixing mock for sensehat test. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
9072edd8a1 Fixing mocking for ps beacon. Types for sensehat beacon. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
d8ac1f8cfb Updating unit and integration tests for beacons to reflect changes. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
ff6f42405f Fixing typo in service beacon. Removing unused import. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
4e1fea1433 Updating logging, shuffling some imports of salt.ext.six.moves around to fix linting. better way to determine the twilio library version. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
813445d1ed Updating with various requested changes 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
cca7c0d091 Removing the wrong import, re-adding Mock and removing the ones that are not used. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
71963cccce fixing more lint issues 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
1ec4ccba85 Renaming all tests to be consistent with naming. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
23d572199a Adding test_beacon for the beacon state module. Updating beacon state module documentation. Removing over aggressive code in the validate function for service beacon. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
474b6dbdf8 Updating various documentation and beacons. Adding unit tests for the beacon module. 2017-08-14 12:04:38 -07:00
Gareth J. Greenaway
7f89fa4886 Removing test_network_settings_match from tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
ee3befbed8 Updating documentation for wtmp, btmp, fixing service tests and updating various bits in the service beacon. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
6f9412b41c adding network_info, network_settings, and service tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
4f6c04cbbf Adding the tests 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
507071e9e6 Updating the salt_proxy beacon to use list based configuration and adding unit tests. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
a04b0fe3ee Updating network_info beacon for list based configuration. Adding unit tests for network_info beacon 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
8b507b1635 Updating twilio_txt_msg & memusage beacons to ensure list based configuration. Adding/Updating unit tests for both. Updating twilio related things to support newer version of twilio python library. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
7361672339 Updating the telegram_bot_msg beacon to use list based configuration rather that dictionary based configuration. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
dfc27c63fd Updating beacon.log to use list based configuration rather than dictionary. Adding the unit test for beacon.log. 2017-08-14 12:04:37 -07:00
Gareth J. Greenaway
b03f840aed Simplying the validate functions by converting from list to dict when looking for various items to be present. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
2a02d1c324 Updating inotify beacon & inotify beacon test to use list based configuration rather than dictionary based configuration 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
8f0a34e035 Adding unit test for haproxy beacon. Updating haproxy beacon to use list based configuration instead of dictionary based configurations 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
ebcdbfeb52 Shuffling things around in the haproxy module. Initially adding the unit test. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
f3843ac789 Fixing validate in adb to check that the states parameter is an array/list. Updating glxinfo and glxinfo beacon tests to use configuration based on a list rather than a dictionary. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
0b0ada65e3 Couple typos in the avahi and bonnjour beacons. Reworked the diskusage beacon to handle regex properly. Adding unit test for diskusage beacon. 2017-08-14 12:04:36 -07:00
Gareth J. Greenaway
cf1a4ff2d6 Fixing some typos in adb beacon, updating unit tests to reflect changes 2017-08-14 12:04:36 -07:00
rallytime
78e744bda4 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/client/mixins.py
  - salt/fileclient.py
  - salt/modules/status.py
  - tests/integration/states/test_npm.py
2017-08-14 14:21:17 -04:00
Adam Bolte
7848189ad4
Implement rbenv state module test mode checks
Fixes #42815 and updates unit tests.
2017-08-14 19:13:42 +10:00
Gilbert Gilb's
3c136e3138 Add support for PostgreSQL password expiration. 2017-08-12 13:48:12 +02:00
Erik Johnson
1764878754 Merge pull request #42883 from rallytime/fix-boto-tests
Fix failing boto tests
2017-08-11 15:29:11 -05:00
rallytime
6a7bf99848 Lint fix: add missing space 2017-08-11 14:19:15 -04:00
rallytime
43643227c6 Skip 2 failing tests in Python 3 due to upstream bugs 2017-08-11 12:57:39 -04:00
rallytime
7f46603e9c Update account id value in boto_secgroup module unit test
This value was updated in moto 1.0.0 with the following commit:

5f3fbff627
2017-08-10 17:31:14 -04:00
rallytime
7c1d493fdd @mock_elb needs to be changed to @mock_elb_deprecated as well 2017-08-10 17:15:45 -04:00
Daniel Wallace
c1f673eca4 use older name if _create_unverified_context is unvailable 2017-08-10 14:43:33 -06:00
rallytime
3055e17ed5 Replace @mock_ec2 calls with @mock_ec2_deprecated calls
moto versions >= 1.0.0 have changed the way the mocked connections through
boto are handled with the @mock_ec2 decorator. They use the boto3 connection
method. However, since we are still using boto in many places, we need to use
the new @mock_ec2_deprecated decorator instead to handle the boto connection
functions for the unit tests.

Versions of moto < 1.0.0 are not Python 3 compatible, so salt-jenkins should
be installing newer versions of moto for those tests. Unfortunately, we cannot
install an older version of moto for Python2 that use the original @mock_ec2 call
and also import the @mock_ec2_deprecated function for newer versions of moto
simultaneously as the @mock_ec2_deprecated function doesn't exist in older
versions of moto.
2017-08-10 16:40:11 -04:00
rallytime
5d8d6225b5 Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/augeas_cfg.py
  - salt/netapi/rest_cherrypy/app.py
  - salt/runners/manage.py
  - salt/states/boto_cfn.py
  - salt/utils/cloud.py
  - tests/integration/states/test_pkg.py
2017-08-10 14:47:14 -04:00
Nicole Thomas
e6357abdda Merge pull request #42718 from moio/yumpkg-list_pkg-attr-parameter
yumpkg.list_pkgs: add parameter for returned attribute selection
2017-08-09 16:58:02 -04:00
Silvio Moioli
5a15e53886 yumpkg.list_pkg: add/adapt tests
This includes changes to the zypper tests because of the refactoring that
affected both modules.
2017-08-09 11:43:56 +02: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
Nicole Thomas
ddb671b8fe Merge pull request #42783 from rallytime/fix-flaky-py3-test
Sort lists before comparing them in python 3 unit test
2017-08-08 09:25:14 -04:00
kunal-bajpai
9ce6e0f3b1 Merge branch 'develop' into modularise-tokens 2017-08-08 16:20:56 +05:30
Kunal Ajay Bajpai
0d7658c870 Fixed lint failure 2017-08-08 14:21:02 +05:30
Kunal Ajay Bajpai
200f414969 Fixed failing LoadAuth unit test 2017-08-08 13:35:05 +05:30
rallytime
998834fbac Sort lists before compairing them in python 3 unit test 2017-08-07 16:09:43 -04:00
rallytime
f49da018e4 Sort lists before compairing them in python 3 unit test 2017-08-07 14:38:10 -04:00
Erik Johnson
665de2d1f9 Fix domainname parameter input translation
Resolves #42538
2017-08-07 09:51:14 -05:00
rallytime
f20f3742cb Merge branch '2017.7' into 'develop'
Conflicts:
  - tests/unit/test_crypt.py
2017-08-07 10:43:06 -04:00
Mike Place
547ada9418 Merge pull request #42612 from nhavens/develop
fix for issue #42611
2017-08-03 17:37:05 -05:00
Mike Place
b8acf9f6ec Merge pull request #42624 from lyft/modernize-boto-sqs-modules
Modernize boto_sqs execution and state modules
2017-08-03 17:34:18 -05:00
Mike Place
834d6c605e
Set fact gathering style to 'old' for test_junos
Without this, we stacktrace because it does not appear that setting
'gather_facts' to False prevents the library from assuming the presence
of facts. I believe this to be an upstream bug with jnpr.

Because they have listed this as being a deprecated option in the future
this may re-break in the future.
2017-08-02 23:11:52 -06:00
Mike Place
4c1d931654 Merge pull request #42481 from twangboy/win_unit_test_crypt
Fix `unit.test_crypt` for Windows
2017-08-01 13:10:49 -05:00
Neile Havens
d73c4b55b7 back-port #42612 to 2017.7 2017-07-31 17:10:06 -05:00
Neile Havens
afce919746 Merge branch 'develop' into develop 2017-07-31 15:51:10 -05:00
Mike Place
968a9dba46 Merge pull request #42354 from alexbleotu/vmware_logs_and_no_permission_exc-gh
VMware utils functions: additional logs & raise NoPermission exceptions
2017-07-31 15:03:45 -05:00
Mike Place
5baf2650fc Merge pull request #42453 from gtmanfred/makedirs
don't pass user to makedirs on windows
2017-07-31 14:57:57 -05:00
Mike Place
a09091a696 Merge pull request #42517 from alexbleotu/linux_acl_fixes-gh
Fixes to linux_acl.present state & cmd.run function
2017-07-31 14:44:57 -05:00
garethgreenaway
25094ad9b1 Merge pull request #42602 from garethgreenaway/42514_2017_7_superseded_deprecated_from_pillar
Use superseded and deprecated configuration from pillar
2017-07-31 11:53:06 -07:00
Aneesh Agrawal
c4f5888c85 Modernize boto_sqs execution and state modules
Headline changes:
- Move to boto3
- Use result-style error handling
- Optimize number of API calls:
  - Set attributes at creation time
  - Set all attributes in one API call
- Show diff when attribute changes detected
2017-07-31 18:08:29 +00:00
Philippe Wooding
78f5da36f4
Update LDAP unit test 2017-07-31 14:28:27 +02:00
Anil Kabra
a8f263d1cb Merge branch 'develop' into v2016.11.5_protect_master_key 2017-07-28 14:03:26 -05:00
Anil Kabra
b77b2e2a05 Fix unit test signing with passphrase 2017-07-28 14:02:31 -05:00