Skip to content

Commit

Permalink
Bugfix run/system-test: Don't create a directory with the name of the…
Browse files Browse the repository at this point in the history
… temp file
  • Loading branch information
daniel-albuschat committed Nov 11, 2020
1 parent 03a3d81 commit 40f7fca
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kubedev/utils/kubedev_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ def get_docker_run_volumes_list(image, file_accessor, shell_executor):
:param image: One entry returned from KubedevConfig.get_images()
"""
def create_and_normalize(path: str) -> str:
file_accessor.mkdirhier(path)
procFile = file_accessor.load_file('/proc/version')
procVersion = procFile if procFile is not None else ""
if "Microsoft" in procVersion:
Expand All @@ -208,12 +207,12 @@ def get_path(hostPath, containerPathSpec) -> str:
path = containerPathSpec['path']
if 'content' in containerPathSpec:
tempFilePath = os.path.join('.kubedev', f'temp_{hostPath}')
effectiveHostPath = create_and_normalize(tempFilePath)
file_accessor.save_file(tempFilePath, content=containerPathSpec['content'], overwrite=True)
effectiveHostPath = create_and_normalize(tempFilePath)
elif 'base64' in containerPathSpec:
tempFilePath = os.path.join('.kubedev', f'temp_{hostPath}')
effectiveHostPath = create_and_normalize(os.path.join('.kubedev', f'temp_{hostPath}'))
file_accessor.save_file(tempFilePath, content=b64decode(containerPathSpec['base64']).decode('utf-8'), overwrite=True)
effectiveHostPath = create_and_normalize(os.path.join('.kubedev', f'temp_{hostPath}'))
else:
effectiveHostPath = create_and_normalize(hostPath)
suffix = ':ro' if 'readOnly' in containerPathSpec and containerPathSpec['readOnly'] == True else ''
Expand Down

0 comments on commit 40f7fca

Please sign in to comment.