Repository: common-workflow-language/cwltool

Issue:
AttributeError: module 'schema_salad.validate' has no attribute 'indent'
I made a mistake in a CWL file, but now I get an error related to schema_salad which doesn't seem valid:
```
$  venv/bin/cwltool --debug workflow.cwl
INFO venv/bin/cwltool 1.0.20191022103248
INFO Resolved 'workflow.cwl' to 'file:///Users/gijs/Work/demo_cwl/workflow.cwl'
ERROR Validation exception
Traceback (most recent call last):
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 641, in __init__
    toolpath_object["run"], loadingContext)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/load_tool.py", line 372, in load_tool
    loadingContext, workflowobj, uri)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/load_tool.py", line 291, in resolve_and_validate_document
    processobj, metadata = document_loader.resolve_all(workflowobj, fileuri)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/schema_salad/ref_resolver.py", line 1203, in resolve_all
    strict_foreign_properties=strict_foreign_properties,
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/schema_salad/ref_resolver.py", line 1426, in validate_links
    raise errors[0]
schema_salad.exceptions.ValidationException: first.cwl:7:1:  checking field `inputs`
first.cwl:12:3:   checking object `first.cwl#a_string_argument`
first.cwl:13:5:     Field `type` references unknown identifier `str`, tried
                    file:///Users/gijs/Work/demo_cwl/first.cwl#str
ERROR I'm sorry, I couldn't load this CWL file.
The error was:
Traceback (most recent call last):
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 641, in __init__
    toolpath_object["run"], loadingContext)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/load_tool.py", line 372, in load_tool
    loadingContext, workflowobj, uri)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/load_tool.py", line 291, in resolve_and_validate_document
    processobj, metadata = document_loader.resolve_all(workflowobj, fileuri)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/schema_salad/ref_resolver.py", line 1203, in resolve_all
    strict_foreign_properties=strict_foreign_properties,
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/schema_salad/ref_resolver.py", line 1426, in validate_links
    raise errors[0]
schema_salad.exceptions.ValidationException: first.cwl:7:1:  checking field `inputs`
first.cwl:12:3:   checking object `first.cwl#a_string_argument`
first.cwl:13:5:     Field `type` references unknown identifier `str`, tried
                    file:///Users/gijs/Work/demo_cwl/first.cwl#str

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/main.py", line 779, in main
    tool = make_tool(uri, loadingContext)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/load_tool.py", line 353, in make_tool
    tool = loadingContext.construct_tool_object(processobj, loadingContext)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 58, in default_make_tool
    return Workflow(toolpath_object, loadingContext)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 543, in __init__
    loadingContext.prov_obj))
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 576, in make_workflow_step
    return WorkflowStep(toolpath_object, pos, loadingContext, parentworkflowProv)
  File "/Users/gijs/Work/demo_cwl/venv/lib/python3.7/site-packages/cwltool/workflow.py", line 647, in __init__
    (toolpath_object["run"], validate.indent(str(vexc)))), vexc)
AttributeError: module 'schema_salad.validate' has no attribute 'indent'
```

```
$  venv/bin/pip freeze | grep salad
schema-salad==4.5.20191204060541
```

Installation method was just `pip install cwltool` in a python3 venv.



Discussion:

Resolving patch:
diff --git a/cwltool/procgenerator.py b/cwltool/procgenerator.py
--- a/cwltool/procgenerator.py
+++ b/cwltool/procgenerator.py
@@ -2,6 +2,7 @@
 from .process import Process, shortname
 from .load_tool import load_tool
 from schema_salad import validate
+from schema_salad.sourceline import indent
 from .errors import WorkflowException
 from .context import RuntimeContext, LoadingContext
 from typing import (Any, Callable, Dict, Generator, Iterable, List,
@@ -82,7 +83,7 @@ def __init__(self,
                 _logger.exception("Validation exception")
             raise WorkflowException(
                 u"Tool definition %s failed validation:\n%s" %
-                (toolpath_object["run"], validate.indent(str(vexc))))
+                (toolpath_object["run"], indent(str(vexc))))
 
     def job(self,
             job_order,         # type: Mapping[Text, Text]
@@ -107,7 +108,7 @@ def result(self,
                 _logger.exception("Validation exception")
             raise WorkflowException(
                 u"Tool definition %s failed validation:\n%s" %
-                (jobout["runProcess"], validate.indent(str(vexc))))
+                (jobout["runProcess"], indent(str(vexc))))
 
         if "runInputs" in jobout:
             runinputs = cast(MutableMapping[Text, Any], jobout["runInputs"])
diff --git a/cwltool/workflow.py b/cwltool/workflow.py
--- a/cwltool/workflow.py
+++ b/cwltool/workflow.py
@@ -15,7 +15,7 @@
 import threading
 from ruamel.yaml.comments import CommentedMap
 from schema_salad import validate
-from schema_salad.sourceline import SourceLine
+from schema_salad.sourceline import SourceLine, indent
 from six import string_types, iteritems
 from six.moves import range
 from future.utils import raise_from
@@ -644,7 +644,7 @@ def __init__(self,
                 _logger.exception("Validation exception")
             raise_from(WorkflowException(
                 u"Tool definition %s failed validation:\n%s" %
-                (toolpath_object["run"], validate.indent(str(vexc)))), vexc)
+                (toolpath_object["run"], indent(str(vexc)))), vexc)
 
         validation_errors = []
         self.tool = toolpath_object = copy.deepcopy(toolpath_object)


Test patch: