Check spec directory exists before reading spec files (#709)
* Check spec directory exists before reading spec files * Fix spec example
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
set -e
|
||||
|
||||
# check syntax
|
||||
python -m compileall -l ${SRC_PKG}
|
||||
python3 -m compileall -l ${SRC_PKG}
|
||||
|
||||
# install deps
|
||||
pip install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG}
|
||||
pip3 install -r ${SRC_PKG}/requirements.txt -t ${SRC_PKG} && cp -r ${SRC_PKG} ${DEPLOY_PKG}
|
||||
|
||||
@@ -7,6 +7,6 @@ spec:
|
||||
version: 2
|
||||
builder:
|
||||
command: build
|
||||
image: fission/python-build-env-2.7:0.4.0rc
|
||||
image: fission/python-builder
|
||||
runtime:
|
||||
image: fission/python-env-2.7:0.4.0rc
|
||||
image: fission/python-env
|
||||
|
||||
@@ -520,6 +520,12 @@ func (fr *FissionResources) parseYaml(b []byte, loc *location) error {
|
||||
// readSpecs reads all specs in the specified directory and returns a parsed set of
|
||||
// fission resources.
|
||||
func readSpecs(specDir string) (*FissionResources, error) {
|
||||
|
||||
// make sure spec directory exists before continue
|
||||
if _, err := os.Stat(specDir); os.IsNotExist(err) {
|
||||
fatal(fmt.Sprintf("Spec directory %v doesn't exist. Please check directory path or run \"fission spec init\" to create it.", specDir))
|
||||
}
|
||||
|
||||
fr := FissionResources{
|
||||
packages: make([]crd.Package, 0),
|
||||
functions: make([]crd.Function, 0),
|
||||
|
||||
Reference in New Issue
Block a user