]> git.openstreetmap.org Git - chef.git/blob - cookbooks/planet/templates/default/apache-latest-planet-filename.erb
planet: increase AWS upload max_bandwidth
[chef.git] / cookbooks / planet / templates / default / apache-latest-planet-filename.erb
1 #!/usr/bin/python3
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 import os
6 import sys
7
8 def main():
9     for line in sys.stdin:
10         path = line.strip()
11
12         # Construct the file path and resolve its real path,
13         # which will consider any symbolic links
14         file = os.path.realpath(f"/store/planet{path}")
15
16         # Check if the constructed file path starts with '/store/planet'
17         # and if the file actually exists
18         if file.startswith('/store/planet') and os.path.isfile(file):
19             # Print the portion of the path after '/store/planet'
20             # and immediately flush the output
21             print(file[len('/store/planet'):], flush=True)
22         else:
23             # If the file does not exist or the path does not start with
24             # the expected prefix, print "NULL" and flush the output
25             print("NULL", flush=True)
26
27 if __name__ == "__main__":
28     main()