Bugfix: crashes when OPTIONS.saltdir is a file

This commit is contained in:
Bo Maryniuk 2018-03-12 12:01:57 +01:00
parent e651278015
commit 3050b3a8cf

View File

@ -217,9 +217,6 @@ def main(argv): # pylint: disable=W0613
if scpstat != 0: if scpstat != 0:
sys.exit(EX_SCP_NOT_FOUND) sys.exit(EX_SCP_NOT_FOUND)
if not os.path.exists(OPTIONS.saltdir):
need_deployment()
if not os.path.isdir(OPTIONS.saltdir): if not os.path.isdir(OPTIONS.saltdir):
sys.stderr.write( sys.stderr.write(
'ERROR: salt path "{0}" exists but is' 'ERROR: salt path "{0}" exists but is'
@ -227,6 +224,9 @@ def main(argv): # pylint: disable=W0613
) )
sys.exit(EX_CANTCREAT) sys.exit(EX_CANTCREAT)
if not os.path.exists(OPTIONS.saltdir):
need_deployment()
version_path = os.path.normpath(os.path.join(OPTIONS.saltdir, 'version')) version_path = os.path.normpath(os.path.join(OPTIONS.saltdir, 'version'))
if not os.path.exists(version_path) or not os.path.isfile(version_path): if not os.path.exists(version_path) or not os.path.isfile(version_path):
sys.stderr.write( sys.stderr.write(