summaryrefslogtreecommitdiff
path: root/addons/hw_drivers/tools/helpers.py
diff options
context:
space:
mode:
authorlejeune quentin <qle@odoo.com>2019-09-10 13:06:45 +0000
committerlejeune quentin <qle@odoo.com>2019-09-10 14:14:27 +0000
commit9c10d7a28e8fba59df9da78747c992e4fa944c9d (patch)
tree9fc191e11516a3e58f1bfc31a488334e3847a1fd /addons/hw_drivers/tools/helpers.py
parentaa18bcc14d2c9be939a9debcee441464274f27e2 (diff)
[FIX] hw_drivers: Fix unmount of cups folder
To add or modify printer the /root_bypass_ramdisks/etc/cups/ need be writeable. And /root_bypass_ramdisks/etc/cups/ = /etc/cups/ But when we make 'sudo mount -o remount,ro /' we put the /etc/cups/ and so /root_bypass_ramdisks/etc/cups/ folder on read-only. After all 'read-only' command we make another command to put cups folder writeable
Diffstat (limited to 'addons/hw_drivers/tools/helpers.py')
-rw-r--r--addons/hw_drivers/tools/helpers.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/addons/hw_drivers/tools/helpers.py b/addons/hw_drivers/tools/helpers.py
index 9cc25440304..9a1b5e2064a 100644
--- a/addons/hw_drivers/tools/helpers.py
+++ b/addons/hw_drivers/tools/helpers.py
@@ -109,6 +109,7 @@ def load_certificate():
Path('/root_bypass_ramdisks/etc/ssl/private/nginx-cert.key').write_text(result['private_key_pem'])
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/root_bypass_ramdisks/"])
+ subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])
subprocess.check_call(["sudo", "service", "nginx", "restart"])
def download_drivers(auto=True):
@@ -127,6 +128,7 @@ def download_drivers(auto=True):
zip_file = zipfile.ZipFile(io.BytesIO(resp.data))
zip_file.extractall(get_resource_path('hw_drivers', 'drivers'))
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:
_logger.error('Could not reach configured server')
_logger.error('A error encountered : %s ' % e)
@@ -145,9 +147,11 @@ def unlink_file(filename):
if path.exists():
path.unlink()
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
+ subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])
def write_file(filename, text):
subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/"])
path = Path.home() / filename
path.write_text(text)
subprocess.check_call(["sudo", "mount", "-o", "remount,ro", "/"])
+ subprocess.check_call(["sudo", "mount", "-o", "remount,rw", "/root_bypass_ramdisks/etc/cups"])