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
Boxiang Sun
slapos.core
Commits
89b3e112
Commit
89b3e112
authored
Jun 24, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: simpler watchdog template
parent
95440d94
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
28 deletions
+26
-28
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
No files found.
slapos/grid/SlapObject.py
View file @
89b3e112
...
@@ -57,6 +57,7 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = 0o750
...
@@ -57,6 +57,7 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = 0o750
PROGRAM_PARTITION_TEMPLATE
=
pkg_resources
.
resource_stream
(
__name__
,
PROGRAM_PARTITION_TEMPLATE
=
pkg_resources
.
resource_stream
(
__name__
,
'templates/program_partition_supervisord.conf.in'
).
read
()
'templates/program_partition_supervisord.conf.in'
).
read
()
class
Software
(
object
):
class
Software
(
object
):
"""This class is responsible for installing a software release"""
"""This class is responsible for installing a software release"""
...
...
slapos/grid/watchdog.py
View file @
89b3e112
...
@@ -29,12 +29,15 @@
...
@@ -29,12 +29,15 @@
import
argparse
import
argparse
import
os.path
import
os.path
import
slapos.slap.slap
import
sys
import
sys
import
slapos.slap.slap
def
getWatchdogID
():
def
getWatchdogID
():
return
"-on-watch"
return
"-on-watch"
def
parseArgumentTuple
():
def
parseArgumentTuple
():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--master-url"
,
parser
.
add_argument
(
"--master-url"
,
...
...
slapos/tests/slapgrid.py
View file @
89b3e112
...
@@ -52,29 +52,23 @@ from slapos.grid import SlapObject
...
@@ -52,29 +52,23 @@ from slapos.grid import SlapObject
dummylogger
=
logging
.
getLogger
()
dummylogger
=
logging
.
getLogger
()
WATCHDOG_TEMPLATE
=
"""#!%(python_path)s -S
WATCHDOG_TEMPLATE
=
"""#!{python_path} -S
import sys
import sys
sys.path=
%(sys_path)s
sys.path=
{sys_path}
import slapos.slap
.slap
import slapos.slap
import slapos.grid.watchdog
import slapos.grid.watchdog
def setBang():
def bang(self_partition, message):
def getBang():
nl = chr(10)
def bang(self_partition,message):
with open('{watchdog_banged}', 'w') as fout:
report = ""
for key, value in vars(self_partition).items():
for key in self_partition.__dict__:
fout.write('%s: %s%s' % (key, value, nl))
report += (key + ': ' + str(self_partition.__dict__[key]) + ' ')
if key == '_connection_helper':
if key == '_connection_helper':
for el in self_partition.__dict__[key].__dict__:
for k, v in vars(value).items():
report += (' ' + el +': ' +
fout.write(' %s: %s%s' % (k, v, nl))
str(self_partition.__dict__[key].__dict__[el]) + ' ')
fout.write(message)
report += message
open('%(watchdog_banged)s','w').write(report)
slapos.slap.ComputerPartition.bang = bang
return bang
slapos.slap.ComputerPartition.bang = getBang()
setBang()
slapos.grid.watchdog.main()
slapos.grid.watchdog.main()
"""
"""
...
@@ -769,11 +763,11 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
...
@@ -769,11 +763,11 @@ class TestSlapgridCPWithMasterWatchdog(MasterMixin, unittest.TestCase):
# Prepare watchdog
# Prepare watchdog
self
.
watchdog_banged
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog_banged'
)
self
.
watchdog_banged
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog_banged'
)
watchdog_path
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog'
)
watchdog_path
=
os
.
path
.
join
(
self
.
_tempdir
,
'watchdog'
)
open
(
watchdog_path
,
'w'
).
write
(
WATCHDOG_TEMPLATE
%
{
open
(
watchdog_path
,
'w'
).
write
(
WATCHDOG_TEMPLATE
.
format
(
'python_path'
:
sys
.
executable
,
python_path
=
sys
.
executable
,
'sys_path'
:
sys
.
path
,
sys_path
=
sys
.
path
,
'watchdog_banged'
:
self
.
watchdog_banged
watchdog_banged
=
self
.
watchdog_banged
}
)
)
)
os
.
chmod
(
watchdog_path
,
0o755
)
os
.
chmod
(
watchdog_path
,
0o755
)
self
.
grid
.
watchdog_path
=
watchdog_path
self
.
grid
.
watchdog_path
=
watchdog_path
slapos
.
grid
.
slapgrid
.
WATCHDOG_PATH
=
watchdog_path
slapos
.
grid
.
slapgrid
.
WATCHDOG_PATH
=
watchdog_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