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
Ophélie Gagnard
slapos.core
Commits
be74286b
Commit
be74286b
authored
Oct 31, 2014
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed dead code, petty cleanup
parent
8b829033
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
26 deletions
+15
-26
slapos/cli/console.py
slapos/cli/console.py
+0
-2
slapos/cli/supervisorctl.py
slapos/cli/supervisorctl.py
+0
-2
slapos/format.py
slapos/format.py
+0
-2
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+2
-2
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+9
-7
slapos/slap/slap.py
slapos/slap/slap.py
+4
-11
No files found.
slapos/cli/console.py
View file @
be74286b
...
@@ -27,8 +27,6 @@
...
@@ -27,8 +27,6 @@
#
#
##############################################################################
##############################################################################
import
textwrap
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.cli.config
import
ClientConfigCommand
from
slapos.client
import
init
,
do_console
,
ClientConfig
from
slapos.client
import
init
,
do_console
,
ClientConfig
...
...
slapos/cli/supervisorctl.py
View file @
be74286b
...
@@ -34,8 +34,6 @@ from slapos.cli.command import check_root_user
...
@@ -34,8 +34,6 @@ from slapos.cli.command import check_root_user
from
slapos.cli.config
import
ConfigCommand
from
slapos.cli.config
import
ConfigCommand
from
slapos.grid.svcbackend
import
launchSupervisord
from
slapos.grid.svcbackend
import
launchSupervisord
from
slapos.util
import
string_to_boolean
import
supervisor.supervisorctl
import
supervisor.supervisorctl
...
...
slapos/format.py
View file @
be74286b
...
@@ -46,7 +46,6 @@ import subprocess
...
@@ -46,7 +46,6 @@ import subprocess
import
sys
import
sys
import
threading
import
threading
import
time
import
time
import
traceback
import
zipfile
import
zipfile
import
lxml.etree
import
lxml.etree
...
@@ -1210,7 +1209,6 @@ class FormatConfig(object):
...
@@ -1210,7 +1209,6 @@ class FormatConfig(object):
attr
=
getattr
(
self
,
option
)
attr
=
getattr
(
self
,
option
)
if
isinstance
(
attr
,
str
):
if
isinstance
(
attr
,
str
):
if
attr
.
lower
()
==
'true'
:
if
attr
.
lower
()
==
'true'
:
root_needed
=
True
setattr
(
self
,
option
,
True
)
setattr
(
self
,
option
,
True
)
elif
attr
.
lower
()
==
'false'
:
elif
attr
.
lower
()
==
'false'
:
setattr
(
self
,
option
,
False
)
setattr
(
self
,
option
,
False
)
...
...
slapos/grid/SlapObject.py
View file @
be74286b
...
@@ -468,7 +468,7 @@ class Partition(object):
...
@@ -468,7 +468,7 @@ class Partition(object):
self
.
logger
.
warning
(
"Falling back to default buildout %r"
%
self
.
logger
.
warning
(
"Falling back to default buildout %r"
%
buildout_binary
)
buildout_binary
)
else
:
else
:
if
len
(
bootstrap_candidate_list
)
!=
1
:
if
len
(
bootstrap_candidate_list
)
>
1
:
raise
ValueError
(
'More than one bootstrap candidate found.'
)
raise
ValueError
(
'More than one bootstrap candidate found.'
)
# Reads uid/gid of path, launches buildout with thoses privileges
# Reads uid/gid of path, launches buildout with thoses privileges
bootstrap_file
=
os
.
path
.
abspath
(
os
.
path
.
join
(
bootstrap_candidate_dir
,
bootstrap_file
=
os
.
path
.
abspath
(
os
.
path
.
join
(
bootstrap_candidate_dir
,
...
@@ -529,7 +529,7 @@ class Partition(object):
...
@@ -529,7 +529,7 @@ class Partition(object):
if
os
.
path
.
exists
(
self
.
service_path
):
if
os
.
path
.
exists
(
self
.
service_path
):
if
os
.
path
.
isdir
(
self
.
service_path
):
if
os
.
path
.
isdir
(
self
.
service_path
):
service_list
=
os
.
listdir
(
self
.
service_path
)
service_list
=
os
.
listdir
(
self
.
service_path
)
if
len
(
runner_list
)
==
0
and
len
(
service_list
)
==
0
:
if
not
runner_list
and
not
service_list
:
self
.
logger
.
warning
(
'No runners nor services found for partition %r'
%
self
.
logger
.
warning
(
'No runners nor services found for partition %r'
%
self
.
partition_id
)
self
.
partition_id
)
if
os
.
path
.
exists
(
self
.
supervisord_partition_configuration_path
):
if
os
.
path
.
exists
(
self
.
supervisord_partition_configuration_path
):
...
...
slapos/grid/slapgrid.py
View file @
be74286b
...
@@ -329,15 +329,17 @@ class Slapgrid(object):
...
@@ -329,15 +329,17 @@ class Slapgrid(object):
self
.
buildout
=
buildout
self
.
buildout
=
buildout
self
.
promise_timeout
=
promise_timeout
self
.
promise_timeout
=
promise_timeout
self
.
develop
=
develop
self
.
develop
=
develop
if
software_release_filter_list
is
not
None
:
self
.
software_release_filter_list
=
[]
if
software_release_filter_list
:
self
.
software_release_filter_list
=
\
self
.
software_release_filter_list
=
\
software_release_filter_list
.
split
(
","
)
software_release_filter_list
.
split
(
","
)
else
:
self
.
software_release_filter_list
=
[]
self
.
computer_partition_filter_list
=
[]
self
.
computer_partition_filter_list
=
[]
if
computer_partition_filter_list
is
not
None
:
if
computer_partition_filter_list
:
self
.
computer_partition_filter_list
=
\
self
.
computer_partition_filter_list
=
\
computer_partition_filter_list
.
split
(
","
)
computer_partition_filter_list
.
split
(
","
)
self
.
maximum_periodicity
=
maximum_periodicity
self
.
maximum_periodicity
=
maximum_periodicity
def
getWatchdogLine
(
self
):
def
getWatchdogLine
(
self
):
...
@@ -559,7 +561,7 @@ class Slapgrid(object):
...
@@ -559,7 +561,7 @@ class Slapgrid(object):
# Check if we defined explicit list of partitions to process.
# Check if we defined explicit list of partitions to process.
# If so, if current partition not in this list, skip.
# If so, if current partition not in this list, skip.
if
len
(
self
.
computer_partition_filter_list
)
>
0
and
\
if
self
.
computer_partition_filter_list
and
\
(
computer_partition_id
not
in
self
.
computer_partition_filter_list
):
(
computer_partition_id
not
in
self
.
computer_partition_filter_list
):
return
return
...
@@ -877,7 +879,7 @@ class Slapgrid(object):
...
@@ -877,7 +879,7 @@ class Slapgrid(object):
self
.
logger
.
error
(
UnicodeError
)
self
.
logger
.
error
(
UnicodeError
)
raise
UnicodeError
(
"Failed to read %s: %s"
%
(
computer_partition_usage
.
usage
,
exc
))
raise
UnicodeError
(
"Failed to read %s: %s"
%
(
computer_partition_usage
.
usage
,
exc
))
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
exc
:
except
(
etree
.
XMLSyntaxError
,
etree
.
DocumentInvalid
)
as
exc
:
self
.
logger
.
info
(
"Failed to parse %s."
%
(
computer_partition_usage
.
usage
)
)
self
.
logger
.
info
(
"Failed to parse %s."
%
computer_partition_usage
.
usage
)
self
.
logger
.
error
(
exc
)
self
.
logger
.
error
(
exc
)
raise
_formatXMLError
(
exc
)
raise
_formatXMLError
(
exc
)
except
Exception
as
exc
:
except
Exception
as
exc
:
...
@@ -985,7 +987,7 @@ class Slapgrid(object):
...
@@ -985,7 +987,7 @@ class Slapgrid(object):
clean_run
=
False
clean_run
=
False
failed_script_list
.
append
(
"Script %r failed."
%
script
)
failed_script_list
.
append
(
"Script %r failed."
%
script
)
self
.
logger
.
warning
(
'Failed to run %r'
%
invocation_list
)
self
.
logger
.
warning
(
'Failed to run %r'
%
invocation_list
)
if
len
(
failed_script_list
)
:
if
failed_script_list
:
computer_partition
.
error
(
'
\
n
'
.
join
(
failed_script_list
),
logger
=
self
.
logger
)
computer_partition
.
error
(
'
\
n
'
.
join
(
failed_script_list
),
logger
=
self
.
logger
)
# Whatever happens, don't stop processing other instances
# Whatever happens, don't stop processing other instances
except
Exception
:
except
Exception
:
...
...
slapos/slap/slap.py
View file @
be74286b
...
@@ -51,13 +51,6 @@ urllib3_logger = logging.getLogger('requests.packages.urllib3')
...
@@ -51,13 +51,6 @@ urllib3_logger = logging.getLogger('requests.packages.urllib3')
urllib3_logger
.
setLevel
(
logging
.
WARNING
)
urllib3_logger
.
setLevel
(
logging
.
WARNING
)
# XXX fallback_logger to be deprecated together with the old CLI entry points.
fallback_logger
=
logging
.
getLogger
(
__name__
)
fallback_handler
=
logging
.
StreamHandler
()
fallback_logger
.
setLevel
(
logging
.
INFO
)
fallback_logger
.
addHandler
(
fallback_handler
)
DEFAULT_SOFTWARE_TYPE
=
'RootSoftwareInstance'
DEFAULT_SOFTWARE_TYPE
=
'RootSoftwareInstance'
class
SlapDocument
:
class
SlapDocument
:
...
@@ -133,7 +126,7 @@ class SoftwareRelease(SlapDocument):
...
@@ -133,7 +126,7 @@ class SoftwareRelease(SlapDocument):
else
:
else
:
return
self
.
_software_release
return
self
.
_software_release
def
error
(
self
,
error_log
,
logger
=
None
):
def
error
(
self
,
error_log
,
logger
):
try
:
try
:
# Does not follow interface
# Does not follow interface
self
.
_connection_helper
.
POST
(
'softwareReleaseError'
,
data
=
{
self
.
_connection_helper
.
POST
(
'softwareReleaseError'
,
data
=
{
...
@@ -141,7 +134,7 @@ class SoftwareRelease(SlapDocument):
...
@@ -141,7 +134,7 @@ class SoftwareRelease(SlapDocument):
'computer_id'
:
self
.
getComputerId
(),
'computer_id'
:
self
.
getComputerId
(),
'error_log'
:
error_log
})
'error_log'
:
error_log
})
except
Exception
:
except
Exception
:
(
logger
or
fallback_logger
)
.
exception
(
''
)
logger
.
exception
(
''
)
def
available
(
self
):
def
available
(
self
):
self
.
_connection_helper
.
POST
(
'availableSoftwareRelease'
,
data
=
{
self
.
_connection_helper
.
POST
(
'availableSoftwareRelease'
,
data
=
{
...
@@ -439,14 +432,14 @@ class ComputerPartition(SlapRequester):
...
@@ -439,14 +432,14 @@ class ComputerPartition(SlapRequester):
'computer_partition_id'
:
self
.
getId
(),
'computer_partition_id'
:
self
.
getId
(),
})
})
def
error
(
self
,
error_log
,
logger
=
None
):
def
error
(
self
,
error_log
,
logger
):
try
:
try
:
self
.
_connection_helper
.
POST
(
'softwareInstanceError'
,
data
=
{
self
.
_connection_helper
.
POST
(
'softwareInstanceError'
,
data
=
{
'computer_id'
:
self
.
_computer_id
,
'computer_id'
:
self
.
_computer_id
,
'computer_partition_id'
:
self
.
getId
(),
'computer_partition_id'
:
self
.
getId
(),
'error_log'
:
error_log
})
'error_log'
:
error_log
})
except
Exception
:
except
Exception
:
(
logger
or
fallback_logger
)
.
exception
(
''
)
logger
.
exception
(
''
)
def
bang
(
self
,
message
):
def
bang
(
self
,
message
):
self
.
_connection_helper
.
POST
(
'softwareInstanceBang'
,
data
=
{
self
.
_connection_helper
.
POST
(
'softwareInstanceBang'
,
data
=
{
...
...
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