diff --git a/manifests/07-downloads-deployment.yaml b/manifests/07-downloads-deployment.yaml index 0c033c7e7..b33cea0b5 100644 --- a/manifests/07-downloads-deployment.yaml +++ b/manifests/07-downloads-deployment.yaml @@ -63,6 +63,21 @@ spec: signal.signal(signal.SIGTERM, lambda signum, frame: sys.exit(0)) + def write_index(path, message): + with open(path, 'wb') as f: + f.write('\n'.join([ + '', + '', + '', + ' ', + '', + '', + ' {}'.format(message), + '', + '', + '', + ]).encode('utf-8')) + # Launch multiple listeners as threads class Thread(threading.Thread): def __init__(self, i, socket): @@ -93,6 +108,7 @@ spec: os.mkdir(arch) for operating_system in ['linux']: os.mkdir(os.path.join(arch, operating_system)) + content = ['license'] os.symlink('/usr/share/openshift/LICENSE', 'oc-license') for arch, operating_system, path in [ @@ -112,6 +128,23 @@ spec: tar.add(path, basename) with zipfile.ZipFile('{}.zip'.format(archive_path_root), 'w') as zip: zip.write(path, basename) + content.append('oc ({1} {2}) (tar zip)'.format(target_path, arch, operating_system)) + + for root, directories, filenames in os.walk(temp_dir): + root_link = os.path.relpath(temp_dir, os.path.join(root, 'child')).replace(os.path.sep, '/') + for directory in directories: + write_index( + path=os.path.join(root, directory, 'index.html'), + message='

Directory listings are disabled. See here for available content.

'.format(root_link), + ) + write_index( + path=os.path.join(root, 'index.html'), + message='\n'.join( + [''] + ), + ) # Create socket # IPv6 should handle IPv4 passively so long as it is not bound to a