mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge remote branch 'upstream/2016.11' into 2016.11_43417_Backport_and_Fixes
This commit is contained in:
commit
1dd565e585
12 changed files with 71 additions and 50 deletions
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -12,4 +12,10 @@ Remove this section if not relevant
|
|||
|
||||
Yes/No
|
||||
|
||||
### Commits signed with GPG?
|
||||
|
||||
Yes/No
|
||||
|
||||
Please review [Salt's Contributing Guide](https://docs.saltstack.com/en/latest/topics/development/contributing.html) for best practices.
|
||||
|
||||
See GitHub's [page on GPG signing](https://help.github.com/articles/signing-commits-using-gpg/) for more information about signing commits with GPG.
|
||||
|
|
|
@ -4468,7 +4468,8 @@ def _list_nodes(full=False):
|
|||
pass
|
||||
|
||||
vms[name]['id'] = vm.find('ID').text
|
||||
vms[name]['image'] = vm.find('TEMPLATE').find('TEMPLATE_ID').text
|
||||
if vm.find('TEMPLATE').find('TEMPLATE_ID'):
|
||||
vms[name]['image'] = vm.find('TEMPLATE').find('TEMPLATE_ID').text
|
||||
vms[name]['name'] = name
|
||||
vms[name]['size'] = {'cpu': cpu_size, 'memory': memory_size}
|
||||
vms[name]['state'] = vm.find('STATE').text
|
||||
|
|
|
@ -493,10 +493,17 @@ def update_parameter_group(name, parameters, apply_method="pending-reboot",
|
|||
|
||||
param_list = []
|
||||
for key, value in six.iteritems(parameters):
|
||||
item = (key, value, apply_method)
|
||||
item = odict.OrderedDict()
|
||||
item.update({'ParameterName': key})
|
||||
item.update({'ApplyMethod': apply_method})
|
||||
if type(value) is bool:
|
||||
item.update({'ParameterValue': 'on' if value else 'off'})
|
||||
else:
|
||||
item.update({'ParameterValue': str(value)})
|
||||
param_list.append(item)
|
||||
if not len(param_list):
|
||||
return {'results': False}
|
||||
|
||||
if not len(param_list):
|
||||
return {'results': False}
|
||||
|
||||
try:
|
||||
conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
|
||||
|
@ -781,6 +788,7 @@ def describe_parameters(name, Source=None, MaxRecords=None, Marker=None,
|
|||
'message': 'Could not establish a connection to RDS'}
|
||||
|
||||
kwargs = {}
|
||||
kwargs.update({'DBParameterGroupName': name})
|
||||
for key in ('Marker', 'Source'):
|
||||
if locals()[key] is not None:
|
||||
kwargs[key] = str(locals()[key])
|
||||
|
@ -788,26 +796,23 @@ def describe_parameters(name, Source=None, MaxRecords=None, Marker=None,
|
|||
if locals()['MaxRecords'] is not None:
|
||||
kwargs['MaxRecords'] = int(locals()['MaxRecords'])
|
||||
|
||||
r = conn.describe_db_parameters(DBParameterGroupName=name, **kwargs)
|
||||
pag = conn.get_paginator('describe_db_parameters')
|
||||
pit = pag.paginate(**kwargs)
|
||||
|
||||
if not r:
|
||||
return {'result': False,
|
||||
'message': 'Failed to get RDS parameters for group {0}.'
|
||||
.format(name)}
|
||||
|
||||
results = r['Parameters']
|
||||
keys = ['ParameterName', 'ParameterValue', 'Description',
|
||||
'Source', 'ApplyType', 'DataType', 'AllowedValues',
|
||||
'IsModifieable', 'MinimumEngineVersion', 'ApplyMethod']
|
||||
|
||||
parameters = odict.OrderedDict()
|
||||
ret = {'result': True}
|
||||
for result in results:
|
||||
data = odict.OrderedDict()
|
||||
for k in keys:
|
||||
data[k] = result.get(k)
|
||||
|
||||
parameters[result.get('ParameterName')] = data
|
||||
for p in pit:
|
||||
for result in p['Parameters']:
|
||||
data = odict.OrderedDict()
|
||||
for k in keys:
|
||||
data[k] = result.get(k)
|
||||
|
||||
parameters[result.get('ParameterName')] = data
|
||||
|
||||
ret['parameters'] = parameters
|
||||
return ret
|
||||
|
|
|
@ -863,8 +863,8 @@ def highstate(test=None, queue=False, **kwargs):
|
|||
finally:
|
||||
st_.pop_active()
|
||||
|
||||
if __salt__['config.option']('state_data', '') == 'terse' or \
|
||||
kwargs.get('terse'):
|
||||
if isinstance(ret, dict) and (__salt__['config.option']('state_data', '') == 'terse' or
|
||||
kwargs.get('terse')):
|
||||
ret = _filter_running(ret)
|
||||
|
||||
serial = salt.payload.Serial(__opts__)
|
||||
|
|
|
@ -1230,24 +1230,26 @@ def install(name=None,
|
|||
to_install.append((pkgname, pkgstr))
|
||||
break
|
||||
else:
|
||||
if re.match('kernel(-.+)?', name):
|
||||
# kernel and its subpackages support multiple
|
||||
# installs as their paths do not conflict.
|
||||
# Performing a yum/dnf downgrade will be a no-op
|
||||
# so just do an install instead. It will fail if
|
||||
# there are other interdependencies that have
|
||||
# conflicts, and that's OK. We don't want to force
|
||||
# anything, we just want to properly handle it if
|
||||
# someone tries to install a kernel/kernel-devel of
|
||||
# a lower version than the currently-installed one.
|
||||
# TODO: find a better way to determine if a package
|
||||
# supports multiple installs.
|
||||
to_install.append((pkgname, pkgstr))
|
||||
else:
|
||||
# None of the currently-installed versions are
|
||||
# greater than the specified version, so this is a
|
||||
# downgrade.
|
||||
to_downgrade.append((pkgname, pkgstr))
|
||||
if pkgname is not None:
|
||||
if re.match('kernel(-.+)?', pkgname):
|
||||
# kernel and its subpackages support multiple
|
||||
# installs as their paths do not conflict.
|
||||
# Performing a yum/dnf downgrade will be a
|
||||
# no-op so just do an install instead. It will
|
||||
# fail if there are other interdependencies
|
||||
# that have conflicts, and that's OK. We don't
|
||||
# want to force anything, we just want to
|
||||
# properly handle it if someone tries to
|
||||
# install a kernel/kernel-devel of a lower
|
||||
# version than the currently-installed one.
|
||||
# TODO: find a better way to determine if a
|
||||
# package supports multiple installs.
|
||||
to_install.append((pkgname, pkgstr))
|
||||
else:
|
||||
# None of the currently-installed versions are
|
||||
# greater than the specified version, so this
|
||||
# is a downgrade.
|
||||
to_downgrade.append((pkgname, pkgstr))
|
||||
|
||||
def _add_common_args(cmd):
|
||||
'''
|
||||
|
|
|
@ -3,7 +3,9 @@
|
|||
The local returner is used to test the returner interface, it just prints the
|
||||
return data to the console to verify that it is being passed properly
|
||||
|
||||
To use the local returner, append '--return local' to the salt command. ex:
|
||||
To use the local returner, append '--return local' to the salt command. ex:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' test.ping --return local
|
||||
'''
|
||||
|
|
|
@ -159,7 +159,7 @@ def formatted(name, fs_type='ext4', force=False, **kwargs):
|
|||
ret['result'] = None
|
||||
return ret
|
||||
|
||||
__salt__['disk.format_'](name, fs_type, force=force, **kwargs)
|
||||
__salt__['disk.format'](name, fs_type, force=force, **kwargs)
|
||||
current_fs = __salt__['disk.fstype'](name)
|
||||
|
||||
# Repeat lsblk check up to 10 times with 3s sleeping between each
|
||||
|
|
|
@ -692,7 +692,10 @@ def parameter_present(name, db_parameter_group_family, description, parameters=N
|
|||
changed = {}
|
||||
for items in parameters:
|
||||
for k, value in items.items():
|
||||
params[k] = value
|
||||
if type(value) is bool:
|
||||
params[k] = 'on' if value else 'off'
|
||||
else:
|
||||
params[k] = str(value)
|
||||
logging.debug('Parameters from user are : {0}.'.format(params))
|
||||
options = __salt__['boto_rds.describe_parameters'](name=name, region=region, key=key, keyid=keyid, profile=profile)
|
||||
if not options.get('result'):
|
||||
|
@ -700,8 +703,8 @@ def parameter_present(name, db_parameter_group_family, description, parameters=N
|
|||
ret['comment'] = os.linesep.join([ret['comment'], 'Faled to get parameters for group {0}.'.format(name)])
|
||||
return ret
|
||||
for parameter in options['parameters'].values():
|
||||
if parameter['ParameterName'] in params and str(params.get(parameter['ParameterName'])) != str(parameter['ParameterValue']):
|
||||
logging.debug('Values that are being compared are {0}:{1} .'.format(params.get(parameter['ParameterName']), parameter['ParameterValue']))
|
||||
if parameter['ParameterName'] in params and params.get(parameter['ParameterName']) != str(parameter['ParameterValue']):
|
||||
logging.debug('Values that are being compared for {0} are {1}:{2} .'.format(parameter['ParameterName'], params.get(parameter['ParameterName']), parameter['ParameterValue']))
|
||||
changed[parameter['ParameterName']] = params.get(parameter['ParameterName'])
|
||||
if len(changed) > 0:
|
||||
if __opts__['test']:
|
||||
|
@ -710,9 +713,9 @@ def parameter_present(name, db_parameter_group_family, description, parameters=N
|
|||
return ret
|
||||
update = __salt__['boto_rds.update_parameter_group'](name, parameters=changed, apply_method=apply_method, tags=tags, region=region,
|
||||
key=key, keyid=keyid, profile=profile)
|
||||
if not update:
|
||||
if 'error' in update:
|
||||
ret['result'] = False
|
||||
ret['comment'] = os.linesep.join([ret['comment'], 'Failed to change parameters {0} for group {1}.'.format(changed, name)])
|
||||
ret['comment'] = os.linesep.join([ret['comment'], 'Failed to change parameters {0} for group {1}:'.format(changed, name), update['error']['message']])
|
||||
return ret
|
||||
ret['changes']['Parameters'] = changed
|
||||
ret['comment'] = os.linesep.join([ret['comment'], 'Parameters {0} for group {1} are changed.'.format(changed, name)])
|
||||
|
|
|
@ -260,7 +260,7 @@ def sig4(method, endpoint, params, prov_dict,
|
|||
# Create payload hash (hash of the request body content). For GET
|
||||
# requests, the payload is an empty string ('').
|
||||
if not payload_hash:
|
||||
payload_hash = hashlib.sha256(data).hexdigest()
|
||||
payload_hash = hashlib.sha256(data.encode(__salt_system_encoding__)).hexdigest()
|
||||
|
||||
# Combine elements to create create canonical request
|
||||
canonical_request = '\n'.join((
|
||||
|
@ -278,7 +278,7 @@ def sig4(method, endpoint, params, prov_dict,
|
|||
algorithm,
|
||||
amzdate,
|
||||
credential_scope,
|
||||
hashlib.sha256(canonical_request).hexdigest()
|
||||
hashlib.sha256(canonical_request.encode(__salt_system_encoding__)).hexdigest()
|
||||
))
|
||||
|
||||
# Create the signing key using the function defined above.
|
||||
|
|
|
@ -578,10 +578,9 @@ class CkMinions(object):
|
|||
if search is None:
|
||||
return minions
|
||||
addrs = salt.utils.network.local_port_tcp(int(self.opts['publish_port']))
|
||||
if '127.0.0.1' in addrs or '0.0.0.0' in addrs:
|
||||
# Add in possible ip addresses of a locally connected minion
|
||||
if '127.0.0.1' in addrs:
|
||||
# Add in the address of a possible locally-connected minion.
|
||||
addrs.discard('127.0.0.1')
|
||||
addrs.discard('0.0.0.0')
|
||||
addrs.update(set(salt.utils.network.ip_addrs(include_loopback=include_localhost)))
|
||||
if subset:
|
||||
search = subset
|
||||
|
|
|
@ -278,7 +278,10 @@ def vb_get_network_addresses(machine_name=None, machine=None):
|
|||
# We can't trust virtualbox to give us up to date guest properties if the machine isn't running
|
||||
# For some reason it may give us outdated (cached?) values
|
||||
if machine.state == _virtualboxManager.constants.MachineState_Running:
|
||||
total_slots = int(machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/Count"))
|
||||
try:
|
||||
total_slots = int(machine.getGuestPropertyValue('/VirtualBox/GuestInfo/Net/Count'))
|
||||
except ValueError:
|
||||
total_slots = 0
|
||||
for i in range(total_slots):
|
||||
try:
|
||||
address = machine.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/{0}/V4/IP".format(i))
|
||||
|
|
|
@ -80,7 +80,7 @@ class BlockdevTestCase(TestCase):
|
|||
mock_t = MagicMock(return_value=True)
|
||||
mock_e = MagicMock(return_value='')
|
||||
with patch.dict(blockdev.__salt__, {'cmd.run': mock_ext4,
|
||||
'disk.format_': mock_t,
|
||||
'disk.format': mock_t,
|
||||
'disk.fstype': mock_e}):
|
||||
comt = ('{0} already formatted with '.format(name))
|
||||
ret.update({'comment': comt, 'result': True})
|
||||
|
|
Loading…
Add table
Reference in a new issue