Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos.core
Commits
204c4a86
Commit
204c4a86
authored
Jul 11, 2022
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Plain Diff
format: fix callAndRead for python3
See merge request
!399
parents
5ea9b36b
4444e963
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
5 deletions
+12
-5
slapos/format.py
slapos/format.py
+6
-3
slapos/tests/test_slapformat.py
slapos/tests/test_slapformat.py
+6
-2
No files found.
slapos/format.py
View file @
204c4a86
...
@@ -150,9 +150,12 @@ def getPublicIPv4Address():
...
@@ -150,9 +150,12 @@ def getPublicIPv4Address():
return
ipv4
return
ipv4
def
callAndRead
(
argument_list
,
raise_on_error
=
True
):
def
callAndRead
(
argument_list
,
raise_on_error
=
True
):
popen
=
subprocess
.
Popen
(
argument_list
,
popen
=
subprocess
.
Popen
(
argument_list
,
stdout
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
stderr
=
subprocess
.
STDOUT
,
universal_newlines
=
True
,
)
result
=
popen
.
communicate
()[
0
]
result
=
popen
.
communicate
()[
0
]
if
raise_on_error
and
popen
.
returncode
!=
0
:
if
raise_on_error
and
popen
.
returncode
!=
0
:
raise
ValueError
(
'Issue while invoking %r, result was:
\
n
%s'
%
(
raise
ValueError
(
'Issue while invoking %r, result was:
\
n
%s'
%
(
...
...
slapos/tests/test_slapformat.py
View file @
204c4a86
...
@@ -950,5 +950,9 @@ class TestFormatConfig(SlapformatMixin):
...
@@ -950,5 +950,9 @@ class TestFormatConfig(SlapformatMixin):
# TODO add more tests with config file
# TODO add more tests with config file
if
__name__
==
'__main__'
:
unittest
.
main
()
class
TestCallAndRead
(
unittest
.
TestCase
):
def
test_callAndRead
(
self
):
self
.
assertEqual
(
slapos
.
format
.
callAndRead
([
'echo'
,
'hello'
]),
(
0
,
'hello
\
n
'
))
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