Merge pull request #7011 from johscheuer/add-is-present-method-sidecar
Add sidecar method to check if a file is present
This commit is contained in:
commit
9665786785
packaging/docker
|
@ -518,10 +518,16 @@ class Server(BaseHTTPRequestHandler):
|
|||
return
|
||||
if self.path.startswith("/check_hash/"):
|
||||
try:
|
||||
self.send_text(check_hash(self.path[12:]), add_newline=False)
|
||||
self.send_text(check_hash(os.path.basename(self.path)), add_newline=False)
|
||||
except FileNotFoundError:
|
||||
self.send_error(404, "Path not found")
|
||||
self.end_headers()
|
||||
if self.path.startswith("/is_present/"):
|
||||
if is_present(os.path.basename(self.path))):
|
||||
self.send_text("OK")
|
||||
else:
|
||||
self.send_error(404, "Path not found")
|
||||
self.end_headers()
|
||||
elif self.path == "/ready":
|
||||
self.send_text(ready())
|
||||
elif self.path == "/substitutions":
|
||||
|
@ -599,6 +605,10 @@ def check_hash(filename):
|
|||
return m.hexdigest()
|
||||
|
||||
|
||||
def is_present(filename):
|
||||
return os.path.exists(os.path.join(Config.shared().output_dir, filename))
|
||||
|
||||
|
||||
def copy_files():
|
||||
config = Config.shared()
|
||||
if config.require_not_empty:
|
||||
|
|
Loading…
Reference in New Issue