Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
42dc0de4
Commit
42dc0de4
authored
Jan 26, 2017
by
Stéphane Graber
Committed by
GitHub
Jan 26, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1392 from cjwatson/start-ephemeral-python32
Make lxc-start-ephemeral Python 3.2-compatible
parents
4893a431
e0e34b7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
lxc-start-ephemeral.in
src/lxc/tools/lxc-start-ephemeral.in
+9
-3
No files found.
src/lxc/tools/lxc-start-ephemeral.in
View file @
42dc0de4
...
...
@@ -28,6 +28,7 @@
import
argparse
import
gettext
import
lxc
import
locale
import
os
import
sys
import
subprocess
...
...
@@ -363,9 +364,14 @@ if os.path.exists("/proc/self/ns/pid"):
if
args
.
user
:
username
=
args
.
user
line
=
subprocess
.
check_output
(
[
"getent"
,
"passwd"
,
username
],
universal_newlines
=
True
)
.
rstrip
(
"
\n
"
)
# This should really just use universal_newlines=True, but we do
# the decoding by hand instead for compatibility with Python
# 3.2; that used locale.getpreferredencoding() internally rather
# than locale.getpreferredencoding(False), and the former breaks
# here because we can't reload codecs at this point unless the
# container has the same version of Python installed.
line
=
subprocess
.
check_output
([
"getent"
,
"passwd"
,
username
])
line
=
line
.
decode
(
locale
.
getpreferredencoding
(
False
))
.
rstrip
(
"
\n
"
)
_
,
_
,
pw_uid
,
pw_gid
,
_
,
pw_dir
,
_
=
line
.
split
(
":"
,
6
)
pw_uid
=
int
(
pw_uid
)
pw_gid
=
int
(
pw_gid
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment