Commit dcabf1b1 authored by Xavier Thompson's avatar Xavier Thompson

Update Release Candidate

parents 89e64228 2112ee3c
...@@ -9,17 +9,17 @@ parts = dcron-output ...@@ -9,17 +9,17 @@ parts = dcron-output
[dcron] [dcron]
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
shared = false shared = false
url = http://www.jimpryor.net/linux/releases/dcron-4.4.tar.gz url = http://www.jimpryor.net/linux/releases/dcron-4.5.tar.gz
md5sum = 02d848ba043a9df5bf2102a9f4bc04bd md5sum = 078833f3281f96944fc30392b1888326
configure-command = true configure-command = true
patch-binary = ${patch:location}/bin/patch
patches = patches =
${:_profile_base_location_}/dcron-4.4.noroot.no.globals.patch#d5408ab682b65cc1eda40d588fcd7db8 ${:_profile_base_location_}/noroot-no-globals.patch#623379916f48bd8292a28057c8bd30f7
patch-options = -p1 patch-options = -p1
make-options = make-options =
PREFIX=${buildout:parts-directory}/${:_buildout_section_name_} PREFIX=${buildout:parts-directory}/${:_buildout_section_name_}
post-make-hook = ${:_profile_base_location_}/dcron-hooks.py#d7985eef1ceef01af00ffb1d38708c8d:post_make_hook post-install =
environment = chmod u-s %(location)s/bin/crontab
PATH=${patch:location}/bin:%(PATH)s
dummy = ${randomsleep:recipe} dummy = ${randomsleep:recipe}
[dcron-output] [dcron-output]
......
import os
import shutil
def post_make_hook(options, buildout):
crontab_path = os.path.join(options['location'], 'bin', 'crontab')
os.chmod(crontab_path, 0o750)
diff -ru dcron-4.4.org/chuser.c dcron-4.4/chuser.c --- dcron-4.5/chuser.c
--- dcron-4.4.org/chuser.c 2010-01-18 16:27:31.000000000 +0100 +++ dcron-4.5/chuser.c
+++ dcron-4.4/chuser.c 2013-07-18 18:17:16.342147418 +0200 @@ -14,6 +14,7 @@
@@ -14,47 +14,6 @@
int int
ChangeUser(const char *user, char *dochdir) ChangeUser(const char *user, char *dochdir)
{ {
- struct passwd *pas; +#if 0
- struct passwd *pas;
- /*
- * Obtain password entry and change privilages /*
- */ @@ -57,5 +58,8 @@
- }
- if ((pas = getpwnam(user)) == 0) { }
- printlogf(LOG_ERR, "failed to get uid for %s\n", user); return(pas->pw_uid);
- return(-1); +#else
- } + return getpwnam(user);
- setenv("USER", pas->pw_name, 1); +#endif
- setenv("HOME", pas->pw_dir, 1);
- setenv("SHELL", "/bin/sh", 1);
-
- /*
- * Change running state to the user in question
- */
-
- if (initgroups(user, pas->pw_gid) < 0) {
- printlogf(LOG_ERR, "initgroups failed: %s %s\n", user, strerror(errno));
- return(-1);
- }
- if (setregid(pas->pw_gid, pas->pw_gid) < 0) {
- printlogf(LOG_ERR, "setregid failed: %s %d\n", user, pas->pw_gid);
- return(-1);
- }
- if (setreuid(pas->pw_uid, pas->pw_uid) < 0) {
- printlogf(LOG_ERR, "setreuid failed: %s %d\n", user, pas->pw_uid);
- return(-1);
- }
- if (dochdir) {
- /* try to change to $HOME */
- if (chdir(pas->pw_dir) < 0) {
- printlogf(LOG_ERR, "chdir failed: %s %s\n", user, pas->pw_dir);
- /* dochdir is a backup directory, usually /tmp */
- if (chdir(dochdir) < 0) {
- printlogf(LOG_ERR, "chdir failed: %s %s\n", user, dochdir);
- return(-1);
- }
- }
- }
- return(pas->pw_uid);
+ return getpwnam(user);
} }
diff -ru dcron-4.4.org/crontab.c dcron-4.4/crontab.c --- dcron-4.5/crontab.c
--- dcron-4.4.org/crontab.c 2010-01-18 16:27:31.000000000 +0100 +++ dcron-4.5/crontab.c
+++ dcron-4.4/crontab.c 2013-07-18 18:18:07.768535485 +0200
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
break; break;
case 'c': case 'c':
...@@ -81,9 +47,8 @@ diff -ru dcron-4.4.org/crontab.c dcron-4.4/crontab.c ...@@ -81,9 +47,8 @@ diff -ru dcron-4.4.org/crontab.c dcron-4.4/crontab.c
if ((ptr = getenv("EDITOR")) == NULL || strlen(ptr) >= sizeof(visual)) if ((ptr = getenv("EDITOR")) == NULL || strlen(ptr) >= sizeof(visual))
if ((ptr = getenv("VISUAL")) == NULL || strlen(ptr) >= sizeof(visual)) if ((ptr = getenv("VISUAL")) == NULL || strlen(ptr) >= sizeof(visual))
ptr = PATH_VI; ptr = PATH_VI;
diff -ru dcron-4.4.org/job.c dcron-4.4/job.c --- dcron-4.5/job.c
--- dcron-4.4.org/job.c 2010-01-18 16:27:31.000000000 +0100 +++ dcron-4.5/job.c
+++ dcron-4.4/job.c 2013-07-18 18:17:16.342147418 +0200
@@ -62,14 +62,6 @@ @@ -62,14 +62,6 @@
* Change running state to the user in question * Change running state to the user in question
*/ */
...@@ -114,9 +79,8 @@ diff -ru dcron-4.4.org/job.c dcron-4.4/job.c ...@@ -114,9 +79,8 @@ diff -ru dcron-4.4.org/job.c dcron-4.4/job.c
/* from this point we are unpriviledged */ /* from this point we are unpriviledged */
/* /*
diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile --- dcron-4.5/Makefile
--- dcron-4.4.org/Makefile 2010-01-18 16:27:31.000000000 +0100 +++ dcron-4.5/Makefile
+++ dcron-4.4/Makefile 2013-07-18 18:17:16.342147418 +0200
@@ -3,7 +3,6 @@ @@ -3,7 +3,6 @@
# these variables can be configured by e.g. `make SCRONTABS=/different/path` # these variables can be configured by e.g. `make SCRONTABS=/different/path`
...@@ -137,9 +101,9 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile ...@@ -137,9 +101,9 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile
+INSTALL_DATA = $(INSTALL) -D -m0644 +INSTALL_DATA = $(INSTALL) -D -m0644
+INSTALL_DIR = $(INSTALL) -d -m0755 +INSTALL_DIR = $(INSTALL) -d -m0755
CFLAGS ?= -O2 CFLAGS ?= -O2
CFLAGS += -Wall -Wstrict-prototypes CFLAGS += -Wall -Wstrict-prototypes -Wno-missing-field-initializers
SRCS = main.c subs.c database.c job.c concat.c chuser.c SRCS = main.c subs.c database.c job.c concat.c chuser.c
@@ -44,7 +43,6 @@ @@ -45,7 +44,6 @@
echo "SBINDIR = $(SBINDIR)" >> config echo "SBINDIR = $(SBINDIR)" >> config
echo "BINDIR = $(BINDIR)" >> config echo "BINDIR = $(BINDIR)" >> config
echo "MANDIR = $(MANDIR)" >> config echo "MANDIR = $(MANDIR)" >> config
...@@ -147,8 +111,8 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile ...@@ -147,8 +111,8 @@ diff -ru dcron-4.4.org/Makefile dcron-4.4/Makefile
echo "SCRONTABS = $(SCRONTABS)" >> config echo "SCRONTABS = $(SCRONTABS)" >> config
echo "CRONTABS = $(CRONTABS)" >> config echo "CRONTABS = $(CRONTABS)" >> config
echo "CRONSTAMPS = $(CRONSTAMPS)" >> config echo "CRONSTAMPS = $(CRONSTAMPS)" >> config
@@ -62,13 +60,10 @@ @@ -63,13 +61,10 @@
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $< -o $@ $(CC) $(CFLAGS) $(CPPFLAGS) -c $(DEFS) $< -o $@
install: install:
- $(INSTALL_PROGRAM) -m0700 -g root crond $(DESTDIR)$(SBINDIR)/crond - $(INSTALL_PROGRAM) -m0700 -g root crond $(DESTDIR)$(SBINDIR)/crond
......
...@@ -44,8 +44,8 @@ environment-extra = ...@@ -44,8 +44,8 @@ environment-extra =
[golang1.15] [golang1.15]
<= golang-common <= golang-common
url = https://golang.org/dl/go1.15.11.src.tar.gz url = https://golang.org/dl/go1.15.12.src.tar.gz
md5sum = bd7617d2b959eb6e0b0df2a19e435a06 md5sum = b3a5dafa7028fa00083ce4aeaf5bcb9a
# go1.15 needs go1.4 to bootstrap # go1.15 needs go1.4 to bootstrap
environment-extra = environment-extra =
...@@ -53,8 +53,8 @@ environment-extra = ...@@ -53,8 +53,8 @@ environment-extra =
[golang1.16] [golang1.16]
<= golang-common <= golang-common
url = https://golang.org/dl/go1.16.3.src.tar.gz url = https://golang.org/dl/go1.16.4.src.tar.gz
md5sum = 48183a40d6522f1ea59b7d63377b7072 md5sum = 5884a4cb49067b9bcf6e69a1ef44259c
# go1.16 needs go1.4 to bootstrap # go1.16 needs go1.4 to bootstrap
environment-extra = environment-extra =
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Should go away once wendelin.core 2 lands to nexedi/wendelin.core@master. # Should go away once wendelin.core 2 lands to nexedi/wendelin.core@master.
# Must be extended from last, for example: # Must be extended from last, for example:
# #
# [buildout] # [buildout]
# extends = # extends =
# .../stack/erp5/buildout.cfg # .../stack/erp5/buildout.cfg
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
[wendelin.core-repository] [wendelin.core-repository]
repository = https://lab.nexedi.com/kirr/wendelin.core.git repository = https://lab.nexedi.com/kirr/wendelin.core.git
branch = t branch = t
revison = revision =
...@@ -26,7 +26,7 @@ md5sum = dd6542a91746e6e3720eaa1590792dbe ...@@ -26,7 +26,7 @@ md5sum = dd6542a91746e6e3720eaa1590792dbe
[profile-caddy-replicate] [profile-caddy-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
md5sum = 1248911409cbeea980a838b04ee451d2 md5sum = ec421617d4932e8e1ae1e55a41fbfaab
[profile-slave-list] [profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in _update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
...@@ -106,11 +106,11 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8 ...@@ -106,11 +106,11 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8
[profile-kedifa] [profile-kedifa]
filename = instance-kedifa.cfg.in filename = instance-kedifa.cfg.in
md5sum = 3daebc4b37088fa01183a853920d4143 md5sum = 225ce18b9218de4169327a206051a92e
[template-backend-haproxy-rsyslogd-conf] [template-backend-haproxy-rsyslogd-conf]
_update_hash_filename_ = templates/backend-haproxy-rsyslogd.conf.in _update_hash_filename_ = templates/backend-haproxy-rsyslogd.conf.in
md5sum = 3ec9e088817f6a0e3b3b71919590e6b3 md5sum = 3336d554661b138dcef97b1d1866803c
[template-slave-introspection-httpd-nginx] [template-slave-introspection-httpd-nginx]
_update_hash_filename_ = templates/slave-introspection-httpd-nginx.conf.in _update_hash_filename_ = templates/slave-introspection-httpd-nginx.conf.in
......
...@@ -474,6 +474,7 @@ kedifa = ${request-kedifa:connection-monitor-base-url} ...@@ -474,6 +474,7 @@ kedifa = ${request-kedifa:connection-monitor-base-url}
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
bin = ${buildout:directory}/bin/ bin = ${buildout:directory}/bin/
srv = ${buildout:directory}/srv/ srv = ${buildout:directory}/srv/
tmp = ${buildout:directory}/tmp/
backup = ${:srv}/backup backup = ${:srv}/backup
# CAUCASE directories # CAUCASE directories
caucased = ${:srv}/caucased caucased = ${:srv}/caucased
...@@ -887,9 +888,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg ...@@ -887,9 +888,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
backup_dir='${directory:backup-caucased}', backup_dir='${directory:backup-caucased}',
data_dir='${directory:caucased}', data_dir='${directory:caucased}',
netloc=caucase_netloc, netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=0, service_auto_approve_count=0,
user_auto_approve_count=1, user_auto_approve_count=1,
key_len=2048, key_len=2048
)}} )}}
[buildout] [buildout]
......
...@@ -41,9 +41,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg ...@@ -41,9 +41,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
backup_dir='${directory:backup-caucased}', backup_dir='${directory:backup-caucased}',
data_dir='${directory:caucased}', data_dir='${directory:caucased}',
netloc=caucase_netloc, netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=0, service_auto_approve_count=0,
user_auto_approve_count=1, user_auto_approve_count=1,
key_len=2048, key_len=2048
)}} )}}
# Create all needed directories # Create all needed directories
......
...@@ -16,7 +16,7 @@ $Umask 0022 ...@@ -16,7 +16,7 @@ $Umask 0022
$WorkDirectory {{ configuration['spool-directory'] }} $WorkDirectory {{ configuration['spool-directory'] }}
# Setup logging per slave, by extracting the slave name from the log stream # Setup logging per slave, by extracting the slave name from the log stream
{%- set regex = ".*-backend (.*)-http.{0,1}/" %} {%- set regex = ".*-backend (.*)-http.{0,1}(|-failover)/" %}
template(name="extract_slave_name" type="string" string="%msg:R,ERE,1,FIELD:{{ regex }}--end%") template(name="extract_slave_name" type="string" string="%msg:R,ERE,1,FIELD:{{ regex }}--end%")
set $!slave_name = exec_template("extract_slave_name"); set $!slave_name = exec_template("extract_slave_name");
template(name="slave_output" type="string" string="{{ configuration['caddy-log-directory'] }}/%$!slave_name%_backend_log") template(name="slave_output" type="string" string="{{ configuration['caddy-log-directory'] }}/%$!slave_name%_backend_log")
......
...@@ -51,6 +51,8 @@ import urlparse ...@@ -51,6 +51,8 @@ import urlparse
import socket import socket
import sys import sys
import logging import logging
import random
import string
try: try:
...@@ -527,6 +529,15 @@ class TestHandler(BaseHTTPRequestHandler): ...@@ -527,6 +529,15 @@ class TestHandler(BaseHTTPRequestHandler):
response = None response = None
status_code = 200 status_code = 200
timeout = int(self.headers.dict.get('timeout', '0')) timeout = int(self.headers.dict.get('timeout', '0'))
if 'x-maximum-timeout' in self.headers.dict:
maximum_timeout = int(self.headers.dict['x-maximum-timeout'])
timeout = random.randrange(maximum_timeout)
if 'x-response-size' in self.headers.dict:
min_response, max_response = [
int(q) for q in self.headers.dict['x-response-size'].split(' ')]
reponse_size = random.randrange(min_response, max_response)
response = ''.join(
random.choice(string.lowercase) for x in range(reponse_size))
compress = int(self.headers.dict.get('compress', '0')) compress = int(self.headers.dict.get('compress', '0'))
header_dict = {} header_dict = {}
prefix = 'x-reply-header-' prefix = 'x-reply-header-'
...@@ -1190,6 +1201,16 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase): ...@@ -1190,6 +1201,16 @@ class SlaveHttpFrontendTestCase(HttpFrontendTestCase):
return parameter_dict return parameter_dict
def assertLastLogLineRegexp(self, log_name, log_regexp):
log_file = glob.glob(
os.path.join(
self.instance_path, '*', 'var', 'log', 'httpd', log_name
))[0]
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin): class TestMasterRequestDomain(HttpFrontendTestCase, TestDataMixin):
@classmethod @classmethod
...@@ -1880,38 +1901,24 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin): ...@@ -1880,38 +1901,24 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin):
result.headers['Set-Cookie'] result.headers['Set-Cookie']
) )
# check access log self.assertLastLogLineRegexp(
log_file = glob.glob( '_Url_access_log',
os.path.join( r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} - - '
self.instance_path, '*', 'var', 'log', 'httpd', '_Url_access_log' r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2} \+\d{4}\] '
))[0] r'"GET \/test-path\/deep\/..\/.\/deeper HTTP\/1.1" \d{3} '
r'\d+ "-" "TEST USER AGENT" \d+'
log_regexp = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} - - ' \ )
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2} \+\d{4}\] ' \
r'"GET \/test-path\/deep\/..\/.\/deeper HTTP\/1.1" \d{3} ' \
r'\d+ "-" "TEST USER AGENT" \d+'
self.assertRegexpMatches(
open(log_file, 'r').readlines()[-1],
log_regexp)
# check backend log
log_file = glob.glob(
os.path.join(
self.instance_path, '*', 'var', 'log', 'httpd', '_Url_backend_log'
))[0]
log_regexp = r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ ' \
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] ' \
r'http-backend _Url-http\/_Url-backend ' \
r'\d+/\d+\/\d+\/\d+\/\d+ ' \
r'200 \d+ - - ---- ' \
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ ' \
r'"GET /test-path/deeper HTTP/1.1"'
self.assertRegexpMatches( self.assertLastLogLineRegexp(
open(log_file, 'r').readlines()[-1], '_Url_backend_log',
log_regexp) r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'http-backend _Url-http\/_Url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /test-path/deeper HTTP/1.1"'
)
result_http = fakeHTTPResult( result_http = fakeHTTPResult(
parameter_dict['domain'], parameter_dict['domain'],
...@@ -7322,9 +7329,32 @@ backend _health-check-default-http ...@@ -7322,9 +7329,32 @@ backend _health-check-default-http
self.assertEqualResultJson( self.assertEqualResultJson(
result, 'Path', '/failover-https-url?a=b&c=/failoverpath') result, 'Path', '/failover-https-url?a=b&c=/failoverpath')
self.assertLastLogLineRegexp(
'_health-check-failover-url_backend_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'https-backend _health-check-failover-url-https-failover'
r'\/_health-check-failover-url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /failoverpath HTTP/1.1"'
)
result = fakeHTTPResult(parameter_dict['domain'], '/failoverpath') result = fakeHTTPResult(parameter_dict['domain'], '/failoverpath')
self.assertEqualResultJson( self.assertEqualResultJson(
result, 'Path', '/failover-url?a=b&c=/failoverpath') result, 'Path', '/failover-url?a=b&c=/failoverpath')
self.assertLastLogLineRegexp(
'_health-check-failover-url_backend_log',
r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+ '
r'\[\d{2}\/.{3}\/\d{4}\:\d{2}\:\d{2}\:\d{2}.\d{3}\] '
r'http-backend _health-check-failover-url-http-failover'
r'\/_health-check-failover-url-backend '
r'\d+/\d+\/\d+\/\d+\/\d+ '
r'200 \d+ - - ---- '
r'\d+\/\d+\/\d+\/\d+\/\d+ \d+\/\d+ '
r'"GET /failoverpath HTTP/1.1"'
)
def test_health_check_failover_url_auth_to_backend(self): def test_health_check_failover_url_auth_to_backend(self):
parameter_dict = self.assertSlaveBase( parameter_dict = self.assertSlaveBase(
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# not need these here). # not need these here).
[instance-caucased] [instance-caucased]
filename = instance-caucased.cfg.jinja2 filename = instance-caucased.cfg.jinja2
md5sum = 8081efb41f12592033283db9841178ea md5sum = 2e7c1d8c553b398dd68c875a9fa38cdb
[instance] [instance]
filename = instance.cfg.jinja2 filename = instance.cfg.jinja2
......
...@@ -6,6 +6,7 @@ recipe = slapos.cookbook:mkdirectory ...@@ -6,6 +6,7 @@ recipe = slapos.cookbook:mkdirectory
etc = ${buildout:directory}/etc etc = ${buildout:directory}/etc
service-on-watch = ${:etc}/service service-on-watch = ${:etc}/service
srv = ${buildout:directory}/srv srv = ${buildout:directory}/srv
tmp = ${buildout:directory}/tmp
{{ caucase.caucased( {{ caucase.caucased(
prefix='caucased', prefix='caucased',
...@@ -13,6 +14,7 @@ srv = ${buildout:directory}/srv ...@@ -13,6 +14,7 @@ srv = ${buildout:directory}/srv
caucased_path='${directory:service-on-watch}/caucased', caucased_path='${directory:service-on-watch}/caucased',
data_dir='${directory:srv}/caucased', data_dir='${directory:srv}/caucased',
netloc=netloc, netloc=netloc,
tmp='%{directory:tmp}',
service_auto_approve_count=slapparameter_dict.get('service-auto-approve-amount', 0), service_auto_approve_count=slapparameter_dict.get('service-auto-approve-amount', 0),
user_auto_approve_count=slapparameter_dict.get('user-auto-approve-amount', 1), user_auto_approve_count=slapparameter_dict.get('user-auto-approve-amount', 1),
key_len=slapparameter_dict.get('key-length', 2048), key_len=slapparameter_dict.get('key-length', 2048),
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = eba73f868a5bbfb942323eadcd88cb16 md5sum = c341609c8d0cfe240a3a2ae35bd713b6
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
......
...@@ -89,6 +89,7 @@ backup-caucased = ${:srv}/backup/caucased ...@@ -89,6 +89,7 @@ backup-caucased = ${:srv}/backup/caucased
backup_dir='${directory:backup-caucased}', backup_dir='${directory:backup-caucased}',
data_dir='${directory:srv}/caucased', data_dir='${directory:srv}/caucased',
netloc=caucase_netloc, netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1), service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1),
user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0), user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0),
key_len=caucase_dict.get('key-length', 2048), key_len=caucase_dict.get('key-length', 2048),
...@@ -252,7 +253,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z ...@@ -252,7 +253,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z
config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }} config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }}
config-test-runner-enabled = {{ dumps(test_runner_enabled) }} config-test-runner-enabled = {{ dumps(test_runner_enabled) }}
config-test-runner-node-count = {{ dumps(test_runner_node_count) }} config-test-runner-node-count = {{ dumps(test_runner_node_count) }}
config-wcfs_enable = {{ wcfs_enable }} config-wcfs_enable = {{ dumps(wcfs_enable) }}
software-type = zope software-type = zope
{% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%} {% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%}
...@@ -374,6 +375,7 @@ ca-dir = ${buildout:directory}/srv/ssl ...@@ -374,6 +375,7 @@ ca-dir = ${buildout:directory}/srv/ssl
{% endif -%} {% endif -%}
bin = ${buildout:directory}/bin bin = ${buildout:directory}/bin
etc = ${buildout:directory}/etc etc = ${buildout:directory}/etc
tmp = ${buildout:directory}/tmp
services = ${:etc}/run services = ${:etc}/run
requests = ${:ca-dir}/requests requests = ${:ca-dir}/requests
private = ${:ca-dir}/private private = ${:ca-dir}/private
......
[buildout] [buildout]
extends = extends =
../../software/erp5/software.cfg ../../software/erp5/software.cfg
../../component/wendelin.core/activate-WC2-preview.cfg
buildout.hash.cfg buildout.hash.cfg
parts += parts +=
...@@ -14,6 +15,8 @@ parts += ...@@ -14,6 +15,8 @@ parts +=
[ZODB] [ZODB]
major = 4-wc2 major = 4-wc2
[erp5-defaults]
wcfs-enable-default = true
[local-bt5-repository] [local-bt5-repository]
# Same as bt5-repository, but only local repository. # Same as bt5-repository, but only local repository.
......
...@@ -296,6 +296,7 @@ tests = ...@@ -296,6 +296,7 @@ tests =
fluentd ${slapos.test.fluentd-setup:setup} fluentd ${slapos.test.fluentd-setup:setup}
kvm ${slapos.test.kvm-setup:setup} kvm ${slapos.test.kvm-setup:setup}
slaprunner ${slapos.test.slaprunner-setup:setup} slaprunner ${slapos.test.slaprunner-setup:setup}
theia ${slapos.test.theia-setup:setup}
metabase ${slapos.test.metabase-setup:setup} metabase ${slapos.test.metabase-setup:setup}
### ###
${:extra} ${:extra}
...@@ -314,7 +315,6 @@ extra = ...@@ -314,7 +315,6 @@ extra =
jstestnode ${slapos.test.jstestnode-setup:setup} jstestnode ${slapos.test.jstestnode-setup:setup}
nextcloud ${slapos.test.nextcloud-setup:setup} nextcloud ${slapos.test.nextcloud-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup} turnserver ${slapos.test.turnserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
grafana ${slapos.test.grafana-setup:setup} grafana ${slapos.test.grafana-setup:setup}
gitlab ${slapos.test.gitlab-setup:setup} gitlab ${slapos.test.gitlab-setup:setup}
cloudooo ${slapos.test.cloudooo-setup:setup} cloudooo ${slapos.test.cloudooo-setup:setup}
......
...@@ -14,29 +14,29 @@ ...@@ -14,29 +14,29 @@
# not need these here). # not need these here).
[instance-theia] [instance-theia]
filename = instance-theia.cfg.jinja.in _update_hash_filename_ = instance-theia.cfg.jinja.in
md5sum = 65c66a4cc4eb1d074dcafddf945a34d4 md5sum = 942e269192d284e563a84ae710c0595b
[instance] [instance]
filename = instance.cfg.in _update_hash_filename_ = instance.cfg.in
md5sum = 43923e3e1f27c43696ecbca9ee147bdb md5sum = 9a5d6ac099c460481af7c1bdfd8de770
[yarn.lock] [yarn.lock]
filename = yarn.lock _update_hash_filename_ = yarn.lock
md5sum = 80e7ad91deea54cebcccef5a83fdb380 md5sum = 80e7ad91deea54cebcccef5a83fdb380
[python-language-server-requirements.txt] [python-language-server-requirements.txt]
filename = python-language-server-requirements.txt _update_hash_filename_ = python-language-server-requirements.txt
md5sum = 9f478fd1b03b7738f3de549cb899bf54 md5sum = 9f478fd1b03b7738f3de549cb899bf54
[preloadTemplate.html] [preloadTemplate.html]
filename = preloadTemplate.html _update_hash_filename_ = preloadTemplate.html
md5sum = 8157c22134200bd862a07c6521ebf799 md5sum = 8157c22134200bd862a07c6521ebf799
[slapos.css.in] [slapos.css.in]
filename = slapos.css.in _update_hash_filename_ = slapos.css.in
md5sum = d2930ec3ef973b7908f0fa896033fd64 md5sum = d2930ec3ef973b7908f0fa896033fd64
[logo.png] [logo.png]
filename = logo.png _update_hash_filename_ = logo.png
md5sum = 97bd0f828ffbac2681af0f4bd72cba27 md5sum = 97bd0f828ffbac2681af0f4bd72cba27
...@@ -23,6 +23,47 @@ ...@@ -23,6 +23,47 @@
"title": "Embedded Software Type", "title": "Embedded Software Type",
"description": "Type of the optional embedded software", "description": "Type of the optional embedded software",
"type": "string" "type": "string"
},
"embedded-instance-parameters": {
"title": "Embedded Instance Parameters",
"description": "Parameters for the embedded instance, as a JSON dict",
"type": "string"
},
"frontend-guid": {
"title": "Frontend Instance ID",
"description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".",
"type": "string"
},
"frontend-sr": {
"title": "Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
},
"frontend-sr-type": {
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
},
"additional-frontend-guid": {
"title": "Additional Frontend Instance ID",
"description": "Unique identifier of the additional frontend instance, like \"SOFTINST-11031\", if empty won't be requested.",
"type": "string"
},
"additional-frontend-sr": {
"title": "Additional Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg"
},
"additional-frontend-sr-type": {
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
} }
} }
} }
{% set additional_frontend = slapconfiguration_section['configuration.additional-frontend-guid'] %} {% set parameter_dict = dict(default_parameter_dict, **parameter_dict) %}
{% set additional_frontend = parameter_dict['additional-frontend-guid'] %}
[buildout] [buildout]
extends = extends =
...@@ -26,12 +27,6 @@ develop-eggs-directory = ${buildout:develop-eggs-directory} ...@@ -26,12 +27,6 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[instance-parameter]
{% for k, v in slapconfiguration_section.items() -%}
{{ k }} = {{ v }}
{% endfor -%}
[publish-connection-parameter] [publish-connection-parameter]
<= monitor-publish <= monitor-publish
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
...@@ -142,18 +137,18 @@ return = domain secure_access ...@@ -142,18 +137,18 @@ return = domain secure_access
[remote-frontend] [remote-frontend]
<= remote-frontend-base <= remote-frontend-base
name = $${instance-parameter:configuration.frontend-name} name = {{ parameter_dict['frontend-name'] }}
software-url = $${instance-parameter:configuration.frontend-sr} software-url = {{ parameter_dict['frontend-sr'] }}
software-type = $${instance-parameter:configuration.frontend-sr-type} software-type = {{ parameter_dict['frontend-sr-type'] }}
sla-instance_guid = $${instance-parameter:configuration.frontend-guid} sla-instance_guid = {{ parameter_dict['frontend-guid'] }}
{% if additional_frontend %} {% if additional_frontend %}
[remote-additional-frontend] [remote-additional-frontend]
<= remote-frontend-base <= remote-frontend-base
name = $${instance-parameter:configuration.additional-frontend-name} name = {{ parameter_dict['additional-frontend-name'] }}
software-url = $${instance-parameter:configuration.additional-frontend-sr} software-url = {{ parameter_dict['additional-frontend-sr'] }}
software-type = $${instance-parameter:configuration.additional-frontend-sr-type} software-type = {{ parameter_dict['additional-frontend-sr-type'] }}
sla-instance_guid = $${instance-parameter:configuration.additional-frontend-guid} sla-instance_guid = {{ parameter_dict['additional-frontend-guid'] }}
{% endif %} {% endif %}
...@@ -169,7 +164,7 @@ bytes = 12 ...@@ -169,7 +164,7 @@ bytes = 12
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 3000 minimum = 3000
maximum = 3100 maximum = 3100
ip = $${instance-parameter:ipv6-random} ip = {{ ipv6_random }}
[frontend-instance-certificate] [frontend-instance-certificate]
recipe = plone.recipe.command recipe = plone.recipe.command
...@@ -311,9 +306,6 @@ mode = 0700 ...@@ -311,9 +306,6 @@ mode = 0700
template = template =
inline: inline:
#!/bin/sh #!/bin/sh
. ${gowork:env.sh}
# reset PS1 from gowork
export PS1='$ '
export HOME=$${buildout:directory} export HOME=$${buildout:directory}
export PATH=${python-language-server:location}/bin:${java-jdk:location}/bin:${cli-utilities:PATH}:$HOME/.cargo/bin:$PATH export PATH=${python-language-server:location}/bin:${java-jdk:location}/bin:${cli-utilities:PATH}:$HOME/.cargo/bin:$PATH
...@@ -325,7 +317,7 @@ template = ...@@ -325,7 +317,7 @@ template =
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 3500 minimum = 3500
maximum = 3600 maximum = 3600
ip = $${instance-parameter:ipv4-random} ip = {{ ipv4_random }}
[theia-service] [theia-service]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -336,6 +328,7 @@ template = ...@@ -336,6 +328,7 @@ template =
{{ "{% raw %}" }} {{ "{% raw %}" }}
{% raw %} {% raw %}
export THEIA_WEBVIEW_EXTERNAL_ENDPOINT='{{hostname}}' export THEIA_WEBVIEW_EXTERNAL_ENDPOINT='{{hostname}}'
export THEIA_MINI_BROWSER_HOST_PATTERN='{{hostname}}'
{% endraw %} {% endraw %}
{{ "{% endraw %}" }} {{ "{% endraw %}" }}
export THEIA_OPEN_EDITOR_TOKEN=$(${openssl:location}/bin/openssl rand -hex 32) export THEIA_OPEN_EDITOR_TOKEN=$(${openssl:location}/bin/openssl rand -hex 32)
...@@ -360,7 +353,7 @@ command-line = $${theia-service:rendered} --hostname=$${:hostname} --port=$${:p ...@@ -360,7 +353,7 @@ command-line = $${theia-service:rendered} --hostname=$${:hostname} --port=$${:p
hash-existing-files = hash-existing-files =
${yarn.lock:output} ${yarn.lock:output}
${theia-wrapper:rendered} ${theia-wrapper:rendered}
ip = $${instance-parameter:ipv4-random} ip = {{ ipv4_random }}
hostname = $${:ip} hostname = $${:ip}
port = $${theia-service:port} port = $${theia-service:port}
base-url = $${theia-service:base-url} base-url = $${theia-service:base-url}
...@@ -416,11 +409,11 @@ command = ...@@ -416,11 +409,11 @@ command =
recipe = slapos.cookbook:free_port recipe = slapos.cookbook:free_port
minimum = 4000 minimum = 4000
maximum = 4100 maximum = 4100
ip = $${instance-parameter:ipv4-random} ip = {{ ipv4_random }}
[slapos-standalone-config] [slapos-standalone-config]
ipv4 = $${instance-parameter:ipv4-random} ipv4 = {{ ipv4_random }}
ipv6 = $${instance-parameter:ipv6-random} ipv6 = {{ ipv6_random }}
port = $${slapos-standalone-port:port} port = $${slapos-standalone-port:port}
slapos-configuration = $${directory:runner}/etc/slapos.cfg slapos-configuration = $${directory:runner}/etc/slapos.cfg
computer-id = slaprunner computer-id = slaprunner
...@@ -451,8 +444,11 @@ template = ...@@ -451,8 +444,11 @@ template =
$${slapos-standalone-config:ipv6} \ $${slapos-standalone-config:ipv6} \
$${slapos-standalone-config:port} \ $${slapos-standalone-config:port} \
$${slapos-standalone-config:computer-id} \ $${slapos-standalone-config:computer-id} \
--sr='$${instance-parameter:configuration.embedded-sr}' \ {% if parameter_dict.get('embedded-sr') %} \
--srtype='$${instance-parameter:configuration.embedded-sr-type}' \ --sr='{{ parameter_dict['embedded-sr'] }}' \
--srtype='{{ parameter_dict['embedded-sr-type'] }}' \
--srparams='$${embedded-instance-parameters:rendered}' \
{% endif %} \
$${slap-connection:server-url} \ $${slap-connection:server-url} \
$${slap-connection:computer-id} \ $${slap-connection:computer-id} \
$${slap-connection:partition-id} \ $${slap-connection:partition-id} \
...@@ -482,7 +478,7 @@ command = ...@@ -482,7 +478,7 @@ command =
update-command = $${:command} update-command = $${:command}
service-name = slapos-node-auto service-name = slapos-node-auto
supervisor-conf = $${directory:runner}/etc/supervisord.conf supervisor-conf = $${directory:runner}/etc/supervisord.conf
autorun = $${instance-parameter:configuration.autorun} autorun = {{ parameter_dict['autorun'] }}
# Theia Local Environment Setup # Theia Local Environment Setup
...@@ -579,6 +575,14 @@ recipe = slapos.cookbook:symbolic.link ...@@ -579,6 +575,14 @@ recipe = slapos.cookbook:symbolic.link
target-directory = $${directory:project} target-directory = $${directory:project}
link-binary = $${directory:runner} link-binary = $${directory:runner}
{% if parameter_dict.get('embedded-sr') -%}
[embedded-instance-parameters]
recipe = slapos.recipe.template:jinja2
rendered = $${directory:etc}/$${:_buildout_section_name_}.json
template =
inline:{{ parameter_dict['embedded-instance-parameters'] | indent(2) }}
{%- endif %}
[request-script-template] [request-script-template]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
rendered = $${directory:project}/$${:_buildout_section_name_}.sh rendered = $${directory:project}/$${:_buildout_section_name_}.sh
......
...@@ -12,20 +12,6 @@ partition = $${slap-connection:partition-id} ...@@ -12,20 +12,6 @@ partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url} url = $${slap-connection:server-url}
key = $${slap-connection:key-file} key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file} cert = $${slap-connection:cert-file}
;Theia default configuration
configuration.autorun = running
configuration.embedded-sr =
configuration.embedded-sr-type =
;Frontend default configuration
configuration.frontend-name = Theia Frontend
configuration.frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
configuration.frontend-sr-type = RootSoftwareInstance
configuration.frontend-guid =
;Additional frontend default configuration
configuration.additional-frontend-name = Theia Additional Frontend
configuration.additional-frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
configuration.additional-frontend-sr-type = RootSoftwareInstance
configuration.additional-frontend-guid =
[switch-softwaretype] [switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype recipe = slapos.cookbook:switch-softwaretype
...@@ -39,4 +25,23 @@ template = ${instance-theia:output} ...@@ -39,4 +25,23 @@ template = ${instance-theia:output}
rendered = $${buildout:directory}/instance-theia.cfg rendered = $${buildout:directory}/instance-theia.cfg
mode = 0644 mode = 0644
context = context =
section slapconfiguration_section slap-configuration jsonkey default_parameter_dict :default-parameters
key parameter_dict slap-configuration:configuration
key ipv6_random slap-configuration:ipv6-random
key ipv4_random slap-configuration:ipv4-random
default-parameters =
{
"autorun": "running",
"embedded-sr": null,
"embedded-sr-type": null,
"embedded-instance-parameters": "null",
"frontend-name": "Theia Frontend",
"frontend-sr": "$${:frontend-sr}",
"frontend-sr-type": "RootSoftwareInstance",
"frontend-guid": null,
"additional-frontend-name":"Theia Additional Frontend",
"additional-frontend-sr": "$${:frontend-sr}",
"additional-frontend-sr-type": "RootSoftwareInstance",
"additional-frontend-guid": null
}
frontend-sr = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
[buildout]
extends =
software.cfg
[python]
part = python3
...@@ -53,6 +53,7 @@ entry-points = ...@@ -53,6 +53,7 @@ entry-points =
initialization = initialization =
import argparse import argparse
import glob import glob
import json
import os.path import os.path
import sys import sys
import signal import signal
...@@ -68,6 +69,7 @@ initialization = ...@@ -68,6 +69,7 @@ initialization =
parser.add_argument('computer_id') parser.add_argument('computer_id')
parser.add_argument('--sr') parser.add_argument('--sr')
parser.add_argument('--srtype') parser.add_argument('--srtype')
parser.add_argument('--srparams')
forwarded_arguments = parser.add_argument_group('forwarded') forwarded_arguments = parser.add_argument_group('forwarded')
forwarded_arguments.add_argument('master_url') forwarded_arguments.add_argument('master_url')
forwarded_arguments.add_argument('computer') forwarded_arguments.add_argument('computer')
...@@ -118,9 +120,24 @@ initialization = ...@@ -118,9 +120,24 @@ initialization =
print("Error instanciating: {}".format(e)) print("Error instanciating: {}".format(e))
if args.sr: if args.sr:
print("Supplying and Requesting Embedded Software {}".format(args.sr)) try:
with open(args.srparams) as f:
params = json.load(f)
except Exception:
params = None
if not isinstance(params, dict):
params = None
print("Supplying and Requesting Embedded Software {sr} with type {srtype}".format(
sr=args.sr, srtype=args.srtype))
print("With parameters {param_dict} parsed from '{srparams}'".format(
param_dict=params, srparams=args.srparams))
standalone.supply(args.sr) standalone.supply(args.sr)
standalone.request(args.sr, "Embedded Instance", args.srtype or None) standalone.request(
args.sr,
"Embedded Instance",
args.srtype or None,
partition_parameter_kw=params,
)
quit_requested = [] quit_requested = []
def signal_handler(signum, frame): def signal_handler(signum, frame):
...@@ -149,9 +166,14 @@ eggs = ...@@ -149,9 +166,14 @@ eggs =
[template-base] [template-base]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/${:filename} url = ${:_profile_base_location_}/${:_update_hash_filename_}
output = ${buildout:parts-directory}/${:_buildout_section_name_} output = ${buildout:parts-directory}/${:_buildout_section_name_}
mode = 0644
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:_update_hash_filename_}
destination = ${buildout:directory}/${:_buildout_section_name_}
output = ${:destination}
[python-language-server] [python-language-server]
version = 0.19.0 version = 0.19.0
...@@ -164,7 +186,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_} ...@@ -164,7 +186,7 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
stop-on-error = true stop-on-error = true
[python-language-server-requirements.txt] [python-language-server-requirements.txt]
<= template-base <= download-base
[theia] [theia]
recipe = plone.recipe.command recipe = plone.recipe.command
...@@ -194,16 +216,16 @@ install = ...@@ -194,16 +216,16 @@ install =
os.chmod(destination_dir, 0o750) os.chmod(destination_dir, 0o750)
[yarn.lock] [yarn.lock]
<= template-base <= download-base
[preloadTemplate.html] [preloadTemplate.html]
<= template-base <= download-base
[slapos.css.in] [slapos.css.in]
<= template-base <= download-base
[logo.png] [logo.png]
<= template-base <= download-base
[package.json] [package.json]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -293,7 +315,6 @@ template = ...@@ -293,7 +315,6 @@ template =
} }
} }
rendered = ${buildout:directory}/${:_buildout_section_name_} rendered = ${buildout:directory}/${:_buildout_section_name_}
mode = 0644
[gowork] [gowork]
...@@ -308,7 +329,6 @@ PATH = ${nodejs:location}/bin:${bash:location}/bin:${fish-shell:location}/bin:${ ...@@ -308,7 +329,6 @@ PATH = ${nodejs:location}/bin:${bash:location}/bin:${fish-shell:location}/bin:${
[theia-wrapper] [theia-wrapper]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
rendered = ${buildout:bin-directory}/${:_buildout_section_name_} rendered = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
template = template =
inline: inline:
#!/bin/sh #!/bin/sh
...@@ -318,7 +338,6 @@ template = ...@@ -318,7 +338,6 @@ template =
[theia-open] [theia-open]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
rendered = ${buildout:bin-directory}/${:_buildout_section_name_} rendered = ${buildout:bin-directory}/${:_buildout_section_name_}
mode = 0755
template = template =
inline: inline:
#!/bin/sh #!/bin/sh
......
...@@ -40,15 +40,17 @@ import pexpect ...@@ -40,15 +40,17 @@ import pexpect
import psutil import psutil
import requests import requests
import sqlite3 import sqlite3
import six
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
from slapos.grid.svcbackend import getSupervisorRPC from slapos.grid.svcbackend import getSupervisorRPC
from slapos.grid.svcbackend import _getSupervisordSocketPath from slapos.grid.svcbackend import _getSupervisordSocketPath
software_cfg = 'software%s.cfg' % ('-py3' if six.PY3 else '')
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass( setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath( os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg'))) os.path.join(os.path.dirname(__file__), '..', software_cfg)))
class TheiaTestCase(SlapOSInstanceTestCase): class TheiaTestCase(SlapOSInstanceTestCase):
...@@ -190,9 +192,9 @@ class TestTheia(TheiaTestCase): ...@@ -190,9 +192,9 @@ class TestTheia(TheiaTestCase):
def test_slapos_cli(self): def test_slapos_cli(self):
slapos = self._getSlapos() slapos = self._getSlapos()
proxy_show_output = subprocess.check_output((slapos, 'proxy', 'show')) proxy_show_output = subprocess.check_output((slapos, 'proxy', 'show'))
self.assertIn('slaprunner', proxy_show_output) self.assertIn(b'slaprunner', proxy_show_output)
computer_list_output = subprocess.check_output((slapos, 'computer', 'list')) computer_list_output = subprocess.check_output((slapos, 'computer', 'list'))
self.assertIn('slaprunner', computer_list_output) self.assertIn(b'slaprunner', computer_list_output)
class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase): class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase):
...@@ -230,22 +232,27 @@ class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase): ...@@ -230,22 +232,27 @@ class TestTheiaEmbeddedSlapOSShutdown(TheiaTestCase):
class TestTheiaWithSR(TheiaTestCase): class TestTheiaWithSR(TheiaTestCase):
sr_url = 'bogus/software.cfg' sr_url = 'bogus/software.cfg'
sr_type = 'bogus_type' sr_type = 'bogus_type'
instance_parameters = '{\n"bogus_param": "bogus_value"\n}'
@classmethod @classmethod
def getInstanceParameterDict(cls): def getInstanceParameterDict(cls):
return { return {
'embedded-sr': cls.sr_url, 'embedded-sr': cls.sr_url,
'embedded-sr-type': cls.sr_type, 'embedded-sr-type': cls.sr_type,
'embedded-instance-parameters': cls.instance_parameters
} }
def test(self): def test(self):
slapos = self._getSlapos() slapos = self._getSlapos()
info = subprocess.check_output((slapos, 'proxy', 'show')) info = subprocess.check_output((slapos, 'proxy', 'show'), universal_newlines=True)
instance_name = "Embedded Instance" instance_name = "Embedded Instance"
self.assertIsNotNone(re.search(r"%s\s+slaprunner\s+available" % (self.sr_url,), info), info) self.assertIsNotNone(re.search(r"%s\s+slaprunner\s+available" % (self.sr_url,), info), info)
self.assertIsNotNone(re.search(r"%s\s+%s\s+%s" % (self.sr_url, self.sr_type, instance_name), info), info) self.assertIsNotNone(re.search(r"%s\s+%s\s+%s" % (self.sr_url, self.sr_type, instance_name), info), info)
service_info = subprocess.check_output((slapos, 'service', 'info', instance_name), universal_newlines=True)
self.assertIn("{'bogus_param': 'bogus_value'}", service_info)
class TestTheiaFrontend(TheiaTestCase): class TestTheiaFrontend(TheiaTestCase):
@classmethod @classmethod
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[caucase-jinja2-library] [caucase-jinja2-library]
filename = caucase.jinja2.library filename = caucase.jinja2.library
md5sum = b8a5a93b8a7bacd6ebd4b6df24c7c828 md5sum = 27aba89543032f3c7026ab566f3aa41b
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
caucased_path, caucased_path,
data_dir, data_dir,
netloc, netloc,
tmp,
service_auto_approve_count=0, service_auto_approve_count=0,
user_auto_approve_count=1, user_auto_approve_count=1,
key_len=None, key_len=None,
...@@ -18,6 +19,11 @@ mode = 0750 ...@@ -18,6 +19,11 @@ mode = 0750
[{{ prefix }}] [{{ prefix }}]
recipe = slapos.cookbook:wrapper recipe = slapos.cookbook:wrapper
wrapper-path = {{ caucased_path }} wrapper-path = {{ caucased_path }}
{%- if tmp %}
environment =
TMP={{ tmp }}
TMPDIR={{ tmp }}
{%- endif %}
command-line = '{{ buildout_bin_directory }}/caucased' command-line = '{{ buildout_bin_directory }}/caucased'
--db '${ {{- prefix }}-directory:data-dir}/caucase.sqlite' --db '${ {{- prefix }}-directory:data-dir}/caucase.sqlite'
--server-key '${ {{- prefix }}-directory:data-dir}/server.key.pem' --server-key '${ {{- prefix }}-directory:data-dir}/server.key.pem'
......
...@@ -74,7 +74,7 @@ md5sum = 8bd7f89b7c1e453ecc952659a01347e6 ...@@ -74,7 +74,7 @@ md5sum = 8bd7f89b7c1e453ecc952659a01347e6
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 79f092c54998918423257f4b676425ea md5sum = f33e82cb68924decb77142b79dce4fab
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
......
...@@ -71,6 +71,7 @@ recipe = slapos.cookbook:mkdirectory ...@@ -71,6 +71,7 @@ recipe = slapos.cookbook:mkdirectory
bin = ${buildout:directory}/bin bin = ${buildout:directory}/bin
service-on-watch = ${buildout:directory}/etc/service service-on-watch = ${buildout:directory}/etc/service
srv = ${buildout:directory}/srv srv = ${buildout:directory}/srv
tmp = {$buildout:directory}/tmp
backup-caucased = ${:srv}/backup/caucased backup-caucased = ${:srv}/backup/caucased
{% if not caucase_url -%} {% if not caucase_url -%}
...@@ -89,6 +90,7 @@ backup-caucased = ${:srv}/backup/caucased ...@@ -89,6 +90,7 @@ backup-caucased = ${:srv}/backup/caucased
backup_dir='${directory:backup-caucased}', backup_dir='${directory:backup-caucased}',
data_dir='${directory:srv}/caucased', data_dir='${directory:srv}/caucased',
netloc=caucase_netloc, netloc=caucase_netloc,
tmp='${directory:tmp}',
service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1), service_auto_approve_count=caucase_dict.get('service-auto-approve-amount', 1),
user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0), user_auto_approve_count=caucase_dict.get('user-auto-approve-amount', 0),
key_len=caucase_dict.get('key-length', 2048), key_len=caucase_dict.get('key-length', 2048),
...@@ -257,7 +259,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z ...@@ -257,7 +259,7 @@ config-wendelin-core-zblk-fmt = {{ dumps(slapparameter_dict.get('wendelin-core-z
config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }} config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }}
config-test-runner-enabled = {{ dumps(test_runner_enabled) }} config-test-runner-enabled = {{ dumps(test_runner_enabled) }}
config-test-runner-node-count = {{ dumps(test_runner_node_count) }} config-test-runner-node-count = {{ dumps(test_runner_node_count) }}
config-wcfs_enable = {{ wcfs_enable }} config-wcfs_enable = {{ dumps(wcfs_enable) }}
software-type = zope software-type = zope
{% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%} {% set global_publisher_timeout = slapparameter_dict.get('publisher-timeout') -%}
......
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