Merge "Add exclusions to the unused param warning"
This commit is contained in:
commit
47123f5840
|
@ -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