Fix restoring old CAS version when upgrade failed

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2020-01-29 10:12:09 -05:00
parent 8c73bc2f5a
commit 6c57d2827f

View File

@ -162,9 +162,10 @@ class UpgradeState:
def insert_module(name, installed=True, **params):
cmd_params = [f"{param}={val}" for param, val in params.items()]
cmd = "modprobe --first-time" if installed else "insmod"
cmd = ["modprobe", "--first-time"] if installed else ["insmod"]
cmd += [name] + cmd_params
p = subprocess.run([cmd, name] + cmd_params, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if p.returncode:
raise Exception(p.stderr.decode("ascii").rstrip("\n"))