Commit 93588cd4 authored by Marco Mariani's avatar Marco Mariani

Merge branch 'cliff'

Conflicts:
	slapos/grid/SlapObject.py
parents ccd042ab 1b45e7c7
......@@ -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"""
......
......@@ -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",
......
......@@ -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]) + ' ')
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 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()
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
......
......@@ -4,7 +4,7 @@ import errno
import os
def mkdir_p(path, mode=0o777):
def mkdir_p(path, mode=0o700):
"""\
Creates a directory and its parents, if needed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment