From 50677a2a3edeecb0987325bd9989ed435412fa57 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Tue, 25 Jan 2022 11:33:21 +0100 Subject: [PATCH] Restore config fix for windows --- cbpi/__init__.py | 2 +- cbpi/cli.py | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cbpi/__init__.py b/cbpi/__init__.py index f1ec938..3d3d1cb 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.1.4" +__version__ = "4.0.1.5" diff --git a/cbpi/cli.py b/cbpi/cli.py index 2758b2f..9b28fc6 100644 --- a/cbpi/cli.py +++ b/cbpi/cli.py @@ -10,6 +10,7 @@ from cbpi.utils.utils import load_config from zipfile import ZipFile from cbpi.craftbeerpi import CraftBeerPi import os +import platform import pathlib import shutil import yaml @@ -152,14 +153,19 @@ def check_for_setup(): if zip_content == True: print("Found correct content. Starting Restore process") output_path = pathlib.Path(os.path.join(".", 'config')) - owner = output_path.owner() - group = output_path.group() + system = platform.system() + print(system) + if system != "Windows": + owner = output_path.owner() + group = output_path.group() print("Removing old config folder") shutil.rmtree(output_path, ignore_errors=True) print("Extracting zip file to config folder") zip.extractall(output_path) - print("Changing owner and group of config folder recursively to {}:{}".format(owner,group)) - recursive_chown(output_path, owner, group) + zip.close() + if system != "Windows": + print("Changing owner and group of config folder recursively to {}:{}".format(owner,group)) + recursive_chown(output_path, owner, group) print("Removing backup file") os.remove(backupfile) else: