diff options
| author | Antoine Prieels <anp@odoo.com> | 2020-06-05 06:30:20 +0000 |
|---|---|---|
| committer | Antoine Prieels <anp@odoo.com> | 2020-06-05 06:32:18 +0000 |
| commit | ec9759a6c009e32b4867eedd5f4e639416d10cba (patch) | |
| tree | 2407c4d6c7dae42c1117a322cf4c9f49485891fc /addons/hw_drivers | |
| parent | bad8e5a420f9a2da45d1811267e98080c776af6a (diff) | |
[FIX] hw_drivers: Failed checkout and drivers loading
- The checkout to switch to the branch of the connected DB was not
processed correctly because the command used to clear the drivers
failed, raising an exception:
rm: cannot remove '/home/pi/odoo/addons/hw_drivers/drivers/__pycache__': Is a directory
- The location of the drivers has been changed in master. So, even if we
perform a checkout, the addons/hw_drivers/drivers directory doesn't
exist. The get_resource_path('hw_drivers', 'drivers') then returned
False instead of the correct path and the extraction of the zip file
failed.
closes odoo/odoo#52448
Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com>
Diffstat (limited to 'addons/hw_drivers')
| -rw-r--r-- | addons/hw_drivers/tools/helpers.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py index 5641f46b8b3..225c0ea3599 100644 --- a/addons/hw_drivers/tools/helpers.py +++ b/addons/hw_drivers/tools/helpers.py @@ -79,8 +79,8 @@ def check_git_branch(): if db_branch != local_branch: subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"]) - subprocess.check_call(["rm", "/home/pi/odoo/addons/hw_drivers/iot_handlers/drivers/*"]) - subprocess.check_call(["rm", "/home/pi/odoo/addons/hw_drivers/iot_handlers/interfaces/*"]) + subprocess.check_call(["rm", "-rf", "/home/pi/odoo/addons/hw_drivers/iot_handlers/drivers/*"]) + subprocess.check_call(["rm", "-rf", "/home/pi/odoo/addons/hw_drivers/iot_handlers/interfaces/*"]) subprocess.check_call(git + ['branch', '-m', db_branch]) subprocess.check_call(git + ['remote', 'set-branches', 'origin', db_branch]) os.system('/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/posbox_update.sh') @@ -209,8 +209,9 @@ def download_iot_handlers(auto=True): resp = pm.request('POST', server, fields={'mac': get_mac_address(), 'auto': auto}) if resp.data: subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"]) + drivers_path = Path.home() / 'odoo/addons/hw_drivers/iot_handlers' zip_file = zipfile.ZipFile(io.BytesIO(resp.data)) - zip_file.extractall(get_resource_path('hw_drivers', 'iot_handlers')) + zip_file.extractall(drivers_path) subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"]) subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"]) except Exception as e: |
