Add exclusions to the unused param warning
This adds the ability for us to specifically exclude some patterns of parameters from the warning that is generated during the deployment for unused heat params. The params being added are generated by the deployment and not necessarily provided by the end user. The params currently being excluded are: * '^(Docker|Container).*Image$' - container image vars * '^SwiftFetchDir(Get|Put)Tempurl$' - temp url for ceph * '^PythonInterpreter$' - python executable for the deploy The warning message is also slightly adjusted to try and clarify that the vars might be valid but not used due to service or deployment configs. Change-Id: Iad7d97346993b5c95443092b81d056293cdad752 Closes-Bug: #1842754
This commit is contained in:
parent
5075a76366
commit
b25a9a953b
@ -125,3 +125,13 @@ DEPRECATED_SERVICES = {"OS::TripleO::Services::OpenDaylightApi":
|
||||
# clouds_yaml related constants
|
||||
CLOUD_HOME_DIR = os.path.expanduser("~")
|
||||
CLOUDS_YAML_DIR = os.path.join('.config', 'openstack')
|
||||
|
||||
# regex patterns to exclude when looking for unused params
|
||||
# - exclude *Image params as they may be unused because the service is not
|
||||
# enabled
|
||||
# - exclude SwiftFetchDir*Tempurl because it's used by ceph and generated by us
|
||||
# - exclude PythonInterpreter because it's generated by us and only used
|
||||
# in some custom scripts
|
||||
UNUSED_PARAMETER_EXCLUDES_RE = ['^(Docker|Container).*Image$',
|
||||
'^SwiftFetchDir(Get|Put)Tempurl$',
|
||||
'^PythonInterpreter$']
|
||||
|
@ -10,8 +10,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import logging
|
||||
import re
|
||||
import yaml
|
||||
|
||||
from tripleoclient.constants import UNUSED_PARAMETER_EXCLUDES_RE
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.workflows import base
|
||||
|
||||
@ -106,13 +108,18 @@ def check_deprecated_parameters(clients, container):
|
||||
' {deprecated_join}'.format(
|
||||
deprecated_join=deprecated_join))
|
||||
|
||||
# exclude our known params that may not be used
|
||||
ignore_re = re.compile('|'.join(UNUSED_PARAMETER_EXCLUDES_RE))
|
||||
unused_params = [p for p in unused_params if not ignore_re.search(p)]
|
||||
|
||||
if unused_params:
|
||||
unused_join = ', '.join(
|
||||
['{param}'.format(param=param) for param in unused_params])
|
||||
LOG.warning(
|
||||
'WARNING: Following parameter(s) are defined but not used '
|
||||
'in plan. Could be possible that parameter is valid but '
|
||||
'currently not used.'
|
||||
'WARNING: Following parameter(s) are defined but not '
|
||||
'currently used in the deployment plan. These parameters '
|
||||
'may be valid but not in use due to the service or '
|
||||
'deployment configuration.'
|
||||
' {unused_join}'.format(unused_join=unused_join))
|
||||
|
||||
if invalid_role_specific_params:
|
||||
|
Loading…
Reference in New Issue
Block a user