Add a warning message for the list of unused parameters

Having parameters which are unused may harm sometimes, in case
if a parameters is deprecated in one cycle and removed in the
following and user didn't migrate to the new parameter. But this
also adds the list of parameters which are valid but currently
not used (since the related service is disabled). This patch adds
a warning message to the user to know the list of parameters
which are not used in the current deployment plan.

Change-Id: Id59a016c73fc4847c4ba507b3ec2492eee7234a0
This commit is contained in:
Saravanan KR 2017-08-18 18:49:13 +05:30
parent 930f64cbe7
commit fb94d56227
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Added a warning message to provide the list of parameters which are
not used in a deployment plan, but provided by the user via environments.

View File

@ -117,14 +117,23 @@ def check_deprecated_parameters(clients, container):
messages = base.wait_for_messages(workflow_client, ws, execution, 120)
deprecated_params = []
unused_params = []
for message in messages:
if message['status'] == 'SUCCESS':
for param in message.get('deprecated', []):
if param.get('user_defined'):
deprecated_params.append(param['parameter'])
unused_params = message.get('unused', [])
if deprecated_params:
print('WARNING: Following parameters are deprecated and still '
'defined. Deprecated parameters will be removed soon!')
print('\n'.join([' {}'.format(param)
for param in deprecated_params]))
if unused_params:
print('WARNING: Following parameters are defined but not used in '
'plan. Could be possible that parameter is valid but '
'currently not used.')
print('\n'.join([' {}'.format(param)
for param in unused_params]))