Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.toolbox
Commits
f5e23695
Commit
f5e23695
authored
Jun 27, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! Add support for Python 3
parent
1c8269b2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
20 deletions
+24
-20
slapos/cloudmgr/stop.py
slapos/cloudmgr/stop.py
+1
-1
slapos/cloudmgr/update.py
slapos/cloudmgr/update.py
+2
-2
slapos/container/__init__.py
slapos/container/__init__.py
+2
-1
slapos/promise/plugin/check_port_listening.py
slapos/promise/plugin/check_port_listening.py
+2
-2
slapos/pubsub/notifier.py
slapos/pubsub/notifier.py
+5
-4
slapos/resiliencytest/__init__.py
slapos/resiliencytest/__init__.py
+2
-1
slapos/resiliencytest/suites/gitlab.py
slapos/resiliencytest/suites/gitlab.py
+1
-1
slapos/runner/run.py
slapos/runner/run.py
+1
-1
slapos/zodbpack.py
slapos/zodbpack.py
+8
-7
No files found.
slapos/cloudmgr/stop.py
View file @
f5e23695
...
...
@@ -22,7 +22,7 @@ def stop(key, secret, service, node_uuid, ssh_key=None):
ssh
=
getSSHConnection
(
driver
,
public_ip
,
ssh_key
)
print
(
'Stopping instance...'
)
stdin
,
stdout
,
stderr
=
ssh
.
exec_command
(
'halt'
)
except
SSHException
,
e
:
except
SSHException
as
e
:
print
(
'unable to stop'
)
raise
e
error_log
=
stderr
.
read
()
...
...
slapos/cloudmgr/update.py
View file @
f5e23695
...
...
@@ -59,7 +59,7 @@ def install(key, secret, service, image_id, size_id, location_id,
keypair
=
driver
.
ex_create_keypair
(
unique_keyname
)
ssh_key
=
keypair
[
'keyMaterial'
]
argument_list
[
'ex_keyname'
]
=
unique_keyname
except
Exception
,
e
:
except
Exception
as
e
:
# XX-Cedric : what to do here?
if
e
.
args
[
0
].
find
(
"InvalidKeyPair.Duplicate"
)
==
-
1
:
# XXX-Cedric : our unique key was not so unique...Do something
...
...
@@ -82,7 +82,7 @@ def install(key, secret, service, image_id, size_id, location_id,
if
'EC2'
in
service
:
try
:
driver
.
ex_create_security_group
(
security_group
,
security_group
)
except
Exception
,
e
:
except
Exception
as
e
:
if
e
.
args
[
0
].
find
(
"InvalidPermission.Duplicate"
)
==
-
1
:
pass
#It's okay, don't worry.
driver
.
ex_authorize_security_group_permissive
(
security_group
)
...
...
slapos/container/__init__.py
View file @
f5e23695
# -*- coding: utf-8 -*-
from
__future__
import
print_function
from
six.moves
import
configparser
import
argparse
from
six.moves
import
dbm_gnu
as
gdbm
...
...
@@ -27,7 +28,7 @@ def main():
if
args
.
pid
is
not
None
:
pid_filename
=
args
.
pid
[
0
]
if
os
.
path
.
exists
(
pid_filename
):
print
>>
sys
.
stderr
,
"Already running"
print
(
"Already running"
,
file
=
sys
.
stderr
)
return
127
with
open
(
pid_filename
,
'w'
)
as
pid_file
:
pid_file
.
write
(
str
(
os
.
getpid
()))
...
...
slapos/promise/plugin/check_port_listening.py
View file @
f5e23695
...
...
@@ -30,9 +30,9 @@ class RunPromise(GenericPromise):
# self.logger.info("port connection OK")
try
:
socket
.
create_connection
(
addr
).
close
()
except
(
socket
.
herror
,
socket
.
gaierror
)
,
e
:
except
(
socket
.
herror
,
socket
.
gaierror
)
as
e
:
self
.
logger
.
error
(
"ERROR hostname/port ({}) is not correct: {}"
.
format
(
addr
,
e
))
except
(
socket
.
error
,
socket
.
timeout
)
,
e
:
except
(
socket
.
error
,
socket
.
timeout
)
as
e
:
self
.
logger
.
error
(
"ERROR while connecting to {}: {}"
.
format
(
addr
,
e
))
else
:
self
.
logger
.
info
(
"port connection OK ({})"
.
format
(
addr
))
...
...
slapos/pubsub/notifier.py
View file @
f5e23695
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
__future__
import
print_function
import
argparse
import
csv
import
datetime
...
...
@@ -79,7 +80,7 @@ def main():
saveStatus
(
'STARTED'
)
if
args
.
max_run
<=
0
:
print
"--max-run argument takes a strictely positive number as argument"
print
(
"--max-run argument takes a strictely positive number as argument"
)
sys
.
exit
(
-
1
)
while
args
.
max_run
>
0
:
...
...
@@ -108,7 +109,7 @@ def main():
content
.
replace
(
'&'
,
'&'
).
replace
(
'<'
,
'<'
).
replace
(
'>'
,
'>'
)
))
print
content
print
(
content
)
# Write feed safely
error_message
=
""
...
...
@@ -128,7 +129,7 @@ def main():
'slapos:%s'
%
uuid
.
uuid4
(),
])
os
.
rename
(
temp_file
,
args
.
logfile
[
0
])
except
Exception
,
e
:
except
Exception
as
e
:
error_message
=
"ERROR ON WRITING FEED - %s"
%
str
(
e
)
finally
:
try
:
...
...
@@ -143,7 +144,7 @@ def main():
if
exit_code
!=
0
:
sys
.
exit
(
exit_code
)
print
'Fetching %s feed...'
%
args
.
feed_url
[
0
]
print
(
'Fetching %s feed...'
%
args
.
feed_url
[
0
])
feed
=
urllib2
.
urlopen
(
args
.
feed_url
[
0
])
body
=
feed
.
read
()
...
...
slapos/resiliencytest/__init__.py
View file @
f5e23695
...
...
@@ -26,6 +26,7 @@
#
##############################################################################
from
__future__
import
print_function
import
argparse
import
json
import
importlib
...
...
@@ -228,7 +229,7 @@ def runResiliencyTest():
"""
error_message_set
,
exit_status
=
ScalabilityLauncher
().
run
()
for
error_message
in
error_message_set
:
print
>>
sys
.
stderr
,
'ERROR: %s'
%
error_message
print
(
'ERROR: %s'
%
error_message
,
file
=
sys
.
stderr
)
sys
.
exit
(
exit_status
)
...
...
slapos/resiliencytest/suites/gitlab.py
View file @
f5e23695
...
...
@@ -167,7 +167,7 @@ class GitlabTestSuite(SlaprunnerTestSuite):
while
loop
<
3
:
try
:
self
.
_connectToGitlab
(
url
=
self
.
backend_url
)
except
Exception
,
e
:
except
Exception
as
e
:
if
loop
==
2
:
raise
self
.
logger
.
warning
(
str
(
e
))
...
...
slapos/runner/run.py
View file @
f5e23695
...
...
@@ -144,7 +144,7 @@ def serve(config):
result
=
cloneRepo
(
repo_url
,
repository_path
)
if
branch_name
:
switchBranch
(
repository_path
,
branch_name
)
except
GitCommandError
,
e
:
except
GitCommandError
as
e
:
app
.
logger
.
warning
(
'Error while cloning default repository: %s'
%
str
(
e
))
traceback
.
print_exc
()
# Start slapproxy here when runner is starting
...
...
slapos/zodbpack.py
View file @
f5e23695
from
__future__
import
print_function
import
ZODB.FileStorage
import
ZODB.serialize
import
argparse
...
...
@@ -16,24 +17,24 @@ def run():
point
=
now
-
(
3600
*
24
*
args
.
days
)
print
'Now is %s'
%
time
.
asctime
(
time
.
localtime
(
now
))
print
'Will pack until %s'
%
time
.
asctime
(
time
.
localtime
(
point
))
print
(
'Now is %s'
%
time
.
asctime
(
time
.
localtime
(
now
)
))
print
(
'Will pack until %s'
%
time
.
asctime
(
time
.
localtime
(
point
)
))
failures
=
0
for
f
in
args
.
files
:
b
=
time
.
time
()
print
'Trying to pack %r'
%
f
print
(
'Trying to pack %r'
%
f
)
try
:
pack
(
point
,
f
)
except
Exception
:
print
'Failed to pack %r:'
%
f
print
(
'Failed to pack %r:'
%
f
)
traceback
.
print_exc
()
failures
+=
1
print
'Finished %s in %.3fs'
%
(
f
,
time
.
time
()
-
b
)
print
(
'Finished %s in %.3fs'
%
(
f
,
time
.
time
()
-
b
)
)
if
failures
:
print
'Failed files: %s'
%
failures
print
(
'Failed files: %s'
%
failures
)
return
failures
else
:
print
'All files sucessfully packed.'
print
(
'All files sucessfully packed.'
)
return
0
def
pack
(
point
,
f
):
...
...
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