Merge pull request #25273 from basepi/merge-forward-develop

Merge forward from 2015.8 to develop
This commit is contained in:
Colton Myers 2015-07-08 18:59:28 -06:00
commit 0654ef5a08
7 changed files with 34 additions and 101 deletions

View file

@ -44,7 +44,6 @@ from salt.exceptions import (
SaltCloudExecutionFailure,
SaltCloudExecutionTimeout
)
from salt.utils import warn_until
# Import Third Party Libs
try:
@ -80,22 +79,12 @@ def get_configured_provider():
'''
Return the first configured instance.
'''
configuration = config.is_provider_configured(
return config.is_provider_configured(
__opts__,
__active_provider_name__ or 'digital_ocean',
('personal_access_token',)
)
if configuration:
warn_until(
'Beryllium',
'The digital_ocean driver is deprecated and will be removed in Salt Beryllium. '
'Please convert your digital ocean provider configs to use the digital_ocean_v2 '
'driver.'
)
return configuration
def avail_locations(call=None):
'''

View file

@ -1172,7 +1172,8 @@ def _create_eni_if_necessary(interface):
params = {'SubnetId': interface['SubnetId']}
for k in ('Description', 'PrivateIpAddress',
'SecondaryPrivateIpAddressCount'):
'SecondaryPrivateIpAddressCount',
'SourceDestCheck'):
if k in interface:
params[k] = interface[k]

View file

@ -690,10 +690,14 @@ def reformat_node(item=None, full=False):
item[key] = None
# remove all the extra key value pairs to provide a brief listing
to_del = []
if not full:
for key in six.iterkeys(item): # iterate over a copy of the keys
if key not in desired_keys:
del item[key]
to_del.append(key)
for key in to_del:
del item[key]
if 'state' in item:
item['state'] = joyent_node_state(item['state'])

View file

@ -97,7 +97,7 @@ def _validate_partition_boundary(boundary):
)
def probe(*devices, **kwargs):
def probe(*devices):
'''
Ask the kernel to update its local partition data. When no args are
specified all block devices are tried.
@ -113,13 +113,6 @@ def probe(*devices, **kwargs):
salt '*' partition.probe /dev/sda
salt '*' partition.probe /dev/sda /dev/sdb
'''
salt.utils.kwargs_warn_until(kwargs, 'Beryllium')
if 'device' in kwargs:
devices = tuple([kwargs['device']] + list(devices))
del kwargs['device']
if kwargs:
raise TypeError("probe() takes no keyword arguments")
for device in devices:
_validate_device(device)
@ -128,26 +121,6 @@ def probe(*devices, **kwargs):
return out
def part_list(device, unit=None):
'''
Deprecated. Calls partition.list.
CLI Examples:
.. code-block:: bash
salt '*' partition.part_list /dev/sda
salt '*' partition.part_list /dev/sda unit=s
salt '*' partition.part_list /dev/sda unit=kB
'''
salt.utils.warn_until(
'Beryllium',
'''The \'part_list\' function has been deprecated in favor of
\'list_\'. Please update your code and configs to reflect this.''')
return list_(device, unit)
def list_(device, unit=None):
'''
partition.list device unit

View file

@ -516,20 +516,29 @@ def present(
scaling_policies,
scaling_policies_from_pillar
)
updated, msg = __salt__['boto_asg.update'](name, launch_config_name,
availability_zones, min_size,
max_size, desired_capacity,
load_balancers,
default_cooldown,
health_check_type,
health_check_period,
placement_group,
vpc_zone_identifier, tags,
termination_policies,
suspended_processes,
scaling_policies, region,
notification_arn, notification_types,
key, keyid, profile)
updated, msg = __salt__['boto_asg.update'](
name,
launch_config_name,
availability_zones,
min_size,
max_size,
desired_capacity=desired_capacity,
load_balancers=load_balancers,
default_cooldown=default_cooldown,
health_check_type=health_check_type,
health_check_period=health_check_period,
placement_group=placement_group,
vpc_zone_identifier=vpc_zone_identifier,
tags=tags,
termination_policies=termination_policies,
suspended_processes=suspended_processes,
scaling_policies=scaling_policies,
notification_arn=notification_arn,
notification_types=notification_types,
region=region,
key=key,
keyid=keyid,
profile=profile)
if asg['launch_config_name'] != launch_config_name:
# delete the old launch_config_name
deleted = __salt__['boto_asg.delete_launch_configuration'](asg['launch_config_name'], region, key, keyid, profile)

View file

@ -394,6 +394,7 @@ def query(url,
auth_password=password,
body=data,
validate_cert=verify_ssl,
allow_nonstandard_methods=True,
**req_kwargs
)
except tornado.httpclient.HTTPError as exc:

View file

@ -84,7 +84,7 @@ class PartedTestCase(TestCase):
@patch('salt.modules.parted._validate_device', MagicMock())
def test_probe_w_single_arg(self):
parted.probe("/dev/sda")
parted.probe('/dev/sda')
self.cmdrun.assert_called_once_with('partprobe -- /dev/sda')
@patch('salt.modules.parted._validate_device', MagicMock())
@ -92,50 +92,6 @@ class PartedTestCase(TestCase):
parted.probe('/dev/sda', '/dev/sdb')
self.cmdrun.assert_called_once_with('partprobe -- /dev/sda /dev/sdb')
@staticmethod
def check_kwargs_warn_until_devices(device_kwargs):
def check_args(kwargs, version):
assert kwargs == device_kwargs
assert version == 'Beryllium'
parted.salt.utils.kwargs_warn_until.side_effect = check_args
@patch('salt.utils.kwargs_warn_until')
@patch('salt.modules.parted._validate_device', MagicMock())
def test_probe_w_device_kwarg(self, *args, **kwargs):
device_kwargs = {'device': '/dev/sda'}
parted.probe(**device_kwargs)
self.check_kwargs_warn_until_devices(device_kwargs)
self.cmdrun.assert_called_once_with('partprobe -- /dev/sda')
@patch('salt.utils.kwargs_warn_until')
@patch('salt.modules.parted._validate_device', MagicMock())
def test_probe_w_device_kwarg_and_arg(self, *args, **kwargs):
'''device arg is concatenated with positional args'''
device_kwargs = {'device': '/dev/sda'}
parted.probe("/dev/sdb", **device_kwargs)
self.check_kwargs_warn_until_devices(device_kwargs)
self.cmdrun.assert_called_once_with('partprobe -- /dev/sda /dev/sdb')
@patch('salt.utils.kwargs_warn_until')
def test_probe_w_extra_kwarg(self, *args, **kwargs):
device_kwargs = {'foo': 'bar'}
self.assertRaises(TypeError, parted.probe, **device_kwargs)
self.check_kwargs_warn_until_devices(device_kwargs)
self.assertFalse(self.cmdrun.called)
# Test part_list function
@patch('salt.modules.parted.list_')
@patch('salt.utils.warn_until')
def test_part_list(self, *args, **kwargs):
'''Function should call new function and raise deprecation warning'''
parted.part_list("foo", "bar")
parted.list_.assert_called_once_with("foo", "bar")
parted.salt.utils.warn_until.assert_called_once_with(
'Beryllium',
'''The \'part_list\' function has been deprecated in favor of
\'list_\'. Please update your code and configs to reflect this.''')
# Test _list function
@staticmethod