Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[develop] Merge forward from fluorine to develop #50973

Merged
merged 88 commits into from
Dec 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
a1dddce
Fixes icinga2 certs path for newer versions 2.8+
ClaudiuLSH Nov 22, 2018
47bfba1
Migrated to cmd.run_all and tested on working srv
ClaudiuLSH Nov 23, 2018
79f6b42
Check file_mode in file.directory and _check_directory
lexvella Nov 27, 2018
42e4ab3
Merge branch '2018.3' into 2018.3
lexvella Nov 27, 2018
4ea9386
Merge branch '2018.3' into 2018.3
lexvella Nov 27, 2018
31878d5
Pylint fixes
ClaudiuLSH Nov 28, 2018
a394cd7
Update file integration tests to use decorator for tempdirs
terminalmage Nov 29, 2018
be14517
Make x509 tests use tempfiles instead of hard-coding them
terminalmage Nov 29, 2018
36a4a1a
Merge branch '2018.3' into update-tests
Dec 3, 2018
e971412
git_pillar: Add support for all_saltenvs parameter
sathieu Dec 5, 2018
ef160a6
gitfs/git_pillar: Fix UnicodeDecodeError while cleaning stale refs
sathieu Dec 7, 2018
87a04df
Fix #48801 min, max, inact, and warn changes
dwoz Dec 8, 2018
6b95223
fix linter errors
dwoz Dec 8, 2018
b905cf6
Added support for dns_{nameservers,search} being a list or string.
MTecknology Aug 28, 2018
cf61c8d
Added a bunch of unit tests for modules.debian_ip.build_interface().
MTecknology Aug 28, 2018
638f899
Added support for loopback devices to modules.debian_ip(). (Fixes: #3…
MTecknology Aug 28, 2018
601f434
Added support for -ipaddrs and -ipv6ipaddrs to modules.debian_ip().
MTecknology Aug 28, 2018
4c7df5f
Cleaned up documentation/examples in states.network:
MTecknology Aug 28, 2018
6e41225
Finished adding support for multiple IP addresses.
MTecknology Aug 28, 2018
1b096fb
Removed python lint.
MTecknology Aug 28, 2018
0b59561
Added documentation about debian interfaces.d/*. (Fixes: #40262)
MTecknology Aug 28, 2018
15c34fe
Support unicode in space-delimited list; fixes unit tests in py2.
MTecknology Aug 28, 2018
622c354
Support reading multiple addresses from interface files.
MTecknology Aug 29, 2018
d34eade
Use a temp file instead of /etc/network/interfaces for unit tests.
MTecknology Aug 29, 2018
b266e8b
Merge pull request #50804 from Ch3LL/bp-49355
Dec 10, 2018
12a8447
Merge pull request #50796 from dwoz/issue48801
Dec 10, 2018
ce1842e
Merge branch '2018.3' into fix-icinga2-cert-path
Dec 10, 2018
3a71567
Merge pull request #50768 from sathieu/git_pillar_all_saltenvs
Dec 10, 2018
9f8289b
Merge pull request #50692 from terminalmage/update-tests
Dec 10, 2018
deadf9c
Merge pull request #50765 from ClaudiuPID/fix-icinga2-cert-path
Dec 10, 2018
0351296
Merge pull request #50783 from sathieu/gitfs_stalerefs_unicode
Dec 10, 2018
00cbf26
Add the netsh mechanism to the lgpo module
twangboy Dec 7, 2018
cb50648
Add versionadded tags
twangboy Dec 7, 2018
f18d1aa
Add additional policies that use netsh
twangboy Dec 7, 2018
b2b9795
Fix overly long lines
twangboy Dec 7, 2018
1247598
Add more policies
twangboy Dec 8, 2018
c55b7b4
Fix some lint
twangboy Dec 8, 2018
2dde12a
Fix one more lint item
twangboy Dec 8, 2018
f077783
Add some tests
Dec 10, 2018
5eea728
Fix some lint
twangboy Dec 10, 2018
9b6b39c
Merge pull request #50780 from twangboy/lgpo_netsh
dwoz Dec 10, 2018
48fc01f
Adding git 'v' to the bootstrap options
Dec 11, 2018
e31e731
Merge pull request #50817 from dubb-b/2018.3
Ch3LL Dec 11, 2018
ec8e116
Decode fetch results before making string comparisons
terminalmage Dec 11, 2018
a8ad17a
Merge pull request #50823 from terminalmage/issue45026
Dec 11, 2018
56c0e55
Fix issues with lgpo state and util
twangboy Dec 11, 2018
b855fd9
Fix misspelling in comment
terminalmage Dec 12, 2018
1233e2b
Fix some lint
twangboy Dec 12, 2018
264a042
Merge pull request #50653 from lexvella/2018.3
Dec 12, 2018
9eaa2ed
Remove extraneous comments
terminalmage Dec 12, 2018
1a00abc
Add unit test for _get_proc_cmdline
terminalmage Dec 12, 2018
3a3d9b7
Ensure that unicode types returned from compatibility funcs
terminalmage Dec 12, 2018
0d00ae4
Fix RemoveCapacityFromDiskgroupTestCase require pyvmomi
bdrung Dec 12, 2018
14d7d1d
Merge pull request #50839 from terminalmage/issue50829
dwoz Dec 12, 2018
6ea059d
Merge pull request #50843 from bdrung/fix-tests
dwoz Dec 12, 2018
05baa95
Merge branch '2018.3' into fix_lgpo
garethgreenaway Dec 12, 2018
6b45aad
Merge pull request #50828 from twangboy/fix_lgpo
Dec 13, 2018
ea90f11
Let minions try to connect to master indefinitly
dwoz Dec 13, 2018
ebc9a01
When reading and writing the key cache file, when using Python3, ensu…
garethgreenaway Dec 13, 2018
216fa14
Merge pull request #50859 from garethgreenaway/50850_python_key_cache…
thatch45 Dec 13, 2018
449fa2e
Merge branch '2018.3' into 'fluorine'
Ch3LL Dec 14, 2018
10cb130
Add tempfile import in file tests
Ch3LL Dec 14, 2018
8997550
Fix unit tests
twangboy Dec 14, 2018
07f51bf
Merge pull request #50868 from Ch3LL/merge-fluorine
garethgreenaway Dec 14, 2018
ea99008
Merge pull request #50875 from twangboy/fix_test_user
dwoz Dec 14, 2018
165d733
Merge branch 'fluorine' into issue50791
garethgreenaway Dec 17, 2018
80197bc
Merge pull request #50855 from dwoz/issue50791
garethgreenaway Dec 17, 2018
0d32cb9
libvirt events: fix domain defined/updated event details
cbosdo Dec 18, 2018
1672546
virt update/init: update current memory with memory
cbosdo Dec 18, 2018
f81d66d
pylint: fix libvirt_events.py
cbosdo Dec 18, 2018
f2b9e7f
Merge pull request #50897 from cbosdo/misc-virt-fixes
garethgreenaway Dec 18, 2018
a5dffb9
Increase and standardize ShellCase timeouts
dwoz Dec 18, 2018
daffcb3
Fix linter warnings
dwoz Dec 18, 2018
abf55a2
Merge pull request #50902 from dwoz/shell_case_timeouts
dwoz Dec 18, 2018
f06898e
Do not pass unicode in environment
dwoz Dec 19, 2018
7ba54cd
Fix `test_debian_ip` on Windows
twangboy Dec 19, 2018
bbc1244
Skip debian tests on Windows
twangboy Dec 19, 2018
6b780c6
Merge pull request #50916 from dwoz/gitfsfix
dwoz Dec 19, 2018
483fad4
Merge pull request #50918 from twangboy/fix_test_debian_ip
dwoz Dec 19, 2018
db2a1cc
Fix failing tests on Py3
twangboy Dec 20, 2018
08cb05d
#50924: Check if running a NAPALM Proxy or regular Minion
mirceaulinic Dec 20, 2018
68851de
Merge pull request #50934 from mirceaulinic/fix-50924
garethgreenaway Dec 20, 2018
4577c21
Merge pull request #50928 from twangboy/fix_test_lgpo_netsh
dwoz Dec 20, 2018
834ecd0
Merge branch 'fluorine' into merge-develop
garethgreenaway Dec 23, 2018
d661b6e
Fixing def test_build_interface in merge-forward
garethgreenaway Dec 25, 2018
d0de2d2
Merge branch 'develop' into merge-develop
garethgreenaway Dec 26, 2018
01b4f6f
Ensure the refresh_pillar is run against both the minion and sub_mini…
garethgreenaway Dec 29, 2018
fed22c5
Merge branch 'develop' into merge-develop
garethgreenaway Dec 29, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions salt/engines/libvirt_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def _get_libvirt_enum_string(prefix, value):
# Filter out the values starting with a common base as they match another enum
prefixes = [_compute_subprefix(p) for p in attributes]
counts = {p: prefixes.count(p) for p in prefixes}
sub_prefixes = [p for p, count in counts.items() if count > 1]
sub_prefixes = [p for p, count in counts.items() if count > 1 or (p.endswith('_') and p[:-1] in prefixes)]
filtered = [attr for attr in attributes if _compute_subprefix(attr) not in sub_prefixes]

for candidate in filtered:
Expand Down Expand Up @@ -313,10 +313,9 @@ def get_address(addr):
'''
transform address structure into event data piece
'''
data = {'family': _get_libvirt_enum_string('{0}_ADDRESS_'.format(prefix), addr['family']),
return {'family': _get_libvirt_enum_string('{0}_ADDRESS_'.format(prefix), addr['family']),
'node': addr['node'],
'service': addr['service']}
return addr

_salt_send_domain_event(opaque, conn, domain, opaque['event'], {
'phase': _get_libvirt_enum_string(prefix, phase),
Expand Down
2 changes: 1 addition & 1 deletion salt/fileserver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def backends(self, back=None):

# Avoid error logging when performing lookups in the LazyDict by
# instead doing the membership check on the result of a call to its
# .keys() attribute rather than on the LaztDict itself.
# .keys() attribute rather than on the LazyDict itself.
server_funcs = self.servers.keys()
try:
subtract_only = all((x.startswith('-') for x in back))
Expand Down
8 changes: 6 additions & 2 deletions salt/master.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,12 @@ def handle_key_cache(self):
keys.append(fn_)
log.debug('Writing master key cache')
# Write a temporary file securely
with salt.utils.atomicfile.atomic_open(os.path.join(self.opts['pki_dir'], acc, '.key_cache')) as cache_file:
self.serial.dump(keys, cache_file)
if six.PY2:
with salt.utils.atomicfile.atomic_open(os.path.join(self.opts['pki_dir'], acc, '.key_cache')) as cache_file:
self.serial.dump(keys, cache_file)
else:
with salt.utils.atomicfile.atomic_open(os.path.join(self.opts['pki_dir'], acc, '.key_cache'), mode='wb') as cache_file:
self.serial.dump(keys, cache_file)

def handle_key_rotate(self, now):
'''
Expand Down
3 changes: 1 addition & 2 deletions salt/minion.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,9 +991,8 @@ def _check_minions(self):
'''
if not self.minions:
err = ('Minion unable to successfully connect to '
'a Salt Master. Exiting.')
'a Salt Master.')
log.error(err)
raise SaltSystemExit(code=42, msg=err)

def _spawn_minions(self, timeout=60):
'''
Expand Down
30 changes: 9 additions & 21 deletions salt/modules/icinga2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import subprocess

# Import Salt libs
import salt.utils.path
import salt.utils.platform
from salt.utils.icinga2 import get_certs_path

log = logging.getLogger(__name__)

Expand All @@ -32,18 +32,6 @@ def __virtual__():
return (False, 'Icinga2 not installed.')


def _execute(cmd, ret_code=False):
process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
if ret_code:
return process.wait()
output, error = process.communicate()
if output:
log.debug(output)
return output
log.debug(error)
return error


def generate_ticket(domain):
'''
Generate and save an icinga2 ticket.
Expand All @@ -58,7 +46,7 @@ def generate_ticket(domain):
salt '*' icinga2.generate_ticket domain.tld

'''
result = _execute(["icinga2", "pki", "ticket", "--cn", domain])
result = __salt__['cmd.run_all'](["icinga2", "pki", "ticket", "--cn", domain], python_shell=False)
return result


Expand All @@ -76,7 +64,7 @@ def generate_cert(domain):
salt '*' icinga2.generate_cert domain.tld

'''
result = _execute(["icinga2", "pki", "new-cert", "--cn", domain, "--key", "/etc/icinga2/pki/{0}.key".format(domain), "--cert", "/etc/icinga2/pki/{0}.crt".format(domain)], ret_code=True)
result = __salt__['cmd.run_all'](["icinga2", "pki", "new-cert", "--cn", domain, "--key", "{0}{1}.key".format(get_certs_path(), domain), "--cert", "{0}{1}.crt".format(get_certs_path(), domain)], python_shell=False)
return result


Expand All @@ -94,8 +82,8 @@ def save_cert(domain, master):
salt '*' icinga2.save_cert domain.tld master.domain.tld

'''
result = _execute(["icinga2", "pki", "save-cert", "--key", "/etc/icinga2/pki/{0}.key".format(domain), "--cert", "/etc/icinga2/pki/{0}.cert".format(domain), "--trustedcert",
"/etc/icinga2/pki/trusted-master.crt", "--host", master], ret_code=True)
result = __salt__['cmd.run_all'](["icinga2", "pki", "save-cert", "--key", "{0}{1}.key".format(get_certs_path(), domain), "--cert", "{0}{1}.cert".format(get_certs_path(), domain), "--trustedcert",
"{0}trusted-master.crt".format(get_certs_path()), "--host", master], python_shell=False)
return result


Expand All @@ -114,8 +102,8 @@ def request_cert(domain, master, ticket, port):
salt '*' icinga2.request_cert domain.tld master.domain.tld TICKET_ID

'''
result = _execute(["icinga2", "pki", "request", "--host", master, "--port", port, "--ticket", ticket, "--key", "/etc/icinga2/pki/{0}.key".format(domain), "--cert",
"/etc/icinga2/pki/{0}.crt".format(domain), "--trustedcert", "/etc/icinga2/pki/trusted-master.crt", "--ca", "/etc/icinga2/pki/ca.crt"], ret_code=True)
result = __salt__['cmd.run_all'](["icinga2", "pki", "request", "--host", master, "--port", port, "--ticket", ticket, "--key", "{0}{1}.key".format(get_certs_path(), domain), "--cert",
"{0}{1}.crt".format(get_certs_path(), domain), "--trustedcert", "{0}trusted-master.crt".format(get_certs_path()), "--ca", "{0}ca.crt".format(get_certs_path())], python_shell=False)
return result


Expand All @@ -134,6 +122,6 @@ def node_setup(domain, master, ticket):
salt '*' icinga2.node_setup domain.tld master.domain.tld TICKET_ID

'''
result = _execute(["icinga2", "node", "setup", "--ticket", ticket, "--endpoint", master, "--zone", domain, "--master_host", master, "--trustedcert", "/etc/icinga2/pki/trusted-master.crt"],
ret_code=True)
result = __salt__['cmd.run_all'](["icinga2", "node", "setup", "--ticket", ticket, "--endpoint", master, "--zone", domain, "--master_host", master, "--trustedcert", "{0}trusted-master.crt".format(get_certs_path())],
python_shell=False)
return result
2 changes: 1 addition & 1 deletion salt/modules/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ def user_grants(user,
return False

ret = []
results = cur.fetchall()
results = salt.utils.data.decode(cur.fetchall())
for grant in results:
tmp = grant[0].split(' IDENTIFIED BY')[0]
if 'WITH GRANT OPTION' in grant[0] and 'WITH GRANT OPTION' not in tmp:
Expand Down
13 changes: 7 additions & 6 deletions salt/modules/ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import re

# Import salt libs
import salt.utils.data
from salt.exceptions import SaltInvocationError, CommandExecutionError

# Import third party libs
Expand Down Expand Up @@ -53,9 +54,9 @@ def _get_proc_cmdline(proc):
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return proc.cmdline() if PSUTIL2 else proc.cmdline
return salt.utils.data.decode(proc.cmdline() if PSUTIL2 else proc.cmdline)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return ''
return []


def _get_proc_create_time(proc):
Expand All @@ -65,7 +66,7 @@ def _get_proc_create_time(proc):
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return proc.create_time() if PSUTIL2 else proc.create_time
return salt.utils.data.decode(proc.create_time() if PSUTIL2 else proc.create_time)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return None

Expand All @@ -77,7 +78,7 @@ def _get_proc_name(proc):
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return proc.name() if PSUTIL2 else proc.name
return salt.utils.data.decode(proc.name() if PSUTIL2 else proc.name)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return []

Expand All @@ -89,7 +90,7 @@ def _get_proc_status(proc):
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return proc.status() if PSUTIL2 else proc.status
return salt.utils.data.decode(proc.status() if PSUTIL2 else proc.status)
except (psutil.NoSuchProcess, psutil.AccessDenied):
return None

Expand All @@ -101,7 +102,7 @@ def _get_proc_username(proc):
It's backward compatible with < 2.0 versions of psutil.
'''
try:
return proc.username() if PSUTIL2 else proc.username
return salt.utils.data.decode(proc.username() if PSUTIL2 else proc.username)
except (psutil.NoSuchProcess, psutil.AccessDenied, KeyError):
return None

Expand Down
11 changes: 6 additions & 5 deletions salt/modules/virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,11 +1976,12 @@ def update(name,
need_update = True

# Update the memory, note that libvirt outputs all memory sizes in KiB
mem_node = desc.find('memory')
if mem and int(mem_node.text) != mem * 1024:
mem_node.text = six.text_type(mem)
mem_node.set('unit', 'MiB')
need_update = True
for mem_node_name in ['memory', 'currentMemory']:
mem_node = desc.find(mem_node_name)
if mem and int(mem_node.text) != mem * 1024:
mem_node.text = six.text_type(mem)
mem_node.set('unit', 'MiB')
need_update = True

# Update the XML definition with the new disks and diff changes
devices_node = desc.find('devices')
Expand Down
Loading