Skip to content
Snippets Groups Projects
Commit ec9759a6 authored by Antoine Prieels's avatar Antoine Prieels
Browse files

[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: default avatarQuentin Lejeune (qle) <qle@odoo.com>
parent bad8e5a4
Branches
Tags
No related merge requests found
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment