storage/lvm: minor fix for lvs command building

Do not prepend 'sudo' each time - do a copy of array if that's
necessary.
This commit is contained in:
Marek Marczykowski-Górecki 2018-10-29 05:16:23 +01:00
parent 42061cb194
commit 26a553737f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -219,7 +219,7 @@ def _parse_lvm_cache(lvm_output):
def init_cache(log=logging.getLogger('qubes.storage.lvm')):
cmd = _init_cache_cmd
if os.getuid() != 0:
cmd.insert(0, 'sudo')
cmd = ['sudo'] + cmd
environ = os.environ.copy()
environ['LC_ALL'] = 'C.utf8'
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,