Commit Graph

3371 Commits

Author SHA1 Message Date
Bo Maryniuk
cf191b01d6 Add unit test for file.line on mode checks 2017-11-10 19:50:46 +01:00
Mike Place
8b834e341d
Merge pull request #44288 from eradman/onlyif_unless
Report 'onlyif' and 'unless' conditions as true or false
2017-11-10 11:37:01 -07:00
Nicole Thomas
8ffe91fe44
Merge pull request #44405 from SEJeff/kubernetes-updates-v2
Kubernetes updates v2
2017-11-07 12:17:43 -07:00
Nicole Thomas
c03e997144
Merge pull request #44246 from nicholasmhughes/add-location-to-file.line-ensure
Add location support to file.line ensure
2017-11-06 22:35:18 -07:00
Jeff Schroeder
2b02a46544
Add the beginning of tests for states.kubernetes and update things
* Add 100% test coverage for the kubernetes.secret_present state
* Add 100% test coverage for the kubernetes.configmap_absent state
* Add 100% test coverage for the kubernetes.configmap_present state
* Make some fields optional to kubernetes.create_secret and add examples
* Make some fields optional to kubernetes.replace_secret and add examples
* Make some fields optional to kubernetes.create_configmap and add examples
* Make some fields optional to kubernetes.replace_configmap and add examples
* Add 'comment' when a kubernetes configmap or secret is going to be replaced
* Update 'source', 'template', and 'saltenv' kwargs to defaults from the rest of the codebase
* Allow passing empty 'data' to the kubernetes.configmap_present state to remove the existing contents
2017-11-05 13:34:37 -06:00
Mike Place
57705b9e6a
Merge pull request #44231 from SEJeff/kubernetes-stuff
Kubernetes module updates round one
2017-10-31 11:21:28 -06:00
Jeff Schroeder
1576c9980c
Fix test_kubernetes.py after fixing bug in 25f7c4996730a578b7875e924508a5c1774e8b7c 2017-10-26 18:20:49 -05:00
Jeff Schroeder
9304a428e3
Add the change-cause annotation to kubernetes created objects
This allows commands such as `kubectl rollout history deploy/$FOO` to
automatically show the deployment changed as a result of the salt run
and follows exactly how kubectl works when passed the `--record` flag.
2017-10-26 18:20:41 -05:00
Jeff Schroeder
9ceabf29f4
Fix kubernetes.node_labels()
This prevented showing, adding, or removing any labels from nodes
2017-10-26 18:20:34 -05:00
Jeff Schroeder
ac20ddfa25
Fix a bug in the kubernetes module for ssl cert paths
When the `client_key_file` attribute was defined and the `client_key`
attribute was not, the conditional for `client_key` would wrongly zero
`kubernetes.client.configuration.key_file`.

This was a bit annoying to figure out, but the kubernetes module now can
authenticate with minikube with a configuration such as this (where jeff
is $USER):

	kubernetes.api_url: 'https://192.168.99.100:8443'
	kubernetes.certificate-authority-file: '/home/jeff/.minikube/ca.crt'
	kubernetes.client-certificate-file: '/home/jeff/.minikube/client.crt'
	kubernetes.client-key-file: '/home/jeff/.minikube/client.key'

The various options can be gotten from ~/.kube/config after running `minikube start`.
2017-10-26 18:20:28 -05:00
Eric Radman
d921e1e6cb
Report 'onlyif' and 'unless' conditions as true or false
Elide terminology "execution failed/succeeded" since the result of these
conditions does not indicate a failure in state execution. Instead
simply report the result of each condition.
2017-10-25 11:03:13 -04:00
rallytime
28343f0120
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/modules/git.py
2017-10-25 09:54:37 -04:00
twangboy
609361bf48
Fix some lint errors 2017-10-24 09:27:39 -06:00
twangboy
7a3ff9387d
Mock the rest of the tests 2017-10-24 09:27:38 -06:00
Erik Johnson
5ce14df82c
Change how members are retrieved in win_groupadd
This is a solution that works for the other functions that interact with
group objects, making it a better overall solution to be used widely
in win_groupadd.

