kafka_neu-1778570057504.zip-extract/kafka-4.2.0-src/docker/common.py

Path
kafka_neu-1778570057504.zip-extract/kafka-4.2.0-src/docker/common.py
Status
scanned
Type
file
Name
common.py
Extension
.py
Programming language
Python
Mime type
text/x-script.python
File type
Python script, ASCII text executable
Tag

      
    
Rootfs path

      
    
Size
2068 (2.0 KB)
MD5
c2b1e20d8d12722108bd029a98111809
SHA1
fdd431abf86ad060c4d1a502da0e64f46f9e81c2
SHA256
ddbdb01124e53c1b121f510f04f2406caf883c2428d35ef82af2d4245e851769
SHA512

      
    
SHA1_git
5099a789da1037cc929bdc028d3bc217f6d09c31
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
common.py | 2.0 KB |

#!/usr/bin/env python # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import subprocess import tempfile import os import shutil def execute(command): if subprocess.run(command).returncode != 0: raise SystemError("Failure in executing following command:- ", " ".join(command)) def get_input(message): value = input(message) if value == "": raise ValueError("This field cannot be empty") return value def build_docker_image_runner(command, image_type, kafka_archive=None): temp_dir_path = tempfile.mkdtemp() current_dir = os.path.dirname(os.path.realpath(__file__)) shutil.copytree(f"{current_dir}/{image_type}", f"{temp_dir_path}/{image_type}", dirs_exist_ok=True) shutil.copytree(f"{current_dir}/resources", f"{temp_dir_path}/{image_type}/resources", dirs_exist_ok=True) shutil.copy(f"{current_dir}/server.properties", f"{temp_dir_path}/{image_type}") if kafka_archive: shutil.copy(kafka_archive, f"{temp_dir_path}/{image_type}/kafka.tgz") command = command.replace("$DOCKER_FILE", f"{temp_dir_path}/{image_type}/Dockerfile") command = command.replace("$DOCKER_DIR", f"{temp_dir_path}/{image_type}") try: execute(command.split()) except: raise SystemError("Docker Image Build failed") finally: shutil.rmtree(temp_dir_path)
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
40.48
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 10 10