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
17
Merge Requests
17
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
56098812
Commit
56098812
authored
Jan 08, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typos + cleanup
parent
f4e4808b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
18 deletions
+19
-18
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+19
-18
No files found.
slapos/grid/SlapObject.py
View file @
56098812
# -*- coding: utf-8 -*-
# vim: set et sts=2:
##############################################################################
#
# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors.
...
...
@@ -52,6 +53,7 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = '0750'
class
Software
(
object
):
"""This class is responsible for installing a software release"""
def
__init__
(
self
,
url
,
software_root
,
buildout
,
signature_private_key_file
=
None
,
signature_certificate_list
=
None
,
upload_cache_url
=
None
,
upload_dir_url
=
None
,
shacache_cert_file
=
None
,
...
...
@@ -222,8 +224,9 @@ class Software(object):
class
Partition
(
object
):
"""This class is responsible of the installation of a instance
"""This class is responsible of the installation of a
n
instance
"""
def
__init__
(
self
,
software_path
,
instance_path
,
...
...
@@ -389,19 +392,20 @@ class Partition(object):
bootstrap_file
=
os
.
path
.
abspath
(
os
.
path
.
join
(
bootstrap_candidate_dir
,
bootstrap_candidate_list
[
0
]))
file
=
open
(
bootstrap_file
,
'r'
)
line
=
file
.
readline
()
file
.
close
()
first_line
=
open
(
bootstrap_file
,
'r'
).
readline
()
invocation_list
=
[]
if
line
.
startswith
(
'#!'
):
invocation_list
=
line
[
2
:].
split
()
if
first_
line
.
startswith
(
'#!'
):
invocation_list
=
first_
line
[
2
:].
split
()
invocation_list
.
append
(
bootstrap_file
)
self
.
logger
.
debug
(
'Invoking %r in %r'
%
(
' '
.
join
(
invocation_list
),
self
.
instance_path
))
kw
=
dict
(
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
process_handler
=
utils
.
SlapPopen
(
invocation_list
,
preexec_fn
=
lambda
:
utils
.
dropPrivileges
(
uid
,
gid
),
cwd
=
self
.
instance_path
,
env
=
utils
.
getCleanEnvironment
(
pwd
.
getpwuid
(
uid
).
pw_dir
),
**
kw
)
preexec_fn
=
lambda
:
utils
.
dropPrivileges
(
uid
,
gid
),
cwd
=
self
.
instance_path
,
env
=
utils
.
getCleanEnvironment
(
pwd
.
getpwuid
(
uid
).
pw_dir
),
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
process_handler
.
returncode
is
None
or
process_handler
.
returncode
!=
0
:
message
=
'Failed to bootstrap buildout in %r.'
%
(
self
.
instance_path
)
self
.
logger
.
error
(
message
)
...
...
@@ -487,17 +491,14 @@ class Partition(object):
destroy_executable_location
=
os
.
path
.
join
(
self
.
instance_path
,
'sbin'
,
'destroy'
)
if
os
.
path
.
exists
(
destroy_executable_location
):
# XXX: we should factorize this code
uid
,
gid
=
None
,
None
stat_info
=
os
.
stat
(
self
.
instance_path
)
uid
=
stat_info
.
st_uid
gid
=
stat_info
.
st_gid
uid
,
gid
=
self
.
getUserGroupId
()
self
.
logger
.
debug
(
'Invoking %r'
%
destroy_executable_location
)
kw
=
dict
()
kw
.
update
(
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
process_handler
=
utils
.
SlapPopen
([
destroy_executable_location
],
preexec_fn
=
lambda
:
utils
.
dropPrivileges
(
uid
,
gid
),
cwd
=
self
.
instance_path
,
env
=
utils
.
getCleanEnvironment
(
pwd
.
getpwuid
(
uid
).
pw_dir
),
**
kw
)
preexec_fn
=
lambda
:
utils
.
dropPrivileges
(
uid
,
gid
),
cwd
=
self
.
instance_path
,
env
=
utils
.
getCleanEnvironment
(
pwd
.
getpwuid
(
uid
).
pw_dir
),
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
)
if
process_handler
.
returncode
is
None
or
process_handler
.
returncode
!=
0
:
message
=
'Failed to destroy Computer Partition in %r.'
%
\
self
.
instance_path
...
...
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