This also updates the mocking in the tests such that we use a more
comprehensive fake class, and more intelligent mocking of get_sam_name
using a lambda.
2017-10-24 09:27:38 -06:00
twangboy
6ab82394be
Set up mocking
Move the code that sets up the group object, computer object and gets
existing members out of the individual functions so they can be mocked

Mock the GroupObj
Mock the ComputerObj
Mock existing members
Still need to fix info, getent, and members
2017-10-24 09:27:37 -06:00
nicholasmhughes
fa1c442943
added support for location in file.line when using ensure 2017-10-23 10:40:35 -04:00
Nicole Thomas
2ccfaca66c Merge pull request #44067 from eradman/check_file_meta
Check file attributes if lsattr(1) is installed
2017-10-23 10:30:58 -04:00
Eric Radman
6da4fd979b
Check file attributes in check_file_meta() if lsattr(1) is installed
lsattr/chattr is not installed on many Unix-like platforms by default,
including *BSD, Solaris, and minimal Linux distributions such as Alpine.
2017-10-19 18:38:12 -04:00
Mike Place
1e3abfea59 Merge branch 'develop' into various_beacon_fixes 2017-10-19 15:58:01 -05:00
Benedikt Werner
4bfeb7f1d1
Fixed missing import 2017-10-19 03:17:16 +02:00
Benedikt Werner
77b948b00a
Skip shadow module unit test if not root or no shadow 2017-10-18 19:10:55 +02:00
Marc Koderer
c4d9684a90 Use correct mac prefix for kvm/qemu
Using the private mac range for vms makes it impossible to
distinguish between hypervisors.

Issues #44056

Signed-off-by: Marc Koderer <marc.koderer@sap.com>
2017-10-17 10:46:06 +02:00
Gareth J. Greenaway
a89c26c88e
Various fixes to beacons to handle situations when beacons are stored in pillar. Updating execution module to report that beacons stored in pillar can not be managed via module. Updating add function to ensure beacon is available before attempting to add it. Updaitng unit tests to include new beacon is available check. 2017-10-16 14:32:12 -07:00
rallytime
c0f16dae74
Merge branch '2017.7' into 'develop'
Conflicts:
  - doc/topics/tutorials/index.rst
  - salt/crypt.py
  - salt/modules/cmdmod.py
  - salt/modules/grains.py
  - salt/pillar/git_pillar.py
  - salt/roster/clustershell.py
  - tests/unit/states/test_augeas.py
  - tests/unit/utils/test_utils.py
2017-10-16 15:26:19 -04:00
Erik Johnson
877abb89d0
Complete the salt.utils refactor
This moves the remaining 30 functions from salt.utils to new locations.
2017-10-15 09:43:31 -05:00
Erik Johnson
c6b655b6e9
Move 14 more functions from salt.utils
These functions are:

salt.utils.test_mode -> salt.utils.args.test_mode
salt.utils.split_input -> salt.utils.args.split_input
alt.utils.pem_finger -> salt.utils.crypt.pem_finger
salt.utils.is_bin_file -> salt.utils.files.is_binary
salt.utils.list_files -> salt.utils.files.list_files
salt.utils.safe_walk -> salt.utils.files.safe_walk
salt.utils.st_mode_to_octal -> salt.utils.files.st_mode_to_octal
salt.utils.normalize_mode -> salt.utils.files.normalize_mode
salt.utils.human_size_to_bytes -> salt.utils.files.human_size_to_bytes
salt.utils.get_hash -> salt.utils.hashutils.get_hash
salt.utils.is_list -> salt.utils.data.is_list
salt.utils.is_iter -> salt.utils.data.is_iter
salt.utils.isorted -> salt.utils.data.sorted_ignorecase
salt.utils.is_true -> salt.utils.data.is_true
2017-10-13 09:29:03 -05:00
Daniel Wallace
1f8ec5d335 Merge branch 'develop' into vagrant-module 2017-10-06 11:32:31 -06:00
Nicole Thomas
d136650b31 Merge pull request #43938 from terminalmage/salt.utils.user
Move several functions from salt.utils to salt.utils.user
2017-10-06 09:42:42 -04:00
Erik Johnson
aa3309ef59
Move several functions from salt.utils to salt.utils.user
These functions are as follows:

