Deprecate group:os-apply-config with config-download

Instead of throwing an exception when a group:os-apply-config deployment
is found with config-download, just show a deprecation warning instead.
This will allow FFU to move forward without forcing users to update
older nic config templates that still use group:os-apply-config.

Change-Id: Icc803605b88d0655bfd45bdf1521298229a4722e
Closes-Bug: #1748976
This commit is contained in:
James Slagle 2018-02-13 10:45:02 -05:00
parent 09c28480df
commit b782c388c7
3 changed files with 18 additions and 6 deletions

View File

@ -0,0 +1,4 @@
---
deprecations:
- group:os-apply-config deployments are deprecated for use with
config-download and they will not be applied.

View File

@ -15,13 +15,13 @@ import fixtures
import mock
import os
import uuid
import warnings
import yaml
from mock import call
from mock import patch
from tripleo_common import constants
from tripleo_common import exception
from tripleo_common.tests import base
from tripleo_common.tests.fake_config import fakes
from tripleo_common.utils import config as ooo_config
@ -345,5 +345,8 @@ class TestConfig(base.TestCase):
mock_config_dict.side_effect = self._get_config_dict
self.tmp_dir = self.useFixture(fixtures.TempDir()).path
self.assertRaises(exception.GroupOsApplyConfigException,
self.config.download_config, stack, self.tmp_dir)
with warnings.catch_warnings(record=True) as w:
self.config.download_config(stack, self.tmp_dir)
self.assertEqual(1, len(w))
assert issubclass(w[-1].category, DeprecationWarning)
assert "group:os-apply-config is deprecated" in str(w[-1].message)

View File

@ -19,12 +19,15 @@ import re
import shutil
import six
import tempfile
import warnings
import yaml
import jinja2
from tripleo_common import constants
from tripleo_common import exception
warnings.filterwarnings('once')
class Config(object):
@ -290,8 +293,10 @@ class Config(object):
d['scalar'] = True
if d['group'] == 'os-apply-config':
raise exception.GroupOsApplyConfigException(
d['deployment_name'])
message = ("group:os-apply-config is deprecated. "
"Deployment %s will not be applied by "
"config-download." % d['deployment_name'])
warnings.warn(message, DeprecationWarning)
with open(group_var_server_path, 'w') as f:
f.write(group_var_server_template.render(