Browse Source

Merge "Add exclusions to the unused param warning" into stable/queens

tags/9.3.1
Zuul 1 week ago
parent
commit
eb9abecdd2
2 changed files with 23 additions and 5 deletions
  1. 10
    0
      tripleoclient/constants.py
  2. 13
    5
      tripleoclient/workflows/parameters.py

+ 10
- 0
tripleoclient/constants.py View File

@@ -74,3 +74,13 @@ DEPRECATED_SERVICES = {"OS::TripleO::Services::OpenDaylightApi":
74 74
                        "alternatives such as OVS or OVN. "}
75 75
 
76 76
 DEFAULT_VALIDATIONS_BASEDIR = '/usr/share/openstack-tripleo-validations'
77
+
78
+# regex patterns to exclude when looking for unused params
79
+# - exclude *Image params as they may be unused because the service is not
80
+#   enabled
81
+# - exclude SwiftFetchDir*Tempurl because it's used by ceph and generated by us
82
+# - exclude PythonInterpreter because it's generated by us and only used
83
+#   in some custom scripts
84
+UNUSED_PARAMETER_EXCLUDES_RE = ['^(Docker|Container).*Image$',
85
+                                '^SwiftFetchDir(Get|Put)Tempurl$',
86
+                                '^PythonInterpreter$']

+ 13
- 5
tripleoclient/workflows/parameters.py View File

@@ -9,8 +9,10 @@
9 9
 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 10
 # License for the specific language governing permissions and limitations
11 11
 # under the License.
12
+import re
12 13
 import yaml
13 14
 
15
+from tripleoclient.constants import UNUSED_PARAMETER_EXCLUDES_RE
14 16
 from tripleoclient import exceptions
15 17
 from tripleoclient.workflows import base
16 18
 
@@ -123,9 +125,15 @@ def check_deprecated_parameters(clients, container):
123 125
             print('\n'.join(['  {}'.format(param)
124 126
                             for param in deprecated_params]))
125 127
 
128
+        # exclude our known params that may not be used
129
+        ignore_re = re.compile('|'.join(UNUSED_PARAMETER_EXCLUDES_RE))
130
+        unused_params = [p for p in unused_params if not ignore_re.search(p)]
131
+
126 132
         if unused_params:
127
-            print('WARNING: Following parameters are defined but not used in '
128
-                  'plan. Could be possible that parameter is valid but '
129
-                  'currently not used.')
130
-            print('\n'.join(['  {}'.format(param)
131
-                            for param in unused_params]))
133
+            unused_join = ', '.join(
134
+                ['{param}'.format(param=param) for param in unused_params])
135
+            print('WARNING: Following parameter(s) are defined but not '
136
+                  'currently used in the deployment plan. These parameters '
137
+                  'may be valid but not in use due to the service or '
138
+                  'deployment configuration.'
139
+                  ' {unused_join}'.format(unused_join=unused_join))

Loading…
Cancel
Save