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
Ivan Tyagov
slapos.core
Commits
93588cd4
Commit
93588cd4
authored
Jun 24, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'cliff'
Conflicts: slapos/grid/SlapObject.py
parents
ccd042ab
1b45e7c7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
29 deletions
+27
-29
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+1
-0
slapos/grid/watchdog.py
slapos/grid/watchdog.py
+6
-3
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+19
-25
slapos/util.py
slapos/util.py
+1
-1
No files found.
slapos/grid/SlapObject.py
View file @
93588cd4
...
...
@@ -57,6 +57,7 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = 0o750
PROGRAM_PARTITION_TEMPLATE
=
pkg_resources
.
resource_stream
(
__name__
,
'templates/program_partition_supervisord.conf.in'
).
read
()
class
Software
(
object
):
"""This class is responsible for installing a software release"""
...
...
slapos/grid/watchdog.py
View file @
93588cd4
...
...
@@ -29,12 +29,15 @@
import
argparse
import
os.path
import
slapos.slap.slap
import
sys
import
slapos.slap.slap
def
getWatchdogID
():
return
"-on-watch"
def
parseArgumentTuple
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--master-url"
,
...
...
@@ -93,9 +96,9 @@ class Watchdog(object):
self
.
write_stdout
(
'READY
\
n
'
)
line
=
self
.
stdin
.
readline
()
# read header line from stdin
headers
=
dict
([
x
.
split
(
':'
)
for
x
in
line
.
split
()])
data
=
sys
.
stdin
.
read
(
int
(
headers
[
'len'
]))
# read the event payload
data
=
sys
.
stdin
.
read
(
int
(
headers
[
'len'
]))
# read the event payload
self
.
handle_event
(
headers
,
data
)
self
.
write_stdout
(
'RESULT 2
\
n
OK'
)
# transition from READY to ACKNOWLEDGED
self
.
write_stdout
(
'RESULT 2
\
n
OK'
)
# transition from READY to ACKNOWLEDGED
def
handle_event
(
self
,
headers
,
payload
):
if
headers
[
'eventname'
]
in
self
.
process_state_events
:
...
...
slapos/tests/slapgrid.py
View file @
93588cd4
...
...
@@ -52,29 +52,23 @@ from slapos.grid import SlapObject
dummylogger
=
logging
.
getLogger
()
WATCHDOG_TEMPLATE
=
"""#!%(python_path)s -S
WATCHDOG_TEMPLATE
=
"""#!{python_path} -S
import sys
sys.path=
%(sys_path)s
import slapos.slap
.slap
sys.path=
{sys_path}
import slapos.slap
import slapos.grid.watchdog
def setBang():
def getBang():
def bang(self_partition,message):
report = ""
for key in self_partition.__dict__:
report += (key + ': ' + str(self_partition.__dict__[key]) + ' ')
if key == '_connection_helper':
for el in self_partition.__dict__[key].__dict__:
report += (' ' + el +': ' +
str(self_partition.__dict__[key].__dict__[el]) + ' ')
report += message
open('%(watchdog_banged)s','w').write(report)
return bang
slapos.slap.ComputerPartition.bang = getBang()
setBang()
def bang(self_partition, message):
nl = chr(10)
with open('{watchdog_banged}', 'w') as fout:
for key, value in vars(self_partition).items():
fout.write('%s: %s%s' % (key, value, nl))
if key == '_connection_helper':
for k, v in vars(value).items():
fout.write(' %s: %s%s' % (k, v, nl))
fout.write(message)
slapos.slap.ComputerPartition.bang = bang
slapos.grid.watchdog.main()
"""
...
...
@@ -769,11 +763,11 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
# Prepare watchdog
self
.
watchdog_banged
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog_banged'
)
watchdog_path
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog'
)
open
(
watchdog_path
,
'w'
).
write
(
WATCHDOG_TEMPLATE
%
{
'python_path'
:
sys
.
executable
,
'sys_path'
:
sys
.
path
,
'watchdog_banged'
:
self
.
watchdog_banged
}
)
open
(
watchdog_path
,
'w'
).
write
(
WATCHDOG_TEMPLATE
.
format
(
python_path
=
sys
.
executable
,
sys_path
=
sys
.
path
,
watchdog_banged
=
self
.
watchdog_banged
)
)
os
.
chmod
(
watchdog_path
,
0o755
)
self
.
grid
.
watchdog_path
=
watchdog_path
slapos
.
grid
.
slapgrid
.
WATCHDOG_PATH
=
watchdog_path
...
...
slapos/util.py
View file @
93588cd4
...
...
@@ -4,7 +4,7 @@ import errno
import
os
def
mkdir_p
(
path
,
mode
=
0o7
77
):
def
mkdir_p
(
path
,
mode
=
0o7
00
):
"""
\
Creates a directory and its parents, if needed.
...
...
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