|
13 | 13 | Text, Tuple, Union, cast)
|
14 | 14 |
|
15 | 15 | import requests.sessions
|
16 |
| -from six import itervalues, string_types |
| 16 | +from six import iteritems, itervalues, string_types |
17 | 17 | from six.moves import urllib
|
18 | 18 |
|
19 | 19 | import schema_salad.schema as schema
|
@@ -220,6 +220,33 @@ def validate_document(document_loader, # type: Loader
|
220 | 220 |
|
221 | 221 | workflowobj = fetch_document(uri, fetcher_constructor=fetcher_constructor)[1]
|
222 | 222 |
|
| 223 | + def var_spool_cwl_detector(obj, # type: Union[Mapping, Iterable, Text] |
| 224 | + item=None, # type: Optional[Any] |
| 225 | + obj_key=None, # type: Optional[Any] |
| 226 | + ): # type: (...)->None |
| 227 | + """ Detects any textual reference to /var/spool/cwl. """ |
| 228 | + if isinstance(obj, string_types): |
| 229 | + if "var/spool/cwl" in obj: |
| 230 | + message = SourceLine( |
| 231 | + item=item, key=obj_key, raise_type=Text, |
| 232 | + include_traceback=_logger.isEnabledFor(logging.DEBUG)).makeError( |
| 233 | + "Non-portable reference to /var/spool/cwl found: " |
| 234 | + "'{}'.\n Replace with /var/spool/cwl/ with " |
| 235 | + "$(runtime.outdir).".format(obj)) |
| 236 | + if not strict: |
| 237 | + _logger.warning(message) |
| 238 | + else: |
| 239 | + raise ValidationException(message) |
| 240 | + else: |
| 241 | + return |
| 242 | + elif isinstance(obj, Mapping): |
| 243 | + for key, value in iteritems(obj): |
| 244 | + var_spool_cwl_detector(value, obj, key) |
| 245 | + elif isinstance(obj, Iterable): |
| 246 | + for element in obj: |
| 247 | + var_spool_cwl_detector(element, obj, None) |
| 248 | + var_spool_cwl_detector(workflowobj) |
| 249 | + |
223 | 250 | fileuri = urllib.parse.urldefrag(uri)[0]
|
224 | 251 | if "cwlVersion" not in workflowobj:
|
225 | 252 | if metadata and 'cwlVersion' in metadata:
|
|
0 commit comments