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
3a33df9d
Commit
3a33df9d
authored
Feb 17, 2020
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Plain Diff
Fixes for python3.6
/reviewed-on
nexedi/slapos.core!146
parents
3bc0dd76
dcfbb594
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
19 deletions
+37
-19
setup.py
setup.py
+17
-15
slapos/cli/register.py
slapos/cli/register.py
+1
-1
slapos/collect/db.py
slapos/collect/db.py
+2
-2
slapos/slap/standalone.py
slapos/slap/standalone.py
+17
-1
No files found.
setup.py
View file @
3a33df9d
...
@@ -28,8 +28,20 @@ try:
...
@@ -28,8 +28,20 @@ try:
except
ImportError
:
except
ImportError
:
additional_install_requires
.
append
(
'argparse'
)
additional_install_requires
.
append
(
'argparse'
)
if
sys
.
version_info
[
0
]
<
3
:
extras_require
=
{
additional_install_requires
.
append
(
'subprocess32'
)
'docs'
:
(
'Sphinx'
,
'repoze.sphinx.autointerface'
,
'sphinxcontrib.programoutput'
,
),
'ipython_console'
:
(
'ipython'
,),
'bpython_console'
:
(
'bpython'
,),
'test'
:
(
'pyflakes'
,
'mock'
,
'httmock'
,
),
}
setup
(
name
=
name
,
setup
(
name
=
name
,
version
=
version
,
version
=
version
,
...
@@ -63,20 +75,10 @@ setup(name=name,
...
@@ -63,20 +75,10 @@ setup(name=name,
'cachecontrol'
,
'cachecontrol'
,
'lockfile'
,
'lockfile'
,
'uritemplate'
,
# used by hateoas navigator
'uritemplate'
,
# used by hateoas navigator
'subprocess32; python_version<"3"'
]
+
additional_install_requires
,
]
+
additional_install_requires
,
extras_require
=
{
extras_require
=
extras_require
,
'docs'
:
(
tests_require
=
extras_require
[
'test'
],
'Sphinx'
,
'repoze.sphinx.autointerface'
,
'sphinxcontrib.programoutput'
),
'ipython_console'
:
(
'ipython'
,),
'bpython_console'
:
(
'bpython'
,)},
tests_require
=
[
'pyflakes'
,
'mock'
,
'httmock'
,
],
zip_safe
=
False
,
# proxy depends on Flask, which has issues with
zip_safe
=
False
,
# proxy depends on Flask, which has issues with
# accessing templates
# accessing templates
entry_points
=
{
entry_points
=
{
...
...
slapos/cli/register.py
View file @
3a33df9d
...
@@ -279,7 +279,7 @@ def slapconfig(conf):
...
@@ -279,7 +279,7 @@ def slapconfig(conf):
to_replace
.
append
((
'ipv6_interface'
,
conf
.
ipv6_interface
))
to_replace
.
append
((
'ipv6_interface'
,
conf
.
ipv6_interface
))
for
key
,
value
in
to_replace
:
for
key
,
value
in
to_replace
:
cfg
=
re
.
sub
(
'
\
n
\
s*%s
\
s*=.*'
%
key
,
'
\
n
%s = %s'
%
(
key
,
value
),
cfg
)
cfg
=
re
.
sub
(
'
\
n
\
\
s*%s
\
\
s*=.*'
%
key
,
'
\
n
%s = %s'
%
(
key
,
value
),
cfg
)
if
not
dry_run
:
if
not
dry_run
:
with
open
(
config_path
,
'w'
)
as
fout
:
with
open
(
config_path
,
'w'
)
as
fout
:
...
...
slapos/collect/db.py
View file @
3a33df9d
...
@@ -300,9 +300,9 @@ class Database:
...
@@ -300,9 +300,9 @@ class Database:
self
.
_execute
(
delete_sql
%
(
table
,
where_clause
))
self
.
_execute
(
delete_sql
%
(
table
,
where_clause
))
vacuum
=
1
vacuum
=
1
if
vacuum
:
self
.
_execute
(
"VACUUM;"
)
self
.
commit
()
self
.
commit
()
if
vacuum
:
self
.
_execute
(
"VACUUM"
)
self
.
close
()
self
.
close
()
def
getDateScopeList
(
self
,
ignore_date
=
None
,
reported
=
0
):
def
getDateScopeList
(
self
,
ignore_date
=
None
,
reported
=
0
):
...
...
slapos/slap/standalone.py
View file @
3a33df9d
...
@@ -643,7 +643,11 @@ class StandaloneSlapOS(object):
...
@@ -643,7 +643,11 @@ class StandaloneSlapOS(object):
debug_args
=
prog
.
get
(
'debug_args'
,
''
)
# pylint: disable=unused-variable
debug_args
=
prog
.
get
(
'debug_args'
,
''
)
# pylint: disable=unused-variable
command
=
prog
[
'command'
].
format
(
**
locals
())
command
=
prog
[
'command'
].
format
(
**
locals
())
try
:
try
:
return
subprocess
.
check_call
(
command
,
shell
=
True
)
return
subprocess
.
check_call
(
command
,
shell
=
True
,
env
=
self
.
_getSubprocessEnvironment
(),
)
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
if
e
.
returncode
==
SLAPGRID_PROMISE_FAIL
:
if
e
.
returncode
==
SLAPGRID_PROMISE_FAIL
:
self
.
_logger
.
exception
(
'Promise error when running %s'
,
command
)
self
.
_logger
.
exception
(
'Promise error when running %s'
,
command
)
...
@@ -706,6 +710,7 @@ class StandaloneSlapOS(object):
...
@@ -706,6 +710,7 @@ class StandaloneSlapOS(object):
output
=
subprocess
.
check_output
(
output
=
subprocess
.
check_output
(
[
'supervisord'
,
'--configuration'
,
self
.
_supervisor_config
],
[
'supervisord'
,
'--configuration'
,
self
.
_supervisor_config
],
cwd
=
self
.
_base_directory
,
cwd
=
self
.
_base_directory
,
env
=
self
.
_getSubprocessEnvironment
(),
)
)
self
.
_logger
.
debug
(
"Started new supervisor: %s"
,
output
)
self
.
_logger
.
debug
(
"Started new supervisor: %s"
,
output
)
...
@@ -736,3 +741,14 @@ class StandaloneSlapOS(object):
...
@@ -736,3 +741,14 @@ class StandaloneSlapOS(object):
return
return
time
.
sleep
(
i
*
.
01
)
time
.
sleep
(
i
*
.
01
)
raise
RuntimeError
(
"SlapOS not started"
)
raise
RuntimeError
(
"SlapOS not started"
)
def
_getSubprocessEnvironment
(
self
):
# Running tests with `python setup.py test` sets a PYTHONPATH that
# is suitable for current python, but problematic when this process
# runs another version of python in subprocess.
if
'PYTHONPATH'
in
os
.
environ
:
self
.
_logger
.
warning
(
"Removing $PYTHONPATH from environment for subprocess"
)
env
=
os
.
environ
.
copy
()
del
env
[
'PYTHONPATH'
]
return
env
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