1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-12-24 10:13:00 +00:00

double quote consistency

This commit is contained in:
Jörn-Michael Miehe 2022-01-27 17:57:35 +01:00
parent a35ba188b0
commit 36bb28ee90
4 changed files with 14 additions and 14 deletions

View file

@ -18,7 +18,7 @@ RE_VARNAME = r"^[A-Za-z](?:[A-Za-z0-9\._-]*[A-Za-z0-9])$"
# location of "kiwi_scp" module
KIWI_ROOT = os.path.dirname(__file__)
# default name of kiwi-scp file
KIWI_CONF_NAME = os.getenv('KIWI_CONF_NAME', "kiwi.yml")
KIWI_CONF_NAME = os.getenv("KIWI_CONF_NAME", "kiwi.yml")
# default name of compose files
COMPOSE_FILE_NAME = "docker-compose.yml"
@ -31,7 +31,7 @@ DEFAULT_KIWI_CONF_NAME = f"{KIWI_ROOT}/data/etc/kiwi_default.yml"
DEFAULT_DOCKER_COMPOSE_NAME = f"{KIWI_ROOT}/data/etc/docker-compose_default.yml"
# special config directory
CONF_DIRECTORY_NAME = 'config'
CONFIG_DIRECTORY_NAME = "config"
# location for auxiliary Dockerfiles
IMAGES_DIRECTORY_NAME = f"{KIWI_ROOT}/data/images"
@ -45,5 +45,5 @@ RESERVED_PROJECT_NAMES = [
# DOCKER IMAGE NAMES
# name for auxiliary docker images
LOCAL_IMAGES_NAME = 'localhost/kiwi-scp/auxiliary'
DEFAULT_IMAGE_NAME = 'alpine:latest'
LOCAL_IMAGES_NAME = "localhost/kiwi-scp/auxiliary"
DEFAULT_IMAGE_NAME = "alpine:latest"

View file

@ -39,7 +39,7 @@ class ShellCommand(KiwiCommand):
# shells from KiwiConfig
shells = [
*(str(path) for path in instance.config.shells),
# as a last resort, fall back to '/bin/sh' and 'sh'
# as a last resort, fall back to "/bin/sh" and "sh"
"/bin/sh", "sh",
]

View file

@ -30,12 +30,12 @@ class Rootkit:
@functools.lru_cache(maxsize=None)
def __exists(image_tag: str) -> bool:
ps = DOCKER_EXE.run([
'images',
'--filter', f"reference={Rootkit.__image_name(image_tag)}",
'--format', '{{.Repository}}:{{.Tag}}'
"images",
"--filter", f"reference={Rootkit.__image_name(image_tag)}",
"--format", "{{.Repository}}:{{.Tag}}"
], stdout=subprocess.PIPE)
return str(ps.stdout, 'utf-8').strip() == Rootkit.__image_name(image_tag)
return str(ps.stdout, "utf-8").strip() == Rootkit.__image_name(image_tag)
def __build_image(self) -> None:
if Rootkit.__exists(self.image_tag):
@ -44,15 +44,15 @@ class Rootkit:
if self.image_tag is None:
_logger.info(f"Pulling image {Rootkit.__image_name(self.image_tag)}")
DOCKER_EXE.run([
'pull', Rootkit.__image_name(self.image_tag)
"pull", Rootkit.__image_name(self.image_tag)
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
else:
_logger.info(f"Building image {Rootkit.__image_name(self.image_tag)}")
DOCKER_EXE.run([
'build',
'-t', Rootkit.__image_name(self.image_tag),
'-f', f"{IMAGES_DIRECTORY_NAME}/{self.image_tag}.Dockerfile",
"build",
"-t", Rootkit.__image_name(self.image_tag),
"-f", f"{IMAGES_DIRECTORY_NAME}/{self.image_tag}.Dockerfile",
f"{IMAGES_DIRECTORY_NAME}"
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

View file

@ -25,7 +25,7 @@ class YAML(ruamel.yaml.YAML):
@staticmethod
def _format_kiwi_yml(yml_string: str) -> str:
# insert newline before every main key
yml_string = re.sub(r'^(\S)', r'\n\1', yml_string, flags=re.MULTILINE)
yml_string = re.sub(r"^(\S)", r"\n\1", yml_string, flags=re.MULTILINE)
# load header comment from file
with open(HEADER_KIWI_CONF_NAME, 'r') as stream: