Use unicode instead of bytes (#46234)
The stdout and stderr values returned from self._low_level_execute() are text, not bytes. This results in an error in Python 3 since str and bytes cannot be concatenated.
Changing to unicode type allows this to work without error on Python 2 and Python 3.
(cherry picked from commit 77f73f6d2a
)
This commit is contained in:
parent
07ed487427
commit
3a72e271ad
2 changed files with 5 additions and 2 deletions
3
changelogs/fragments/reboot-unicode-string.yaml
Normal file
3
changelogs/fragments/reboot-unicode-string.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
bugfixes:
|
||||||
|
- reboot - use unicode instead of bytes for stdout and stderr to match the
|
||||||
|
type returned from low_level_execute()
|
|
@ -94,8 +94,8 @@ class ActionModule(ActionBase):
|
||||||
return reboot_command
|
return reboot_command
|
||||||
|
|
||||||
def get_system_boot_time(self):
|
def get_system_boot_time(self):
|
||||||
stdout = ''
|
stdout = u''
|
||||||
stderr = ''
|
stderr = u''
|
||||||
command_result = self._low_level_execute_command(self.DEFAULT_BOOT_TIME_COMMAND, sudoable=self.DEFAULT_SUDOABLE)
|
command_result = self._low_level_execute_command(self.DEFAULT_BOOT_TIME_COMMAND, sudoable=self.DEFAULT_SUDOABLE)
|
||||||
|
|
||||||
# For single board computers, e.g., Raspberry Pi, that lack a real time clock and are using fake-hwclock
|
# For single board computers, e.g., Raspberry Pi, that lack a real time clock and are using fake-hwclock
|
||||||
|
|
Loading…
Reference in a new issue