Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
sn
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Turris
Sentinel
sn
Commits
722a864e
Commit
722a864e
authored
May 26, 2018
by
Robin Obůrka
Committed by
Robin Obůrka
Jun 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msgloop: Setup callback might need a parsed arguments
parent
b485db83
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
sn/msgloop.py
sn/msgloop.py
+10
-3
No files found.
sn/msgloop.py
View file @
722a864e
...
...
@@ -29,7 +29,7 @@ def sn_main(box_name, process, setup=None, teardown=None, argparser=None):
context
=
None
try
:
user_data
=
get_user_data
(
setup
)
user_data
=
get_user_data
(
setup
,
sn_ctx
.
args
)
context
=
build_context
(
box_name
,
sn_ctx
,
user_data
)
check_configuration
(
context
,
process
)
...
...
@@ -55,9 +55,16 @@ def sn_main(box_name, process, setup=None, teardown=None, argparser=None):
teardown_context
(
context
)
def
get_user_data
(
setup
):
def
get_user_data
(
setup
,
args
):
if
setup
:
number_of_arguments
=
len
((
inspect
.
signature
(
setup
).
parameters
))
if
number_of_arguments
==
1
:
user_data
=
setup
(
args
)
else
:
# Let the function fail in implicit way in case that setup callback
# has more than 1 argument
user_data
=
setup
()
if
isinstance
(
user_data
,
dict
):
return
user_data
else
:
...
...
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