Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
bind-dnssec
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Valentin Samir
bind-dnssec
Commits
8fb11f1b
Commit
8fb11f1b
authored
Jun 18, 2017
by
Valentin Samir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If using python 3, decode the output of Popen communicate() then needed
parent
296bfa68
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
routine.py
routine.py
+8
-1
No files found.
routine.py
View file @
8fb11f1b
...
...
@@ -46,9 +46,10 @@ DNSSEC_DSFROMKEY = "/usr/sbin/dnssec-dsfromkey"
DNSSEC_KEYGEN
=
"/usr/sbin/dnssec-keygen"
RNDC
=
"/usr/sbin/rndc"
_PY3
=
sys
.
version_info
.
major
>=
3
def
_print
(
data
,
file
=
sys
.
stdout
):
if
sys
.
version_info
.
major
>=
3
and
isinstance
(
data
,
bytes
):
if
_PY
3
and
isinstance
(
data
,
bytes
):
data
=
data
.
decode
(
"utf-8"
)
print
(
data
,
file
=
file
)
...
...
@@ -73,6 +74,8 @@ def settime(path, flag, date):
]
p
=
subprocess
.
Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
)
err
=
p
.
communicate
()[
1
]
if
_PY3
:
err
=
err
.
decode
(
"utf-8"
)
if
p
.
returncode
!=
0
:
raise
ValueError
(
"err %s: %s"
%
(
p
.
returncode
,
err
))
if
err
:
...
...
@@ -392,6 +395,8 @@ class Key(object):
if
p
.
returncode
!=
0
:
raise
ValueError
(
"The key creation has failed"
)
keyname
=
p
.
communicate
()[
0
].
strip
()
if
_PY3
:
keyname
=
keyname
.
decode
(
"utf-8"
)
bind_chown
(
path
)
return
cls
(
os
.
path
.
join
(
path
,
"%s.private"
%
keyname
))
...
...
@@ -402,6 +407,8 @@ class Key(object):
]
p
=
subprocess
.
Popen
(
cmd
,
stderr
=
subprocess
.
PIPE
)
err
=
p
.
communicate
()[
1
]
if
_PY3
:
err
=
err
.
decode
(
"utf-8"
)
if
p
.
returncode
!=
0
:
raise
ValueError
(
"err %s: %s"
%
(
p
.
returncode
,
err
))
if
err
:
...
...
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