Merge "Remove deprecated ansible driver options"
This commit is contained in:
commit
9f90194beb
@ -76,14 +76,6 @@ OPTIONAL_PROPERTIES = {
|
||||
}
|
||||
|
||||
COMMON_PROPERTIES = OPTIONAL_PROPERTIES
|
||||
# TODO(pas-ha) remove in Rocky
|
||||
DEPRECATED_PROPERTIES = {
|
||||
'ansible_deploy_username': {
|
||||
'name': 'ansible_username',
|
||||
'warned': False},
|
||||
'ansible_deploy_key_file': {
|
||||
'name': 'ansible_key_file',
|
||||
'warned': False}}
|
||||
|
||||
|
||||
class PlaybookNotFound(exception.IronicException):
|
||||
@ -96,23 +88,10 @@ def _get_playbooks_path(node):
|
||||
|
||||
|
||||
def _parse_ansible_driver_info(node, action='deploy'):
|
||||
# TODO(pas-ha) remove in Rocky
|
||||
for old, new in DEPRECATED_PROPERTIES.items():
|
||||
if old in node.driver_info:
|
||||
if not new['warned']:
|
||||
LOG.warning("Driver property '%(old)s' is deprecated, "
|
||||
"and will be ignored in Rocky release. "
|
||||
"Use '%(new)s' instead.", old=old, new=new['name'])
|
||||
new['warned'] = True
|
||||
# TODO(pas-ha) simplify in Rocky
|
||||
user = node.driver_info.get(
|
||||
'ansible_username',
|
||||
node.driver_info.get('ansible_deploy_username',
|
||||
CONF.ansible.default_username))
|
||||
key = node.driver_info.get(
|
||||
'ansible_key_file',
|
||||
node.driver_info.get('ansible_deploy_key_file',
|
||||
CONF.ansible.default_key_file))
|
||||
user = node.driver_info.get('ansible_username',
|
||||
CONF.ansible.default_username)
|
||||
key = node.driver_info.get('ansible_key_file',
|
||||
CONF.ansible.default_key_file)
|
||||
playbook = node.driver_info.get('ansible_%s_playbook' % action,
|
||||
getattr(CONF.ansible,
|
||||
'default_%s_playbook' % action,
|
||||
|
@ -92,26 +92,6 @@ class TestAnsibleMethods(AnsibleDeployTestCaseBase):
|
||||
self.assertEqual('spam', user)
|
||||
self.assertEqual('/ham/eggs', key)
|
||||
|
||||
@mock.patch.object(ansible_deploy.LOG, 'warning', autospec=True)
|
||||
def test__parse_ansible_driver_info_deprecated_opts(self, warn_mock):
|
||||
self.node.driver_info[
|
||||
'ansible_deploy_username'] = self.node.driver_info.pop(
|
||||
'ansible_username')
|
||||
self.node.driver_info[
|
||||
'ansible_deploy_key_file'] = self.node.driver_info.pop(
|
||||
'ansible_key_file')
|
||||
playbook, user, key = ansible_deploy._parse_ansible_driver_info(
|
||||
self.node, 'deploy')
|
||||
self.assertEqual(ansible_deploy.CONF.ansible.default_deploy_playbook,
|
||||
playbook)
|
||||
self.assertEqual('test', user)
|
||||
self.assertEqual('/path/key', key)
|
||||
self.assertEqual(2, warn_mock.call_count)
|
||||
# check that we remember about warnings havig been displayed
|
||||
playbook, user, key = ansible_deploy._parse_ansible_driver_info(
|
||||
self.node, 'deploy')
|
||||
self.assertEqual(2, warn_mock.call_count)
|
||||
|
||||
def test__parse_ansible_driver_info_no_playbook(self):
|
||||
self.assertRaises(exception.IronicException,
|
||||
ansible_deploy._parse_ansible_driver_info,
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Deprecated options ``ansible_deploy_username`` and
|
||||
``ansible_deploy_key_file`` in node driver_info for the ``ansible``
|
||||
deploy interface were removed and will be ignored.
|
||||
Use ``ansible_username`` and ``ansible_key_file`` options in the node
|
||||
driver_info respectively.
|
Loading…
Reference in New Issue
Block a user