diff options
author | jshen28 <yshxxsjt715@gmail.com> | 2021-09-30 02:33:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-29 13:33:48 -0500 |
commit | 2d67c1b9a4f2d2ad6642f253fc3a25331c334894 (patch) | |
tree | 45f8598238b3d3129d34bcb7bd51ec73472ed144 /cloudinit | |
parent | 21aec00f77dc51cee2612978ed4ebcca9d91a697 (diff) | |
download | vyos-cloud-init-2d67c1b9a4f2d2ad6642f253fc3a25331c334894.tar.gz vyos-cloud-init-2d67c1b9a4f2d2ad6642f253fc3a25331c334894.zip |
Use ascii code for growpart (#1036)
growpart not working well for environment
using UTF-8 encoding. This patch forces
growpart command to use C locale.
Root issue likely:
https://bugs.launchpad.net/ubuntu/+source/cloud-utils/+bug/1928167
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/config/cc_growpart.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py index 9f5525a1..ce7ca78b 100644 --- a/cloudinit/config/cc_growpart.py +++ b/cloudinit/config/cc_growpart.py @@ -142,9 +142,11 @@ class ResizeGrowPart(object): return False def resize(self, diskdev, partnum, partdev): + myenv = os.environ.copy() + myenv['LANG'] = 'C' before = get_size(partdev) try: - subp.subp(["growpart", '--dry-run', diskdev, partnum]) + subp.subp(["growpart", '--dry-run', diskdev, partnum], env=myenv) except subp.ProcessExecutionError as e: if e.exit_code != 1: util.logexc(LOG, "Failed growpart --dry-run for (%s, %s)", @@ -153,7 +155,7 @@ class ResizeGrowPart(object): return (before, before) try: - subp.subp(["growpart", diskdev, partnum]) + subp.subp(["growpart", diskdev, partnum], env=myenv) except subp.ProcessExecutionError as e: util.logexc(LOG, "Failed: growpart %s %s", diskdev, partnum) raise ResizeFailedException(e) from e |