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
Lu Xu
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 -*-
# -*- coding: utf-8 -*-
# vim: set et sts=2:
##############################################################################
##############################################################################
#
#
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
...
@@ -27,17 +28,17 @@
...
@@ -27,17 +28,17 @@
#
#
##############################################################################
##############################################################################
import
logging
import
grp
import
hashlib
import
hashlib
import
logging
import
os
import
os
import
pkg_resources
import
pkg_resources
import
pwd
import
stat
import
stat
import
subprocess
import
subprocess
import
sys
import
sys
import
pwd
import
grp
from
slapos.grid.exception
import
BuildoutFailedError
,
WrongPermissionError
from
exception
import
BuildoutFailedError
,
WrongPermissionError
from
hashlib
import
md5
# Such umask by default will create paths with full permission
# Such umask by default will create paths with full permission
# for user, non writable by group and not accessible by others
# for user, non writable by group and not accessible by others
...
@@ -116,7 +117,7 @@ class SlapPopen(subprocess.Popen):
...
@@ -116,7 +117,7 @@ class SlapPopen(subprocess.Popen):
self
.
output
=
''
.
join
(
output_lines
)
self
.
output
=
''
.
join
(
output_lines
)
def
md5digest
(
url
):
def
md5digest
(
url
):
return
md5
(
url
).
hexdigest
()
return
hashlib
.
md5
(
url
).
hexdigest
()
def
getCleanEnvironment
(
home_path
=
'/tmp'
):
def
getCleanEnvironment
(
home_path
=
'/tmp'
):
...
...
slapos/tests/slapgrid.py
View file @
0a919d2f
...
@@ -25,16 +25,12 @@
...
@@ -25,16 +25,12 @@
#
#
##############################################################################
##############################################################################
from
slapos.grid
import
slapgrid
import
httplib
import
httplib
import
logging
import
logging
import
os
import
os
from
random
import
random
import
random
import
shutil
import
shutil
import
signal
import
signal
import
slapos.slap.slap
import
slapos.grid.utils
from
slapos.grid.watchdog
import
Watchdog
,
getWatchdogID
import
socket
import
socket
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -42,8 +38,15 @@ import textwrap
...
@@ -42,8 +38,15 @@ import textwrap
import
time
import
time
import
unittest
import
unittest
import
urlparse
import
urlparse
import
xml_marshaller
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
()
dummylogger
=
logging
.
getLogger
()
...
@@ -383,11 +386,11 @@ class InstanceForTest:
...
@@ -383,11 +386,11 @@ class InstanceForTest:
os
.
mkdir
(
certificate_repository_path
)
os
.
mkdir
(
certificate_repository_path
)
self
.
cert_file
=
os
.
path
.
join
(
certificate_repository_path
,
self
.
cert_file
=
os
.
path
.
join
(
certificate_repository_path
,
"%s.crt"
%
self
.
name
)
"%s.crt"
%
self
.
name
)
self
.
certificate
=
str
(
random
())
self
.
certificate
=
str
(
random
.
random
())
open
(
self
.
cert_file
,
'w'
).
write
(
self
.
certificate
)
open
(
self
.
cert_file
,
'w'
).
write
(
self
.
certificate
)
self
.
key_file
=
os
.
path
.
join
(
certificate_repository_path
,
self
.
key_file
=
os
.
path
.
join
(
certificate_repository_path
,
"%s.key"
%
self
.
name
)
"%s.key"
%
self
.
name
)
self
.
key
=
str
(
random
())
self
.
key
=
str
(
random
.
random
())
open
(
self
.
key_file
,
'w'
).
write
(
self
.
key
)
open
(
self
.
key_file
,
'w'
).
write
(
self
.
key
)
class
SoftwareForTest
:
class
SoftwareForTest
:
...
@@ -402,8 +405,7 @@ class SoftwareForTest:
...
@@ -402,8 +405,7 @@ class SoftwareForTest:
self
.
software_root
=
software_root
self
.
software_root
=
software_root
self
.
name
=
'http://sr%s/'
%
name
self
.
name
=
'http://sr%s/'
%
name
self
.
sequence
=
[]
self
.
sequence
=
[]
self
.
software_hash
=
\
self
.
software_hash
=
md5digest
(
self
.
name
)
slapos
.
grid
.
utils
.
md5digest
(
self
.
name
)
self
.
srdir
=
os
.
path
.
join
(
self
.
software_root
,
self
.
software_hash
)
self
.
srdir
=
os
.
path
.
join
(
self
.
software_root
,
self
.
software_hash
)
self
.
requested_state
=
'available'
self
.
requested_state
=
'available'
os
.
mkdir
(
self
.
srdir
)
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