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
Labels
Merge Requests
18
Merge Requests
18
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
0a919d2f
Commit
0a919d2f
authored
Apr 25, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
further import cleanup
parent
20e9ad51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
15 deletions
+18
-15
slapos/grid/utils.py
slapos/grid/utils.py
+7
-6
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+11
-9
No files found.
slapos/grid/utils.py
View file @
0a919d2f
# -*- coding: utf-8 -*-
# vim: set et sts=2:
##############################################################################
#
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
...
...
@@ -27,17 +28,17 @@
#
##############################################################################
import
logging
import
grp
import
hashlib
import
logging
import
os
import
pkg_resources
import
pwd
import
stat
import
subprocess
import
sys
import
pwd
import
grp
from
exception
import
BuildoutFailedError
,
WrongPermissionError
from
hashlib
import
md5
from
slapos.grid.exception
import
BuildoutFailedError
,
WrongPermissionError
# Such umask by default will create paths with full permission
# for user, non writable by group and not accessible by others
...
...
@@ -116,7 +117,7 @@ class SlapPopen(subprocess.Popen):
self
.
output
=
''
.
join
(
output_lines
)
def
md5digest
(
url
):
return
md5
(
url
).
hexdigest
()
return
hashlib
.
md5
(
url
).
hexdigest
()
def
getCleanEnvironment
(
home_path
=
'/tmp'
):
...
...
slapos/tests/slapgrid.py
View file @
0a919d2f
...
...
@@ -25,16 +25,12 @@
#
##############################################################################
from
slapos.grid
import
slapgrid
import
httplib
import
logging
import
os
from
random
import
random
import
random
import
shutil
import
signal
import
slapos.slap.slap
import
slapos.grid.utils
from
slapos.grid.watchdog
import
Watchdog
,
getWatchdogID
import
socket
import
sys
import
tempfile
...
...
@@ -42,8 +38,15 @@ import textwrap
import
time
import
unittest
import
urlparse
import
xml_marshaller
import
slapos.slap.slap
import
slapos.grid.utils
from
slapos.grid
import
slapgrid
from
slapos.grid.utils
import
md5digest
from
slapos.grid.watchdog
import
Watchdog
,
getWatchdogID
dummylogger
=
logging
.
getLogger
()
...
...
@@ -383,11 +386,11 @@ class InstanceForTest:
os
.
mkdir
(
certificate_repository_path
)
self
.
cert_file
=
os
.
path
.
join
(
certificate_repository_path
,
"%s.crt"
%
self
.
name
)
self
.
certificate
=
str
(
random
())
self
.
certificate
=
str
(
random
.
random
())
open
(
self
.
cert_file
,
'w'
).
write
(
self
.
certificate
)
self
.
key_file
=
os
.
path
.
join
(
certificate_repository_path
,
"%s.key"
%
self
.
name
)
self
.
key
=
str
(
random
())
self
.
key
=
str
(
random
.
random
())
open
(
self
.
key_file
,
'w'
).
write
(
self
.
key
)
class
SoftwareForTest
:
...
...
@@ -402,8 +405,7 @@ class SoftwareForTest:
self
.
software_root
=
software_root
self
.
name
=
'http://sr%s/'
%
name
self
.
sequence
=
[]
self
.
software_hash
=
\
slapos
.
grid
.
utils
.
md5digest
(
self
.
name
)
self
.
software_hash
=
md5digest
(
self
.
name
)
self
.
srdir
=
os
.
path
.
join
(
self
.
software_root
,
self
.
software_hash
)
self
.
requested_state
=
'available'
os
.
mkdir
(
self
.
srdir
)
...
...
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