- salt.utils.get_user
- salt.utils.get_uid
- salt.utils.get_specific_user
- salt.utils.chugid
- salt.utils.chugid_and_umask
- salt.utils.get_default_group
- salt.utils.get_group_list
- salt.utils.get_group_dict
- salt.utils.get_gid_list
- salt.utils.get_gid
2017-10-05 19:50:14 -05:00
Nicole Thomas
7785919437 Merge pull request #43829 from rallytime/merge-develop
[develop] Merge forward from 2017.7 to develop
2017-10-05 16:09:23 -04:00
garethgreenaway
37d7f13926 Merge branch 'develop' into vagrant-module 2017-10-05 10:25:24 -07:00
rallytime
eaca3291e2
Merge branch '2016.11' into '2017.7'
Conflicts:
  - tests/unit/modules/test_state.py
2017-10-05 12:09:40 -04:00
Nicole Thomas
a9dc04fb7f Lint: disable the unused-import check 2017-10-05 08:51:16 -04:00
Eric Radman
0dc3c4ef1c
Skip some vsphere tests if pyvmomi library is not installed
Also fix up 'E127: continuation line over-indented' lint errors
2017-10-04 13:09:29 -04:00
Vernon Cole
73947e3103
lint (again!) blank lines can have no spaces 2017-10-04 09:10:47 -06:00
Vernon Cole
67a701de7c lint PEP-8 2017-10-03 23:23:17 -06:00
Vernon Cole
83a3678cef
provide mocked unit tests 2017-10-03 17:24:05 -06:00
Vernon Cole
7d5a121265
Skip unit tests under Python3 until loader is fixed 2017-10-03 10:22:18 -06:00
rallytime
b7dae5addd
Bump with statements in one level
This is needed because the previous commit changed the context
management style from nested with statements to stacked with
statements.
2017-10-03 12:18:27 -04:00
Vernon Cole
c6b2e1e35b
update tests to match improved module
(cherry picked from commit 7fcdc51)
2017-10-02 22:10:37 -06:00
rallytime
c976df7c09
Fix mocking in test_status since the "which" util has moved 2017-09-29 13:56:01 -04:00
Alexandru Bleotu
b4a05dc7c0 Added tests for salt.modules.vsphere.remove_capacity_from_diskgroup 2017-09-29 13:39:44 -04:00
Alexandru Bleotu
ec2637db44 Added tests for salt.modules.vsphere.remove_diskgroup 2017-09-29 13:39:41 -04:00
Alexandru Bleotu
4e0755de20 Added tests for salt.modules.vsphere.remove_datastore 2017-09-29 13:39:39 -04:00
Alexandru Bleotu
51703a8a34 Added tests for salt.modules.vsphere.erase_disk_partitions 2017-09-29 13:39:36 -04:00
rallytime
a38ceab7cf
Merge branch '2017.7' into 'develop'
Conflicts:
  - salt/cli/batch.py
  - salt/master.py
  - salt/utils/path.py
  - tests/unit/modules/test_state.py
2017-09-29 11:48:33 -04:00
Mike Place
952b5d8e87 Merge branch 'develop' into vagrant-module 2017-09-29 12:34:41 +02:00
Vernon Cole
e9661aea07
lint: must not use bare except: even in teardown 2017-09-28 18:27:54 -06:00
vernoncole
8d27e20b63 replace salt.utils.sdb calls with __utils__ 2017-09-28 16:43:47 -06:00