Commit 2ac05422 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Update Release Candidate

parents 42ff3dc8 fa39a169
......@@ -75,6 +75,6 @@ library =
${nss:location}/lib
${pcre2:location}/lib
[chromedriver-download:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[chromedriver-download:linux and platform.machine() == "x86_64"]
url = https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${:revision-x86_64}%2Fchromedriver_linux64.zip?generation=${:generation-x86_64}&alt=media
md5sum = ${:md5sum-x86_64}
......@@ -104,7 +104,6 @@ library =
${alsa:location}/lib
${cairo:location}/lib
${cups:location}/lib
${cups:location}/lib64
${dbus:location}/lib/
${dbus-glib:location}/lib/
${fontconfig:location}/lib/
......@@ -145,6 +144,6 @@ library =
path =
${fontconfig:location}/bin
[chromium-download:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[chromium-download:linux and platform.machine() == "x86_64"]
url = https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F${:revision-x86_64}%2Fchrome-linux.zip?generation=${:generation-x86_64}&alt=media
md5sum = ${:md5sum-x86_64}
Disable clamdtop as it requires ncurses5, but ncurses5 doesn't build without an extra old gcc.
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1f890da..5e51ca1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,7 @@ endif()
set(ENABLE_DOXYGEN_DEFAULT OFF)
set(ENABLE_UNRAR_DEFAULT ON)
set(ENABLE_SYSTEMD_DEFAULT ON)
+set(ENABLE_CLAMDTOP_DEFAULT ON)
# See CMakeOptions.cmake for additional options.
include(CMakeOptions.cmake)
@@ -564,7 +565,9 @@ if(NOT ENABLE_LIBCLAMAV_ONLY)
endif()
if(ENABLE_APP)
- find_package(CURSES REQUIRED)
+ if(ENABLE_CLAMDTOP)
+ find_package(CURSES REQUIRED)
+ endif()
if(NOT WIN32 AND ENABLE_MILTER)
find_package(Milter REQUIRED)
@@ -1086,7 +1089,9 @@ if(NOT ENABLE_LIBCLAMAV_ONLY)
add_subdirectory( freshclam )
- add_subdirectory( clamdtop )
+ if(ENABLE_CLAMDTOP)
+ add_subdirectory( clamdtop )
+ endif()
if(WIN32)
add_subdirectory( win32/conf_examples )
diff --git a/CMakeOptions.cmake b/CMakeOptions.cmake
index e6e9b11..00b9db6 100644
--- a/CMakeOptions.cmake
+++ b/CMakeOptions.cmake
@@ -116,6 +116,10 @@ option(ENABLE_SYSTEMD
"Install systemd service files if systemd is found."
${ENABLE_SYSTEMD_DEFAULT})
+option(ENABLE_CLAMDTOP
+ "Compile clamdtop."
+ ${ENABLE_CLAMDTOP_DEFAULT})
+
# For reference determining target platform:
# Rust Targets: https://doc.rust-lang.org/nightly/rustc/platform-support.html
option(RUST_COMPILER_TARGET
[buildout]
extends =
../bzip2/buildout.cfg
../curl/buildout.cfg
../cmake/buildout.cfg
../json-c/buildout.cfg
../libxml2/buildout.cfg
../openssl/buildout.cfg
../patch/buildout.cfg
../pcre2/buildout.cfg
../rust/buildout.cfg
../zlib/buildout.cfg
parts =
clamav
[clamav]
recipe = slapos.recipe.cmmi
shared = true
url = https://www.clamav.net/downloads/production/clamav-1.3.1.tar.gz
md5sum = a2617a04a69433f9f7c86ede5dcc82c6
location = @@LOCATION@@
patch-options = -p1
patches =
${:_profile_base_location_}/add_cmake_enable_clamdtop_option.patch#79dad34211b89a37860bdf8388790b6e
configure-command = ${cmake:location}/bin/cmake
configure-options =
-DCMAKE_INSTALL_PREFIX=${:location}
-DCMAKE_C_FLAGS="${:CMAKE_CFLAGS}"
-DCMAKE_CXX_FLAGS="${:CMAKE_CFLAGS}"
-DCMAKE_INSTALL_RPATH=${:CMAKE_LIBRARY_PATH}
-DENABLE_MILTER=OFF
-DENABLE_CLAMONACC=OFF
-DENABLE_CLAMDTOP=OFF
-DENABLE_TESTS=OFF
environment=
CMAKE_PROGRAM_PATH=${cmake:location}/bin
CMAKE_INCLUDE_PATH=${openssl:location}/include:${bzip2:location}/include:${zlib:location}/include:${libxml2:location}/include:${pcre2:location}/include:${json-c:location}/include:${curl:location}/include
CMAKE_LIBRARY_PATH=${:CMAKE_LIBRARY_PATH}
PATH=${rustc:location}/bin:${patch:location}/bin:%(PATH)s
CMAKE_CFLAGS = -I${openssl:location}/include -I${bzip2:location}/include -I${zlib:location}/include -I${libxml2:location}/include -I${pcre2:location}/include -I${json-c:location}/include -I${curl:location}/include
CMAKE_LIBRARY_PATH = ${:location}/lib:${openssl:location}/lib:${bzip2:location}/lib:${zlib:location}/lib:${libxml2:location}/lib:${pcre2:location}/lib:${json-c:location}/lib:${curl:location}/lib
[buildout]
extends =
../git/buildout.cfg
../golang/buildout.cfg
parts =
clammit
[clammit-repository]
<= go-git-package
go.importpath = github.com/ifad/clammit
repository = https://github.com/ifad/clammit.git
revision = v0.8.1
[gowork]
install =
# We need a repository here, instead of a URL
# (github.com/ifad/clammit@v0.8.1), as the module
# definition in the go.mod is wrong (see
# https://github.com/ifad/clammit/pull/38)
${clammit-repository:location}:./...
......@@ -8,10 +8,10 @@ shared = true
version = 0.8.3
url = https://releases.hashicorp.com/consul/${:version}/consul_${:version}_${:_url}.zip
[consul:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[consul:linux and platform.machine() == "i386"]
_url = linux_386
md5sum = dfdc0eedd79baab7e6bc56c1582fd02e
[consul:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[consul:linux and platform.machine() == "x86_64"]
_url = linux_amd64
md5sum = d6bc0898ea37ae2198370a9e1978d1bb
......@@ -21,7 +21,7 @@ environment =
PATH=${patch:location}/bin:${perl:location}/bin:${xz-utils:location}/bin:%(PATH)s
LDFLAGS=-Wl,--as-needed -L${gmp:location}/lib -Wl,-rpath=${gmp:location}/lib
patches =
https://github.com/coreutils/coreutils/commit/c4c5ed8f4e9cd55a12966d4f520e3a13101637d9.patch#b6810d7559ffbc5e24636a860f02e836
https://github.com/coreutils/coreutils/commit/c4c5ed8f4e9cd55a12966d4f520e3a13101637d9.patch?full_index=1#5fc691542117b167b456daf222d2a6e5
patch-options = -p1
# disable year 2038 problem ONLY for 32 bit architectures
......
......@@ -12,6 +12,7 @@ recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/apple/cups/releases/download/release-1.7.4/cups-1.7.4-source.tar.bz2
md5sum = 1a2295c2b2d2f422db2e50f40ed2fb99
location = @@LOCATION@@
configure-options =
--disable-static
--disable-dbus
......@@ -25,6 +26,7 @@ configure-options =
--disable-default-shared
--disable-raw-printing
--disable-webif
--libdir=${:location}/lib
make-options =
libs
make-targets =
......
From 3666a7afd46ea6d069606450c520b8b7e2b5fddf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Thu, 22 Feb 2024 23:33:41 +0900
Subject: [PATCH] Make dict views behave like their unrestricted versions
unlike the restricted versions, the unrestricted versions:
- are not iterators, they are views
- have a len
- are false when the mapping is empty, true otherwise
- are instances of collections.abc.MappingView
During this refactoring, also change `.items()` to validate
ach keys and values, like `.keys()` and `.values()` do.
---
CHANGES.rst | 7 ++++
src/AccessControl/ZopeGuards.py | 50 ++++++++++++++++++-----
src/AccessControl/tests/actual_python.py | 33 +++++++++++++++
src/AccessControl/tests/testZopeGuards.py | 34 +++++++++++----
4 files changed, 104 insertions(+), 20 deletions(-)
diff --git a/CHANGES.rst b/CHANGES.rst
index f35a8d2..073b791 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -8,6 +8,13 @@ For changes before version 3.0, see ``HISTORY.rst``.
- Nothing changed yet.
+- Make dict views (`.keys()`, `.items()` and `.values()`) behave like their
+ unrestricted versions.
+ (`#147 <https://github.com/zopefoundation/AccessControl/pull/147>`_)
+
+- Make `.items()` validate each keys and values, like `.keys()` and
+ `.values()` do.
+
6.3 (2023-11-20)
----------------
diff --git a/src/AccessControl/ZopeGuards.py b/src/AccessControl/ZopeGuards.py
index 84c2e9e..bc24941 100644
--- a/src/AccessControl/ZopeGuards.py
+++ b/src/AccessControl/ZopeGuards.py
@@ -12,6 +12,7 @@
##############################################################################
+import collections.abc
import math
import random
import string
@@ -127,13 +128,18 @@ def guarded_pop(key, default=_marker):
return guarded_pop
-def get_iter(c, name):
- iter = getattr(c, name)
+def get_mapping_view(c, name):
- def guarded_iter():
- return SafeIter(iter(), c)
+ view_class = {
+ 'keys': SafeKeysView,
+ 'items': SafeItemsView,
+ 'values': SafeValuesView,
+ }
- return guarded_iter
+ def guarded_mapping_view():
+ return view_class[name](c)
+
+ return guarded_mapping_view
def get_list_pop(lst, name):
@@ -153,18 +159,15 @@ def guarded_pop(index=-1):
'copy': 1,
'fromkeys': 1,
'get': get_dict_get,
- 'items': 1,
+ 'items': get_mapping_view,
+ 'keys': get_mapping_view,
'pop': get_dict_pop,
'popitem': 1,
'setdefault': 1,
'update': 1,
+ 'values': get_mapping_view,
}
-_dict_white_list.update({
- 'keys': get_iter,
- 'values': get_iter,
-})
-
def _check_dict_access(name, value):
# Check whether value is a dict method
@@ -262,6 +265,31 @@ def __next__(self):
next = __next__
+class _SafeMappingView:
+ __allow_access_to_unprotected_subobjects__ = 1
+
+ def __iter__(self):
+ for e in super().__iter__():
+ guard(self._mapping, e)
+ yield e
+
+
+class SafeKeysView(_SafeMappingView, collections.abc.KeysView):
+ pass
+
+
+class SafeValuesView(_SafeMappingView, collections.abc.ValuesView):
+ pass
+
+
+class SafeItemsView(_SafeMappingView, collections.abc.ItemsView):
+ def __iter__(self):
+ for k, v in super().__iter__():
+ guard(self._mapping, k)
+ guard(self._mapping, v)
+ yield k, v
+
+
class NullIter(SafeIter):
def __init__(self, ob):
self._iter = ob
diff --git a/src/AccessControl/tests/actual_python.py b/src/AccessControl/tests/actual_python.py
index 3405b8e..866a480 100644
--- a/src/AccessControl/tests/actual_python.py
+++ b/src/AccessControl/tests/actual_python.py
@@ -123,6 +123,39 @@ def f7():
access = getattr(d, meth)
result = sorted(access())
assert result == expected[kind], (meth, kind, result, expected[kind])
+ assert len(access()) == len(expected[kind]), (meth, kind, "len")
+ iter_ = access() # iterate twice on the same view
+ assert list(iter_) == list(iter_)
+
+ assert sorted([k for k in getattr(d, meth)()]) == expected[kind]
+ assert sorted(k for k in getattr(d, meth)()) == expected[kind]
+ assert {k: v for k, v in d.items()} == d
+
+ assert 1 in d
+ assert 1 in d.keys()
+ assert 2 in d.values()
+ assert (1, 2) in d.items()
+
+ assert d
+ assert d.keys()
+ assert d.values()
+ assert d.items()
+
+ empty_d = {}
+ assert not empty_d
+ assert not empty_d.keys()
+ assert not empty_d.values()
+ assert not empty_d.items()
+
+ smaller_d = {1: 2}
+ for m, _ in methods:
+ assert getattr(d, m)() != getattr(smaller_d, m)()
+ assert not getattr(d, m)() == getattr(smaller_d, m)()
+ if m != 'values':
+ assert getattr(d, m)() > getattr(smaller_d, m)()
+ assert getattr(d, m)() >= getattr(smaller_d, m)()
+ assert getattr(smaller_d, m)() < getattr(d, m)()
+ assert getattr(smaller_d, m)() <= getattr(d, m)()
f7()
diff --git a/src/AccessControl/tests/testZopeGuards.py b/src/AccessControl/tests/testZopeGuards.py
index 533bfa2..50eeca9 100644
--- a/src/AccessControl/tests/testZopeGuards.py
+++ b/src/AccessControl/tests/testZopeGuards.py
@@ -258,23 +258,40 @@ def test_pop_validates(self):
self.assertTrue(sm.calls)
def test_keys_empty(self):
- from AccessControl.ZopeGuards import get_iter
- keys = get_iter({}, 'keys')
+ from AccessControl.ZopeGuards import get_mapping_view
+ keys = get_mapping_view({}, 'keys')
self.assertEqual(list(keys()), [])
+ def test_kvi_len(self):
+ from AccessControl.ZopeGuards import get_mapping_view
+ for attr in ("keys", "values", "items"):
+ with self.subTest(attr):
+ view = get_mapping_view({'a': 1}, attr)
+ self.assertEqual(len(view()), 1)
+
def test_keys_validates(self):
sm = SecurityManager()
old = self.setSecurityManager(sm)
keys = guarded_getattr({GuardTestCase: 1}, 'keys')
try:
- next(keys())
+ next(iter(keys()))
finally:
self.setSecurityManager(old)
self.assertTrue(sm.calls)
+ def test_items_validates(self):
+ sm = SecurityManager()
+ old = self.setSecurityManager(sm)
+ items = guarded_getattr({GuardTestCase: GuardTestCase}, 'items')
+ try:
+ next(iter(items()))
+ finally:
+ self.setSecurityManager(old)
+ self.assertEqual(len(sm.calls), 2)
+
def test_values_empty(self):
- from AccessControl.ZopeGuards import get_iter
- values = get_iter({}, 'values')
+ from AccessControl.ZopeGuards import get_mapping_view
+ values = get_mapping_view({}, 'values')
self.assertEqual(list(values()), [])
def test_values_validates(self):
@@ -282,18 +299,17 @@ def test_values_validates(self):
old = self.setSecurityManager(sm)
values = guarded_getattr({GuardTestCase: 1}, 'values')
try:
- next(values())
+ next(iter(values()))
finally:
self.setSecurityManager(old)
self.assertTrue(sm.calls)
def test_kvi_iteration(self):
- from AccessControl.ZopeGuards import SafeIter
d = dict(a=1, b=2)
for attr in ("keys", "values", "items"):
v = getattr(d, attr)()
- si = SafeIter(v)
- self.assertEqual(next(si), next(iter(v)))
+ si = guarded_getattr(d, attr)()
+ self.assertEqual(next(iter(si)), next(iter(v)))
class TestListGuards(GuardTestCase):
From 27d88c40e251b370f4dd2fcc7ae03c2967c68e4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 2 Sep 2024 04:41:13 +0000
Subject: [PATCH] checkPermission: align behavior with objects raising in
__getattr__
The observed problem was a behavior different between C and python
implementation on python 3, happening with Zope python script. When the
context can not be accessed by the current user, Zope binds a
`Shared.DC.Scripts.Bindings.UnauthorizedBinding`, a class that raises an
Unauthorized error when the context is actually accessed, in order to
postpone the Unauthorized if something is actually accessed. This class
does implements this by raising Unauthorized in __getattr__.
The python implementation of `checkPermission` uses `hasattr` and
`hasattr` has changed between python2 and python3, on python2 it was
ignoring all exceptions, including potential Unauthorized errors and
just returning False, but on python3 these errors are raised.
This change of behavior of python causes checkPermission to behave
differently: when using python implementation on python2 or when using
C implementation, such Unauthorized errors were gracefully handled and
caused checkPermission to return False, but on python3 checkPermission
raises.
This change make this scenario behave the same between python2, python3
and C implementation: Unauthorized errors raised in __getattr__ are
supported. The code is also micro-simplified by doing only one getattr
instead of hasattr and then getattr.
---
src/AccessControl/ImplPython.py | 6 +++++-
src/AccessControl/cAccessControl.c | 7 +++++--
src/AccessControl/tests/testZopeSecurityPolicy.py | 15 +++++++++++++++
4 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/src/AccessControl/ImplPython.py b/src/AccessControl/ImplPython.py
index 1a7788b..0a9326b 100644
--- a/src/AccessControl/ImplPython.py
+++ b/src/AccessControl/ImplPython.py
@@ -31,6 +31,7 @@
from Acquisition import aq_parent
from ExtensionClass import Base
from zope.interface import implementer
+from zExceptions import Unauthorized as zExceptions_Unauthorized
PURE_PYTHON = int(os.environ.get('PURE_PYTHON', '0'))
if PURE_PYTHON:
@@ -71,8 +72,11 @@ def rolesForPermissionOn(perm, object, default=_default_roles, n=None):
r = None
while True:
- if hasattr(object, n):
+ try:
roles = getattr(object, n)
+ except (AttributeError, zExceptions_Unauthorized):
+ pass
+ else:
if roles is None:
if _embed_permission_in_roles:
return (('Anonymous',), n)
diff --git a/src/AccessControl/cAccessControl.c b/src/AccessControl/cAccessControl.c
index 403ed67..1a109fa 100644
--- a/src/AccessControl/cAccessControl.c
+++ b/src/AccessControl/cAccessControl.c
@@ -1847,13 +1847,16 @@ c_rolesForPermissionOn(PyObject *perm, PyObject *object,
Py_INCREF(r);
/*
- while 1:
+ while True:
*/
while (1)
{
/*
- if hasattr(object, n):
+ try:
roles = getattr(object, n)
+ except (AttributeError, zExceptions_Unauthorized):
+ pass
+ else:
*/
PyObject *roles = PyObject_GetAttr(object, n);
if (roles != NULL)
diff --git a/src/AccessControl/tests/testZopeSecurityPolicy.py b/src/AccessControl/tests/testZopeSecurityPolicy.py
index 9b12a0f..ee74bad 100644
--- a/src/AccessControl/tests/testZopeSecurityPolicy.py
+++ b/src/AccessControl/tests/testZopeSecurityPolicy.py
@@ -157,6 +157,15 @@ class PartlyProtectedSimpleItem3 (PartlyProtectedSimpleItem1):
__roles__ = sysadmin_roles
+class DynamicallyUnauthorized(SimpleItemish):
+ # This class raises an Unauthorized on attribute access,
+ # similar to Zope's Shared.DC.Scripts.Bindings.UnauthorizedBinding
+ __ac_local_roles__ = {}
+
+ def __getattr__(self, name):
+ raise Unauthorized('Not authorized to access: %s' % name)
+
+
class SimpleClass:
attr = 1
@@ -173,6 +182,7 @@ def setUp(self):
a.item1 = PartlyProtectedSimpleItem1()
a.item2 = PartlyProtectedSimpleItem2()
a.item3 = PartlyProtectedSimpleItem3()
+ a.d_item = DynamicallyUnauthorized()
uf = UserFolder()
a.acl_users = uf
self.uf = a.acl_users
@@ -351,6 +361,11 @@ def test_checkPermission_proxy_role_scope(self):
r_subitem,
context))
+ def test_checkPermission_dynamically_unauthorized(self):
+ d_item = self.a.d_item
+ context = self.context
+ self.assertFalse(self.policy.checkPermission('View', d_item, context))
+
def testUnicodeRolesForPermission(self):
r_item = self.a.r_item
context = self.context
From 94785bb0ef91fd69b802b904b6037bc027f9b5b4 Mon Sep 17 00:00:00 2001
From: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
Date: Mon, 16 Sep 2024 09:48:40 +0200
Subject: [PATCH] Fix classify() for magic classifier and binary data.
---
Products/MimetypesRegistry/MimeTypesRegistry.py | 3 ++-
Products/MimetypesRegistry/tests/test_mimetypes.py | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/Products/MimetypesRegistry/MimeTypesRegistry.py b/Products/MimetypesRegistry/MimeTypesRegistry.py
index 1f5c4b5..ad480c3 100644
--- a/Products/MimetypesRegistry/MimeTypesRegistry.py
+++ b/Products/MimetypesRegistry/MimeTypesRegistry.py
@@ -303,6 +303,8 @@ def classify(self, data, mimetype=None, filename=None):
if mt is None:
mt = self.globFilename(filename)
if data and not mt:
+ if isinstance(data, str):
+ data = data.encode()
for c in self._classifiers():
if c.classify(data):
mt = c
@@ -322,7 +324,6 @@ def classify(self, data, mimetype=None, filename=None):
failed = "text/x-unknown-content-type"
filename = filename or ""
data = data or ""
- data = data.encode()
ct, enc = guess_content_type(filename, data, None)
if ct == failed:
ct = "text/plain"
diff --git a/Products/MimetypesRegistry/tests/test_mimetypes.py b/Products/MimetypesRegistry/tests/test_mimetypes.py
index 1f55056..1fb75a7 100644
--- a/Products/MimetypesRegistry/tests/test_mimetypes.py
+++ b/Products/MimetypesRegistry/tests/test_mimetypes.py
@@ -58,6 +58,10 @@ def testClassify(self):
mt = reg.classify("<?xml ?>")
self.assertTrue(isinstance(mt, text_xml), str(mt))
+ # test magic classifiers
+ mt = reg.classify("BEGIN:VCARD\n")
+ self.assertEqual(str(mt), "text/vcard")
+
# test no data return default
mt = reg.classify("")
self.assertTrue(isinstance(mt, text_plain), str(mt))
@@ -73,6 +77,10 @@ def testClassify(self):
mt = reg.classify("baz", filename="xxx")
self.assertTrue(isinstance(mt, application_octet_stream), str(mt))
+ # test unclassifiable binary data
+ mt = reg.classify(b"\x01")
+ self.assertTrue(isinstance(mt, application_octet_stream), str(mt))
+
def testExtension(self):
reg = self.registry
data = "<foo>bar</foo>"
......@@ -159,11 +159,11 @@ install =
${:post-install}
post-install =
[firefox-download:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[firefox-download:linux and platform.machine() == "i386"]
_url = linux-i686
md5sum = ${:i686-md5sum}
[firefox-download:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[firefox-download:linux and platform.machine() == "x86_64"]
_url = linux-x86_64
md5sum = ${:x86_64-md5sum}
......@@ -188,10 +188,10 @@ install =
extract_dir = self.extract(self.download(options['url'], options['md5sum']))
shutil.copy(os.path.join(extract_dir, 'geckodriver'), location)
[geckodriver-base:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[geckodriver-base:linux and platform.machine() == "i386"]
_url = linux32
md5sum = ${:i686-md5sum}
[geckodriver-base:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[geckodriver-base:linux and platform.machine() == "x86_64"]
_url = linux64
md5sum = ${:x86_64-md5sum}
......@@ -73,11 +73,16 @@ patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
${:_profile_base_location_}/gcc-libsanitizer-multiple-definition-fsconfig_command.patch#2135c53c901d67ce230f5c94352b7780
https://github.com/gcc-mirror/gcc/commit/6bf383c37e6131a8e247e8a0997d55d65c830b6d.patch?full_index=1#7fa2042dfacac2b48fb0153411ba2776
[gcc-10.5]
<= gcc-common
version = 10.5.0
md5sum = c7d1958570fbd1cd859b015774b9987a
patch-binary = ${patch:location}/bin/patch
patch-options = -p1
patches =
https://github.com/gcc-mirror/gcc/commit/6bf383c37e6131a8e247e8a0997d55d65c830b6d.patch?full_index=1#7fa2042dfacac2b48fb0153411ba2776
[gcc-12.3]
<= gcc-common
......
......@@ -15,15 +15,15 @@ parts = ghostscript
[ghostscript]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10031/ghostscript-10.03.1.tar.gz
md5sum = 01c515f190de2d8dcce4767407720855
url = https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs10040/ghostscript-10.04.0.tar.xz
md5sum = a86a78cac91b6e1fc674c7961e760c3f
pkg_config_depends = ${libidn:location}/lib/pkgconfig:${libtiff:location}/lib/pkgconfig:${libjpeg:location}/lib/pkgconfig:${fontconfig:location}/lib/pkgconfig:${fontconfig:pkg_config_depends}
configure-options =
--disable-cups
--with-system-libtiff
--without-so
--without-x
--with-drivers=FILES
--with-drivers=FILES,ocr
--with-tessdata=${:tessdata-location}
environment =
PATH=${pkgconfig:location}/bin:${xz-utils:location}/bin:%(PATH)s
......
......@@ -145,8 +145,8 @@ environment-extra =
[golang1.21]
<= golang-common
url = https://go.dev/dl/go1.21.9.src.tar.gz
md5sum = 3cc8b75a5499b5d309f267e21c3432df
url = https://go.dev/dl/go1.21.13.src.tar.gz
md5sum = 3454362fc56df5020920e43fee2776ab
# go1.21 requires go1.17.13 to bootstrap (see https://go.dev/blog/rebuild)
environment-extra =
GOROOT_BOOTSTRAP=${golang1.17:location}
......
From c5a43f8ac6cd4b690e83d0fe883939c670242d79 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Mon, 29 Sep 2014 09:42:24 +0200
Subject: [PATCH] add a temporary patch to respect more tokens in natural
language mode.
---
lib/ii.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/ii.c b/lib/ii.c
index 70c50720b..be994b301 100644
--- a/lib/ii.c
+++ b/lib/ii.c
@@ -12830,7 +12830,9 @@ grn_ii_similar_search_internal(grn_ctx *ctx, grn_ii_select_data *data)
? ((uint32_t)(data->optarg->similarity_threshold) > GRN_HASH_SIZE(h)
? GRN_HASH_SIZE(h)
: (uint32_t)(data->optarg->similarity_threshold))
- : (GRN_HASH_SIZE(h) >> 3) + 1;
+ : (GRN_HASH_SIZE(h) < 8
+ ? GRN_HASH_SIZE(h)
+ : ((GRN_HASH_SIZE(h) - 8) >> 3) + 8);
if (GRN_HASH_SIZE(h)) {
grn_id j, id;
float w2;
--
2.42.0
......@@ -15,12 +15,11 @@ extends =
[groonga]
recipe = slapos.recipe.cmmi
shared = true
url = https://packages.groonga.org/source/groonga/groonga-13.0.1.tar.gz
md5sum = d17d154c2ceffbf8b21d8ef6d3afa644
url = https://github.com/groonga/groonga/releases/download/v14.0.7/groonga-14.0.7.tar.gz
md5sum = b3d3223d704f507047c9dec766e1604e
groonga-plugin-dir = @@LOCATION@@/lib/groonga/plugins/
# temporary patch to respect more tokens in natural language mode.
patches =
${:_profile_base_location_}/groonga.patch#cc6a678acd478fc074e678c7b7dd09d8
${:_profile_base_location_}/0001-add-a-temporary-patch-to-respect-more-tokens-in-natu.patch#f7ca3ec3ed8f8311bd5afdee0cfe0ce8
patch-options = -p1
configure-options =
--disable-static
......
--- a/lib/ii.c
+++ b/lib/ii.c
@@ -10874,7 +10874,9 @@
? ((uint32_t)(data->optarg->similarity_threshold) > GRN_HASH_SIZE(h)
? GRN_HASH_SIZE(h)
:(uint32_t)(data->optarg->similarity_threshold))
- : (GRN_HASH_SIZE(h) >> 3) + 1;
+ : (GRN_HASH_SIZE(h) < 8
+ ? GRN_HASH_SIZE(h)
+ : ((GRN_HASH_SIZE(h) - 8) >> 3) + 8);
if (GRN_HASH_SIZE(h)) {
grn_id j, id;
float w2;
......@@ -175,7 +175,7 @@ url = https://download.gnome.org/core/44/44.10/sources/gtk+-3.24.41.tar.xz
md5sum = 2321e8158feac093b6ed82aac66dbbfd
pkg_config_depends = ${at-spi2-atk:location}/lib/pkgconfig:${at-spi2-core:location}/lib/pkgconfig:${atk:location}/lib/pkgconfig:${dbus:location}/lib/pkgconfig:${gdk-pixbuf:location}/lib/pkgconfig:${gdk-pixbuf:pkg_config_depends}:${libXi:pkg_config_depends}:${libXi:location}/lib/pkgconfig:${libXrandr:pkg_config_depends}:${libXrandr:location}/lib/pkgconfig:${libepoxy:location}/lib/pkgconfig:${libxkbcommon:location}/lib/pkgconfig:${libxkbcommon:pkg_config_depends}:${pango:location}/lib/pkgconfig:${pango:pkg_config_depends}
configure-command =
meson builddir --libdir=lib -Dprefix="@@LOCATION@@" -Dintrospection=false -Dwayland_backend=false -Dxinerama=no -Ddemos=false -Dexamples=false -Dtests=false -Dinstalled_tests=false
meson builddir --libdir=lib -Dprefix="@@LOCATION@@" -Dintrospection=false -Dwayland_backend=false -Dprint_backends=file -Dxinerama=no -Ddemos=false -Dexamples=false -Dtests=false -Dinstalled_tests=false
make-binary = ninja -C builddir
environment =
PATH=${gdk-pixbuf:location}/bin:${gettext:location}/bin:${glib:location}/bin:${meson:location}/bin:${ninja:location}/bin:${perl:location}/bin:${pkgconfig:location}/bin:${xz-utils:location}/bin:${python3:location}/bin:%(PATH)s
......
......@@ -7,8 +7,8 @@ parts =
[libexpat]
recipe = slapos.recipe.cmmi
shared = true
url = https://github.com/libexpat/libexpat/releases/download/R_2_6_2/expat-2.6.2.tar.lz
md5sum = 16ad24a204d5aee5fe8fb19e1a9b4700
url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.lz
md5sum = 5732b5335a3c75a052b3a37e99404b99
configure-options =
--disable-static
--without-xmlwf
......
......@@ -38,14 +38,14 @@ install =
cpio = ${cpio:location}/bin/cpio
rpm2cpio = ${rpm2cpio:target}
[libreoffice-bin:getattr(sys,'_multiarch',None)!='x86_64-linux-gnu']
[libreoffice-bin:not (linux and platform.machine() == "x86_64")]
recipe = plone.recipe.command
command =
echo unsupported architecture
false
stop-on-error = true
[libreoffice-bin:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[libreoffice-bin:linux and platform.machine() == "x86_64"]
_url1 = x86_64
_url2 = Linux_x86-64
md5sum = efb0351ac9ebd954c43f77d59632bd28
......@@ -135,8 +135,8 @@ md5sum = ba7abfae7947893c5a5343180808b0cb
# as plugin-dir ( https://mariadb.com/kb/en/server-system-variables/#plugin_dir )
recipe = slapos.recipe.cmmi
shared = true
url = https://packages.groonga.org/source/mroonga/mroonga-13.01.tar.gz
md5sum = 062d9575fbf8759b529fdc46b077a9c1
url = https://github.com/mroonga/mroonga/releases/download/v14.07/mroonga-14.07.tar.gz
md5sum = 86d98564a9bff2b993db284ce02c7260
pre-configure =
rm -rf fake_mariadb_source
mkdir -p fake_mariadb_source
......@@ -159,6 +159,7 @@ make-targets = plugindir=${:plugin-dir} install
patch-options = -p1
patches =
${:_profile_base_location_}/mroonga_boolean.patch#c818568fe35ca6a4298f18e575d962a0
https://github.com/mroonga/mroonga/commit/8f080086a6b7b15b84169e66fd6bf6956644ef98.patch?full_index=1#a275fa738a09f804515f61f69b8e549a
environment =
PATH=${binutils:location}/bin:${groonga:location}/bin:${patch:location}/bin:${pkgconfig:location}/bin:%(PATH)s
CPPFLAGS=-I${groonga:location}/include/groonga -I${pcre:location}/include
......
[buildout]
extends =
../flex/buildout.cfg
../libnsl/buildout.cfg
../lzo/buildout.cfg
../openssl/buildout.cfg
../flex/buildout.cfg
../xz-utils/buildout.cfg
parts =
......@@ -23,5 +24,5 @@ environment =
LZO_CFLAGS=-I${lzo:location}/include
OPENSSL_LIBS=-L${openssl-1.1:location}/lib -lcrypto -lssl
OPENSSL_CFLAGS=-I${openssl-1.1:location}/include
LDFLAGS =-Wl,-rpath=${lzo:location}/lib -Wl,-rpath=${flex:location}/lib -Wl,-rpath=${openssl-1.1:location}/lib
CPPFLAGS=-I${lzo:location}/include -I${flex:location}/include
LDFLAGS =-Wl,-rpath=${lzo:location}/lib -Wl,-rpath=${flex:location}/lib -Wl,-rpath=${openssl-1.1:location}/lib -L${libnsl:location}/lib -Wl,-rpath=${libnsl:location}/lib
CPPFLAGS=-I${lzo:location}/include -I${flex:location}/include -I${libnsl:location}/include
......@@ -8,10 +8,10 @@ shared = true
version = 0.7.5
url = https://releases.hashicorp.com/packer/${:version}/packer_${:version}_${:_url}.zip
[packer:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[packer:linux and platform.machine() == "i386"]
_url = linux_386
md5sum = a545108a0ccfde7c1e74de6c4e6fdded
[packer:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[packer:linux and platform.machine() == "x86_64"]
_url = linux_amd64
md5sum = f343d709b84db494e8d6ec38259aa4a6
......@@ -33,10 +33,10 @@ library =
path =
${fontconfig:location}/bin
[phantomjs:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[phantomjs:linux and platform.machine() == "i386"]
_url = linux-i686
md5sum = 9c1426eef5b04679d65198b1bdd6ef88
[phantomjs:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[phantomjs:linux and platform.machine() == "x86_64"]
_url = linux-x86_64
md5sum = f278996c3edd0e8d8ec4893807f27d71
......@@ -14,6 +14,7 @@ recipe = zc.recipe.egg:custom
patches =
${:_profile_base_location_}/pylint-super_on_old_class.patch#cb0c3f8c091bf4980be395c917edc435
${:_profile_base_location_}/pylint-redefining-builtins-modules.patch#043defc6e9002ac48b40e078797d4d17
${:_profile_base_location_}/understands-six.PY2-six.PY3-import-guard.patch#39f8ef6c16648dc41685a94399fd2cdb
patch-options = -p1
patch-binary = ${patch:location}/bin/patch
......
Author: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed Apr 3 14:58:52 2024 +0900
Fixes #3501 (pylint.git:e5e6ca71) for pylint 1.4.
--- a/pylint/checkers/variables.py 2024-06-26 16:40:48.654379000 +0000
+++ b/pylint/checkers/variables.py 2024-09-25 10:31:09.680816539 +0000
@@ -987,7 +987,10 @@
if module is astroid.YES:
return None
except astroid.NotFoundError:
- if module.name in ignored_modules:
+ if (module.name in ignored_modules or
+ (node.parent is not None and
+ isinstance(node.parent, astroid.nodes.If) and
+ node.parent.test.as_string() in ('six.PY2', 'six.PY3'))):
return None
self.add_message('no-name-in-module',
args=(name, module.name), node=node)
......@@ -6,7 +6,7 @@ parts =
recipe = zc.recipe.egg
egg = selenium
# patch to support python3.9
selenium-patches = https://github.com/SeleniumHQ/selenium/commit/ddd163b681776292a72c39352581cf5c9d4f88f4.patch#c801fade1cd2019c063a0f0ef7cca3fe
selenium-patches = https://github.com/SeleniumHQ/selenium/commit/ddd163b681776292a72c39352581cf5c9d4f88f4.patch?full_index=1#77deb91ef0ec8a9648786937dc5c6b67
selenium-patch-options = -p2
[versions]
......
......@@ -42,10 +42,10 @@ library =
path =
${fontconfig:location}/bin
[wkhtmltopdf:getattr(sys,'_multiarch',None)=='i386-linux-gnu']
[wkhtmltopdf:linux and platform.machine() == "i386"]
_url = linux-generic-i386
md5sum = ce1a2c0b2cf786ccc5d5828c42c99ddd
[wkhtmltopdf:getattr(sys,'_multiarch',None)=='x86_64-linux-gnu']
[wkhtmltopdf:linux and platform.machine() == "x86_64"]
_url = linux-generic-amd64
md5sum = 96b7306cebb9e65355f69f7ab63df68b
from unittest.mock import MagicMock
import unittest
from slapos.recipe import switch_softwaretype
import zc.buildout.testing
from zc.buildout.buildout import MissingOption, MissingSection
from mock import MagicMock
import six
class SwitchSoftwaretypeTest(unittest.TestCase):
......@@ -55,8 +57,11 @@ class SwitchSoftwaretypeTest(unittest.TestCase):
def test_fallback_default(self):
self.buildout['slap-configuration']['slap-software-type'] = 'RootSoftwareInstance'
with self.assertLogs('switch-softwaretype', level='INFO') as lc:
if six.PY2: # BBB
self.install_recipe()
else:
with self.assertLogs('switch-softwaretype', level='INFO') as lc:
self.install_recipe()
self.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.magick_sub_buildout.assert_called_once()
self.assertIn("The software_type 'RootSoftwareInstance' is deprecated", lc.output[0])
self.assertIn('instance-default.cfg', self.magick_sub_buildout.call_args.args)
......@@ -50,4 +50,4 @@ md5sum = 931038cfa23216af1628b960a2e10de6
[template]
filename = instance.cfg.in
md5sum = 974e21f30669e1b83e1e0cd8def0adc3
md5sum = 87bbe16a03003ae4071caa507b560cfe
......@@ -19,7 +19,7 @@ context =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:pullrdiffbackup}
default = $${:pullrdiffbackup}
pullrdiffbackup = dynamic-template-pullrdiffbackup:output
[slap-configuration]
......
......@@ -15,11 +15,11 @@
[instance]
filename = instance.cfg.in
md5sum = ed2bd38b78f2a66f474205249f6e6f2c
md5sum = b38ba6283dc617e491cc594abb08551d
[template-instance-beremiz]
filename = instance-beremiz.cfg.jinja2.in
md5sum = 29c65611d51975e5bb2a1e2002a0a6c8
md5sum = 218b95ed1290be788b7c67908dfcdc12
[template-instance-beremiz-test]
filename = instance-beremiz-test.cfg.jinja2.in
......
......@@ -261,7 +261,6 @@ config-url = https://[${nginx-params:ip}]:${nginx-params:port}
config-websocket-path-list = ${nginx-params:websocket-path}
return = secure_access domain
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
software-type = RootSoftwareInstance
name = Beremiz VNC
......
......@@ -7,7 +7,6 @@ develop-eggs-directory = {{ buildout_develop_directory }}
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = template-{{ instance_template_type }}:output
RootSoftwareInstance = ${:default}
test = template-beremiz-test:output
[slap-configuration]
......
......@@ -19,4 +19,4 @@ md5sum = 2e7c1d8c553b398dd68c875a9fa38cdb
[instance]
filename = instance.cfg.jinja2
md5sum = b4a50217c68233eb0e2922fd7606a6be
md5sum = d8dd5b68286c7ad38033866927a97d80
......@@ -32,5 +32,3 @@ import-list =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = caucased:output
# XXX: When will this name finally go away ?
RootSoftwareInstance = ${:default}
# THIS IS NOT A BUILDOUT FILE, despite purposedly using a compatible syntax.
# The only allowed lines here are (regexes):
# - "^#" comments, copied verbatim
# - "^[" section beginings, copied verbatim
# - lines containing an "=" sign which must fit in the following categorie.
# - "^\s*filename\s*=\s*path\s*$" where "path" is relative to this file
# Copied verbatim.
# - "^\s*hashtype\s*=.*" where "hashtype" is one of the values supported
# by the re-generation script.
# Re-generated.
# - other lines are copied verbatim
# Substitution (${...:...}), extension ([buildout] extends = ...) and
# section inheritance (< = ...) are NOT supported (but you should really
# not need these here).
[instance.cfg.in]
filename = instance.cfg.in
md5sum = da846d59eb75a82d0d392c396517e76d
[clamd.conf.in]
filename = clamd.conf.in
md5sum = bdd237340b052e97b19218c5b6098cb8
[freshclam.conf.in]
filename = freshclam.conf.in
md5sum = 09818454a8c898141f7d249630bcf6e7
[clammit.conf.in]
filename = clammit.conf.in
md5sum = b32336982401088d58b9a9938c37742f
Foreground yes
LogFile {{ clamconfig["clamd-log-file"] }}
# Both LogRotate and LogFileMaxSize are necessary to prevent auto log rotation
LogRotate no
LogFileMaxSize 0
LogTime yes
PidFile {{ clamconfig["clamd-pid-file"] }}
LocalSocket {{ clamconfig["clamd-socket-file"] }}
DatabaseDirectory {{ clamconfig["clam-database-directory"] }}
TemporaryDirectory {{ clamconfig["clamd-temporary-directory"] }}
LocalSocketMode 660
ReadTimeout 30
# MaxScanTime is in milliseconds.
MaxScanTime 60000
[ application ]
listen = {{ clamconfig["clammit-listen-address"] }}:{{ clamconfig["clammit-listen-port"] }}
clamd-url = {{ clamconfig["clamd-socket-file"] }}
virus-status-code = 418
log-file = {{ clamconfig["clammit-log-file"] }}
Foreground yes
DatabaseDirectory {{ clamconfig["clam-database-directory"] }}
UpdateLogFile {{ clamconfig["freshclam-log-file"] }}
# Both LogRotate and LogFileMaxSize are necessary to prevent auto log rotation
LogRotate no
LogFileMaxSize 0
LogTime yes
PidFile {{ clamconfig["freshclam-pid-file"] }}
DatabaseMirror database.clamav.net
NotifyClamd {{ clamd_config_file }}
{% import "caucase" as caucase with context %}
[buildout]
extends =
{{ template_monitor }}
parts =
${:clamd-parts}
${:freshclam-parts}
${:clammit-parts}
${:frontend-parts}
monitor-base
publish-connection-parameter
clamd-parts =
clamd
clamd-logrotate
freshclam-parts =
freshclam
freshclam-cron
freshclam-logrotate
clammit-parts =
clammit
clammit-port-listening-promise
frontend-parts =
frontend
frontend-promise
caucased-promise
frontend-certificate-promise
eggs-directory = {{ buildout['eggs-directory'] }}
develop-eggs-directory = {{ buildout['develop-eggs-directory'] }}
offline = true
[instance-parameter]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[publish-connection-parameter]
recipe = slapos.cookbook:publish
caucase-url = ${caucased:url}
scan-url = ${frontend-config:url}/clammit/scan
url = ${frontend-config:url}/clammit
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
etc.certificate = ${:etc}/certificate
etc.promise = ${:etc}/promise
etc.run = ${:etc}/run
etc.service = ${:etc}/service
srv = ${:home}/srv
srv.backup.caucased = ${:srv}/backup/caucased
srv.caucased = ${:srv}/caucased
tmp = ${:home}/tmp
var = ${:home}/var
var.clamdb = ${:var}/clamdb
var.log = ${:var}/log
var.run = ${:var}/run
[clam-config]
clam-database-directory = ${directory:var.clamdb}
clamd-log-file = ${directory:var.log}/clamd.log
clamd-pid-file = ${directory:var.run}/clamd.pid
clamd-socket-file = ${directory:var.run}/clamd.sock
clamd-temporary-directory = ${directory:tmp}
freshclam-log-file = ${directory:var.log}/freshclam.log
freshclam-pid-file = ${directory:var.run}/freshclam.pid
clammit-log-file = ${directory:var.log}/clammit.log
clammit-listen-address = ${instance-parameter:ipv4-random}
clammit-listen-port = 8438
clammit-url = http://${:clammit-listen-address}:${:clammit-listen-port}
################################################################################
# Clamd
################################################################################
[clamd.conf]
recipe = slapos.recipe.template:jinja2
output = ${directory:etc}/clamd.conf
url = {{ clamd_conf_path }}
context =
section clamconfig clam-config
[clamd]
recipe = slapos.cookbook:wrapper
command-line = {{ clamav.location }}/sbin/clamd --config-file ${clamd.conf:output}
wrapper-path = ${directory:etc.service}/${:_buildout_section_name_}
hash-files =
${clamd.conf:output}
hash-existing-files =
{{ buildout.directory }}/.completed
[clamd-logrotate]
<= logrotate-entry-base
name = clamd
log = ${clam-config:clamd-log-file}
post = {{ buildout.directory }}/bin/slapos-kill --pidfile ${clam-config:clamd-pid-file} -s SIGHUP
################################################################################
# Freshclam
################################################################################
[freshclam.conf]
recipe = slapos.recipe.template:jinja2
output = ${directory:etc}/freshclam.conf
url = {{ freshclam_conf_path }}
context =
section clamconfig clam-config
key clamd_config_file clamd.conf:output
[freshclam-updater]
recipe = slapos.recipe.template
output = ${directory:bin}/freshclam
inline =
#!/bin/sh
if [ ! -f "${directory:var.clamdb}/freshclam.dat" ]; then
exec {{ clamav.location }}/bin/freshclam --config-file ${freshclam.conf:output}
fi
mode = 700
[freshclam]
recipe = slapos.cookbook:wrapper
command-line = ${freshclam-updater:output}
wrapper-path = ${directory:etc.run}/freshclam-bootstrap
[freshclam-database-refresh-time]
recipe = slapos.cookbook:random.time
[freshclam-cron]
recipe = slapos.cookbook:cron.d
time = ${freshclam-database-refresh-time:time}
cron-entries = ${cron:cron-entries}
name = freshclam
command = {{ clamav.location }}/bin/freshclam --config-file ${freshclam.conf:output}
[freshclam-logrotate]
<= logrotate-entry-base
name = freshclam
log = ${clam-config:freshclam-log-file}
################################################################################
# Clammit
################################################################################
[clammit.conf]
recipe = slapos.recipe.template:jinja2
output = ${directory:etc}/clammit.conf
url = {{ clammit_conf_path }}
context =
section clamconfig clam-config
key database_directory directory:var.clamdb
[clammit]
recipe = slapos.cookbook:wrapper
command-line = {{ clammit_bin }} -config ${clammit.conf:output}
wrapper-path = ${directory:etc.service}/${:_buildout_section_name_}
hash-files =
${clammit.conf:output}
hash-existing-files =
{{ buildout.directory }}/.completed
[clammit-port-listening-promise]
recipe = slapos.cookbook:check_port_listening
path = ${directory:etc.promise}/${:_buildout_section_name_}
hostname= ${clam-config:clammit-listen-address}
port = ${clam-config:clammit-listen-port}
################################################################################
# Caucase
################################################################################
[frontend-certificate-init-certificate]
recipe = slapos.recipe.build
init =
# pre-create a file at the path of the certificate,
# so that we can use hash-existing-files options
import pathlib
cert_file = pathlib.Path(self.buildout['frontend-certificate']['cert-file'])
if not cert_file.parent.exists():
cert_file.parent.mkdir(parents=True)
if not cert_file.exists():
cert_file.touch()
[frontend-certificate]
key-file = ${directory:etc.certificate}/${:_buildout_section_name_}.crt.key
cert-file = ${directory:etc.certificate}/${:_buildout_section_name_}.crt
common-name = ${:_buildout_section_name_}
ca-file = ${directory:etc.certificate}/${:_buildout_section_name_}.ca.crt
crl-file = ${directory:etc.certificate}/${:_buildout_section_name_}.crl
init = ${frontend-certificate-init-certificate:init}
{{
caucase.updater(
prefix='frontend-certificate',
buildout_bin_directory=buildout['bin-directory'],
updater_path='${directory:etc.service}/frontend-certificate-updater',
url='${caucased:url}',
data_dir='${directory:srv}/caucase-updater',
crt_path='${frontend-certificate:cert-file}',
ca_path='${frontend-certificate:ca-file}',
crl_path='${frontend-certificate:crl-file}',
key_path='${frontend-certificate:key-file}',
on_renew='${haproxy-reload:output}',
template_csr='${frontend-certificate-prepare-csr:csr}',
openssl=openssl.location + "/bin",
)}}
[frontend-certificate-csr-config]
recipe = slapos.recipe.template
inline =
[req]
prompt = no
req_extensions = req_ext
distinguished_name = dn
[ dn ]
CN = frontend
[ req_ext ]
subjectAltName = @alt_names
[ alt_names ]
IP.1 = ${frontend-config:address}
output = ${buildout:parts-directory}/${:_buildout_section_name_}/${:_buildout_section_name_}.txt
[frontend-certificate-prepare-csr]
recipe = plone.recipe.command
command =
if [ ! -f '${:csr}' ] ; then
{{ openssl.location }}/bin/openssl req \
-newkey rsa \
-batch \
-new \
-sha256 \
-nodes \
-keyout /dev/null \
-config '${frontend-certificate-csr-config:output}' \
-out '${:csr}'
fi
stop-on-error = true
csr = ${directory:srv}/${:_buildout_section_name_}.csr.pem
[caucased]
port = 19980
ip = ${instance-parameter:ipv6-random}
netloc = [${:ip}]:${:port}
url = http://${:netloc}/
{{
caucase.caucased(
prefix='caucased',
buildout_bin_directory=buildout['bin-directory'],
caucased_path='${directory:etc.service}/caucased',
backup_dir='${directory:srv.backup.caucased}',
data_dir='${directory:srv.caucased}',
netloc='${caucased:netloc}',
tmp='${directory:tmp}',
service_auto_approve_count=1,
user_auto_approve_count=0,
key_len=2048,
)}}
################################################################################
# Local frontend
################################################################################
[frontend-config]
address = ${instance-parameter:ipv6-random}
port = 3000
url = https://[${:address}]:${:port}
socket = ${directory:var.run}/haproxy.sock
user = admin
password = ${frontend-password:passwd}
[frontend-password]
recipe = slapos.cookbook:generate.password
username = admin
[haproxy.conf]
recipe = slapos.recipe.template:jinja2
url = {{ haproxy_conf_path }}
output = ${directory:etc}/${:_buildout_section_name_}
context =
key pidfile :pidfile
key content :content
content =
frontend listener
mode http
bind [${frontend-config:address}]:${frontend-config:port} ssl crt ${frontend-certificate:cert-file} alpn h2,http/1.1
default_backend servers
backend servers
server app ${clam-config:clammit-listen-address}:${clam-config:clammit-listen-port} check
pidfile = ${directory:var.run}/haproxy.pid
[haproxy-reload]
recipe = collective.recipe.template
output = ${directory:bin}/${:_buildout_section_name_}
mode = 700
input =
inline:
#!/bin/sh
kill -USR2 $(cat "${haproxy.conf:pidfile}")
[frontend]
recipe = slapos.cookbook:wrapper
wrapper-path = ${directory:etc.service}/${:_buildout_section_name_}
command-line =
{{ haproxy.location }}/sbin/haproxy -f ${haproxy.conf:output}
hash-files =
${haproxy.conf:output}
[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = ${directory:etc.promise}/${:_buildout_section_name_}.py
url = ${frontend-config:url}/clammit/readyz
dash_path = {{ dash.location }}/bin/dash
curl_path = {{ curl.location }}/bin/curl
[buildout]
extends =
../../component/clamav/buildout.cfg
../../component/clammit/buildout.cfg
../../component/curl/buildout.cfg
../../component/dash/buildout.cfg
../../stack/caucase/buildout.cfg
../../stack/haproxy/default-backend.cfg
../../stack/logrotate/buildout.cfg
../../stack/slapos.cfg
buildout.hash.cfg
parts =
slapos-cookbook
caucase-eggs
instance.cfg.in
[instance.cfg.in]
recipe = slapos.recipe.template:jinja2
output = ${buildout:directory}/instance.cfg
url = ${:_profile_base_location_}/${:filename}
context =
section buildout buildout
section openssl openssl
section clamav clamav
section haproxy haproxy
section curl curl
section dash dash
raw clammit_bin ${gowork:bin}/clammit
key clamd_conf_path clamd.conf.in:target
key freshclam_conf_path freshclam.conf.in:target
key clammit_conf_path clammit.conf.in:target
key template_logrotate_base template-logrotate-base:output
key haproxy_conf_path stack-haproxy-default-backend-config:target
key template_monitor monitor2-template:output
import-list =
file caucase caucase-jinja2-library:target
[download-base]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/${:filename}
[clamd.conf.in]
<= download-base
[freshclam.conf.in]
<= download-base
[clammit.conf.in]
<= download-base
Tests for the clammit Software Release
##############################################################################
#
# Copyright (c) 2024 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from setuptools import setup, find_packages
version = '0.1'
name = 'slapos.test.clammit'
long_description = open("README.md").read()
setup(
name=name,
version=version,
description="Test for SlapOS' clammit",
long_description=long_description,
long_description_content_type='text/markdown',
maintainer="Nexedi",
maintainer_email="info@nexedi.com",
url="https://lab.nexedi.com/nexedi/slapos",
packages=find_packages(),
install_requires=[
'slapos.core',
'slapos.libnetworkcache',
'requests',
],
zip_safe=True,
test_suite='test',
)
##############################################################################
#
# Copyright (c) 2024 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import contextlib
import io
import os
import pathlib
import subprocess
import tempfile
import urllib.parse
import requests
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
setUpModule, SlapOSInstanceTestCase = makeModuleSetUpAndTestCaseClass(
os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg')))
class ClammitTestCase(SlapOSInstanceTestCase):
def setUp(self):
self.connection_parameters = \
self.computer_partition.getConnectionParameterDict()
self.ca_cert = self._getCaucaseServiceCACertificate()
def _getCaucaseServiceCACertificate(self):
ca_cert = tempfile.NamedTemporaryFile(
prefix="ca.crt.pem",
mode="w",
delete=False,
)
ca_cert.write(
requests.get(
urllib.parse.urljoin(
self.connection_parameters['caucase-url'],
'/cas/crt/ca.crt.pem',
)).text)
self.addCleanup(os.unlink, ca_cert.name)
return ca_cert.name
def test_upload_of_files_to_clammit_for_scan(self):
resp = requests.get(
self.connection_parameters['scan-url'],
verify=self.ca_cert,
)
r = requests.post(
self.connection_parameters['scan-url'],
files={'file': 'Hello world'},
verify=self.ca_cert,
)
self.assertEqual(r.status_code, 200)
r = requests.post(
self.connection_parameters['scan-url'],
files={'file': b'X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*'},
verify=self.ca_cert,
)
self.assertEqual(r.status_code, 418)
def test_virus_database_is_downloaded_on_instanciation(self):
database_path = os.path.join(
self.computer_partition_root_path,
"var", "clamdb", "freshclam.dat"
)
try:
os.stat(database_path)
except OSError:
raise AssertionError("No database found at %s", database_path)
def test_renew_certificate(self):
def _getpeercert():
# XXX low level way to get the server certificate
with requests.Session() as session:
pool = session.get(
self.connection_parameters['url'],
verify=self.ca_cert,
).raw._pool.pool
with contextlib.closing(pool.get()) as cnx:
return cnx.sock._sslobj.getpeercert()
cert_before = _getpeercert()
# execute certificate updater when it's time to renew certificate.
# use a timeout, because this service runs forever
subprocess.run(
(
'timeout',
'5',
'faketime',
'+63 days',
os.path.join(
self.computer_partition_root_path,
'etc/service/frontend-certificate-updater'),
),
capture_output=not self._debug,
)
# reprocess instance to get the new certificate, after removing the timestamp
# to force execution
(pathlib.Path(self.computer_partition_root_path) / '.timestamp').unlink()
self.waitForInstance()
cert_after = _getpeercert()
self.assertNotEqual(cert_before['notAfter'], cert_after['notAfter'])
......@@ -14,11 +14,11 @@
# not need these here).
[template-cloudooo]
filename = instance.cfg.in
md5sum = d1e4d7306c39f2ebc64d0407860d4301
md5sum = 6f18a040f44d800dc43a8955f1f4f5b4
[template-cloudooo-instance]
filename = instance-cloudooo.cfg.in
md5sum = 1bc5c724d29337e1f35cfa60270fb08c
md5sum = 5c72cc2c3f8e5be4690ea4dd5d4accaa
[template-haproxy-cfg]
filename = haproxy.cfg.in
......
......@@ -160,7 +160,7 @@ includes =
recipe = slapos.cookbook:generic.cloudooo
ip = {{ ipv4 }}
environment =
LD_LIBRARY_PATH = {{ parameter_dict['avahi'] }}/lib:{{ parameter_dict['cairo'] }}/lib:{{ parameter_dict['cups'] }}/lib:{{ parameter_dict['cups'] }}/lib64:{{ parameter_dict['dbus'] }}/lib:{{ parameter_dict['dbus-glib'] }}/lib:{{ parameter_dict['file'] }}/lib:{{ parameter_dict['fontconfig'] }}/lib:{{ parameter_dict['freetype'] }}/lib:{{ parameter_dict['gcc'] }}/lib:{{ parameter_dict['gcc'] }}/lib64:{{ parameter_dict['glib'] }}/lib:{{ parameter_dict['glu'] }}/lib:{{ parameter_dict['libICE'] }}/lib:{{ parameter_dict['libSM'] }}/lib:{{ parameter_dict['libX11'] }}/lib:{{ parameter_dict['libXau'] }}/lib:{{ parameter_dict['libXdmcp'] }}/lib:{{ parameter_dict['libXext'] }}/lib:{{ parameter_dict['libXrender'] }}/lib:{{ parameter_dict['libexpat'] }}/lib:{{ parameter_dict['libffi'] }}/lib:{{ parameter_dict['libffi'] }}/lib64:{{ parameter_dict['libpng12'] }}/lib:{{ parameter_dict['libxcb'] }}/lib:{{ parameter_dict['mesa'] }}/lib:{{ parameter_dict['nss'] }}/lib:{{ parameter_dict['nspr'] }}/lib:{{ parameter_dict['pixman'] }}/lib:{{ parameter_dict['xdamage'] }}/lib:{{ parameter_dict['xfixes'] }}/lib:{{ parameter_dict['zlib'] }}/lib
LD_LIBRARY_PATH = {{ parameter_dict['avahi'] }}/lib:{{ parameter_dict['cairo'] }}/lib:{{ parameter_dict['cups'] }}/lib:{{ parameter_dict['dbus'] }}/lib:{{ parameter_dict['dbus-glib'] }}/lib:{{ parameter_dict['file'] }}/lib:{{ parameter_dict['fontconfig'] }}/lib:{{ parameter_dict['freetype'] }}/lib:{{ parameter_dict['gcc'] }}/lib:{{ parameter_dict['gcc'] }}/lib64:{{ parameter_dict['glib'] }}/lib:{{ parameter_dict['glu'] }}/lib:{{ parameter_dict['libICE'] }}/lib:{{ parameter_dict['libSM'] }}/lib:{{ parameter_dict['libX11'] }}/lib:{{ parameter_dict['libXau'] }}/lib:{{ parameter_dict['libXdmcp'] }}/lib:{{ parameter_dict['libXext'] }}/lib:{{ parameter_dict['libXrender'] }}/lib:{{ parameter_dict['libexpat'] }}/lib:{{ parameter_dict['libffi'] }}/lib:{{ parameter_dict['libffi'] }}/lib64:{{ parameter_dict['libpng12'] }}/lib:{{ parameter_dict['libxcb'] }}/lib:{{ parameter_dict['mesa'] }}/lib:{{ parameter_dict['nss'] }}/lib:{{ parameter_dict['nspr'] }}/lib:{{ parameter_dict['pixman'] }}/lib:{{ parameter_dict['xdamage'] }}/lib:{{ parameter_dict['xfixes'] }}/lib:{{ parameter_dict['zlib'] }}/lib
FONTCONFIG_FILE = ${fontconfig-conf:output}
PATH = ${binary-link:target-directory}
LANG = C.UTF-8
......
......@@ -44,4 +44,3 @@ extra-context =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = cloudooo-dynamic-template:output
RootSoftwareInstance = ${:default}
......@@ -170,7 +170,7 @@
},
"software-type": {
"description": "Request a front-end slave instance of this software type.",
"default": "RootSoftwareInstance",
"default": "default",
"type": "string"
},
"virtualhostroot-http-port": {
......
......@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg
md5sum = 06b0acece285ecbc0e746fa267a374b6
md5sum = e0737eb3d0ddcf017d7284a98cd6cde1
[template-default]
filename = instance-default.cfg.jinja.in
......
......@@ -16,7 +16,6 @@ cert = $${slap-connection:cert-file}
[switch_softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = instance-default:output
[instance-default]
......
......@@ -15,7 +15,7 @@
[template-erp5testnode]
filename = instance.cfg.in
md5sum = 681f4159e4ac2542d0fbc7a894e43d79
md5sum = 4cbd3b3b34267dea1016d951f46b8eb4
[template-resilient-test]
filename = instance-kvm-resilient-test.cfg.jinja2
......
......@@ -3,7 +3,6 @@ extends = ${template:output}
[switch_softwaretype]
default = $${:test}
RootSoftwareInstance = $${:test}
# Used for the test of resiliency. The system wants a "test" software_type.
test = dynamic-template-resilient-test:output
......
......@@ -14,7 +14,7 @@
# not need these here).
[instance-profile]
filename = instance.cfg
md5sum = 1fe38a024766347454ad7a3d9fb52d01
md5sum = a88ac58fc22e804a176e4d43f917179e
[template-fluentd]
filename = instance-fluentd.cfg
......
......@@ -9,7 +9,6 @@ offline = true
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = dynamic-template-fluentd:output
RootSoftwareInstance = $${:default}
[directory]
recipe = slapos.cookbook:mkdirectory
......
......@@ -15,7 +15,7 @@
[template]
filename = instance.cfg.in
md5sum = 1747b8cda8d815055453420de4ed677f
md5sum = 0d6db8da45bbdf311f9c6a2f916045a2
[template-default]
filename = instance-default.cfg.in
......
......@@ -17,7 +17,6 @@ cert = $${slap-connection:cert-file}
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = dynamic-template-default:output
RootSoftwareInstance = $${:default}
[dynamic-template-default]
recipe = slapos.recipe.template:jinja2
......
......@@ -14,7 +14,7 @@
# not need these here).
[instance.cfg]
filename = instance.cfg.in
md5sum = 956ae53af22b551fbb087415e835868b
md5sum = 3ffdd78aeb77ab581c51ce419176dd37
[watcher]
_update_hash_filename_ = watcher.in
......
......@@ -15,7 +15,7 @@ offline = true
recipe = slapos.cookbook:switch-softwaretype
gitlab = instance-gitlab.cfg:output
gitlab-export = instance-gitlab-export.cfg:output
RootSoftwareInstance = $${:gitlab}
default = $${:gitlab}
# TODO -import, -pull-backup
......
[template-cfg]
filename = instance.cfg.in
md5sum = c6cdcee1e16dd4bd3bc462d286dcb999
md5sum = 25973164baf2304012beb37ecbc082cb
[instance-headless-chromium]
_update_hash_filename_ = instance-headless-chromium.cfg.in
......
......@@ -44,7 +44,6 @@ default-parameters =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = ${:default}
default = instance-headless-chromium:output
[slap-configuration]
......
......@@ -40,6 +40,4 @@ extra-context =
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
default = root:output
# BBB
RootSoftwareInstance = ${:default}
server = server:output
......@@ -21,7 +21,7 @@ environment +=
[template]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance.cfg.in
md5sum = 2e90443314d2036f7077898ab49bfec1
md5sum = 9d9edfa05d3a60297ae0e2ec8a6054ab
# XXX: "template.cfg" is hardcoded in instanciation recipe
output = ${buildout:directory}/template.cfg
context =
......
......@@ -26,7 +26,6 @@ context =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = ${:default}
default = instance-html5as:output
[slap-configuration]
......
......@@ -27,7 +27,7 @@ recipe = slapos.recipe.template:jinja2
output = ${buildout:directory}/template.cfg
url = ${:_profile_base_location_}/${:filename}
filename = instance.cfg.in
md5sum = 861e7ce5d65252067d31c7325c97917d
md5sum = feadf0e0bee6d5b4182c2e016c6e183f
context =
section buildout buildout
key nginx_location nginx:location
......
......@@ -17,7 +17,7 @@
[template-cfg]
filename = instance.cfg.in
md5sum = 23c15a579b66cef866b30a2f53b1b737
md5sum = 2c21a4063087b6a24677dec61b08865d
[instance_html5as]
_update_hash_filename_ = instance_html5as.cfg.in
......
......@@ -56,7 +56,6 @@ default-parameters =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = ${:default}
default = instance-html5as:output
replicate = instance-replicate:output
......
......@@ -26,4 +26,4 @@ md5sum = 3733c484371115831721341f9b65dc0f
[template]
filename = instance.cfg.in
md5sum = c86d4c6b5cc67139810399b1032c3410
md5sum = 1f337ae300eca111078015a6d61d5972
......@@ -17,7 +17,6 @@ context =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:validator}
default = $${:validator}
validator = dynamic-template-validator:output
......
......@@ -22,7 +22,7 @@ md5sum = 01425a1c77e79788e1948398b9136724
[instance-profile]
filename = instance.cfg.in
md5sum = 4733c63573e6812c124b356dc146ffcc
md5sum = aa1d52767514868421fecd5bad073277
[instance-root]
filename = instance-root.cfg.jinja2
......
......@@ -8,7 +8,6 @@ offline = true
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = instance-root:output
[slap-configuration]
......
......@@ -15,7 +15,7 @@
[instance]
filename = instance.cfg.in
md5sum = 7333d1dfd4e8e4c375f7f1748292f554
md5sum = d9cf0d7b7db532106239cfef4ca19ac6
[template-jscrawler]
filename = instance-jscrawler.cfg.jinja2.in
......
......@@ -10,7 +10,6 @@ offline = true
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = dynamic-template-jscrawler:output
RootSoftwareInstance = ${:default}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
......
......@@ -15,11 +15,11 @@
[instance]
filename = instance.cfg.in
md5sum = 5f39952f94095b1f12f41db76867e71e
md5sum = f533ac0c5afd01244c25a0d8b26f6e20
[instance-jupyter]
filename = instance-jupyter.cfg.in
md5sum = 1812fa797b9eb687a634ebe96134b504
md5sum = b781ee4c01f3ce0520d70256743acb59
[jupyter-notebook-config]
filename = jupyter_notebook_config.py.jinja
......
......@@ -12,7 +12,7 @@
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-software-url": {
"title": "Frontend Software URL",
......@@ -30,7 +30,7 @@
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-additional-software-url": {
"title": "Additional Frontend Software URL",
......
......@@ -42,11 +42,11 @@ logfile = ${directory:log}/jupyter_notebook.log
notebook_dir = ${directory:notebook_dir}
[slap-parameter]
frontend-software-type = RootSoftwareInstance
frontend-software-type = default
frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
frontend-instance-guid =
frontend-instance-name = Jupyter Frontend
frontend-additional-software-type = RootSoftwareInstance
frontend-additional-software-type = default
frontend-additional-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
frontend-additional-instance-guid =
frontend-additional-instance-name = Jupyter Frontend Additional
......
......@@ -9,7 +9,6 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
recipe = slapos.cookbook:switch-softwaretype
default = $${:jupyter}
jupyter = instance-jupyter:output
RootSoftwareInstance = $${:default}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
......
......@@ -33,7 +33,7 @@ See the instance-kvm-input-schema.json file for more instance parameters (cpu-co
KVM instance parameters:
~~~~~~~~~~~~~~~~~~~~~~~~~
- frontend-software-type (default: RootSoftwareInstance)
- frontend-software-type (default: default)
- frontend-software-url (default: http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg)
- frontend-instance-guid
- frontend-addtional-instance-guid
......
......@@ -15,15 +15,15 @@
[template]
filename = instance.cfg.in
md5sum = b6204319cca4264b3c351d4dd1f2b5d0
md5sum = ee1fe10d8db4d3c39e3a3f1b53d12883
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = 4ae98a072354efbdd7440d800cc675c8
md5sum = 9916c160b1c9711145d7e10506a9fca8
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
md5sum = 15415f63741dc8c478512f9e410bb0ae
md5sum = 6e6f6748ec466eb49a4f872aec7563fa
[template-kvm-resilient]
filename = instance-kvm-resilient.cfg.jinja2
......
......@@ -14,9 +14,9 @@
},
"frontend-software-type": {
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"RootSoftwareInstance\".",
"description": "Type of the frontend instance, like \"default\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-software-url": {
"title": "Frontend Software URL",
......@@ -32,9 +32,9 @@
},
"frontend-additional-software-type": {
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"RootSoftwareInstance\".",
"description": "Type of the frontend instance, like \"default\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-additional-software-url": {
"title": "Additional Frontend Software URL",
......
......@@ -7,7 +7,7 @@
{% set slave_frontend_stype = slave_frontend_dict.get('software-type', 'custom-personal') -%}
{% set slave_frontend_iguid = slave_frontend_dict.get('instance-guid', '') -%}
{% set WEBSOCKET_FRONTEND_DEFAULT_SR = 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg' %}
{% set WEBSOCKET_FRONTEND_DEFAULT_ST = 'RootSoftwareInstance' %}
{% set WEBSOCKET_FRONTEND_DEFAULT_ST = 'default' %}
{% set kvm_instance_dict = {} -%}
{% set kvm_hostname_list = [] -%}
{% set monitor_base_url_dict = {} -%}
......
......@@ -285,7 +285,7 @@
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-software-url": {
"title": "Frontend Software URL",
......@@ -303,7 +303,7 @@
"title": "Additional Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "RootSoftwareInstance"
"default": "default"
},
"frontend-additional-software-url": {
"title": "Additional Frontend Software URL",
......
......@@ -1077,11 +1077,11 @@ log = ${directory:public}/ansible/vm-bootstrap.log
[slap-parameter]
# Default values if not specified
frontend-software-type = RootSoftwareInstance
frontend-software-type = default
frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
frontend-instance-guid =
frontend-instance-name = VNC Real Frontend
frontend-additional-software-type = RootSoftwareInstance
frontend-additional-software-type = default
frontend-additional-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
frontend-additional-instance-guid =
frontend-additional-instance-name = VNC Real Frontend Additional
......
......@@ -21,9 +21,6 @@ kvm-export = dynamic-template-kvm-export:output
frozen = instance-frozen:output
pull-backup = template-pull-backup:output
# BBB
RootSoftwareInstance = $${:default}
# XXX - If this configuration is not generated by slapgrid, use empty values
[storage-configuration]
storage-home =
......
......@@ -15,7 +15,7 @@
[template]
filename = instance.cfg.in
md5sum = 7ab3b606972e1b338d28fc1374617835
md5sum = 403a4a362b2ffec05f8d0b591bab92fa
[template-default]
_update_hash_filename_ = instance-default.cfg.in
......
......@@ -43,4 +43,3 @@ cert = $${slap-connection:cert-file}
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
default = dynamic-template-default:output
RootSoftwareInstance = $${:default}
......@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg
md5sum = cfb3bf67b11e5b1278d94f7e729d740c
md5sum = 7a218919e2601fd4b4e534dbce0703a6
[json-test-template]
_update_hash_filename_ = json-test-template.json.in.jinja2
......
......@@ -9,7 +9,6 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
recipe = slapos.cookbook:switch-softwaretype
default = instance-node-monitoring:output
edgetest-basic = instance-edgetest-basic:output
RootSoftwareInstance = $${:default}
[instance-template]
recipe = slapos.recipe.template:jinja2
......
......@@ -38,7 +38,7 @@ md5sum = 3ae93702f3890a504cc8a93eb5ad52bc
[template-neo]
filename = instance.cfg.in
md5sum = 78c46af020ebd0ff25a1b474a119695f
md5sum = ab0ad72d2df7ffe049921a7ca6725349
[cluster]
filename = cluster.cfg.in
......
......@@ -23,6 +23,4 @@ extra-context +=
recipe = slapos.cookbook:switch-softwaretype
override = {{ dumps(override_switch_softwaretype |default) }}
default = neo-cluster:output
# BBB
RootSoftwareInstance = ${:default}
neo = neo:output
......@@ -16,11 +16,11 @@
[template]
filename = instance.cfg
md5sum = f096f3cbb414730a9f0d46b0c0f5eb22
md5sum = 711d90973a5cfb2f61d3a3a53c07c64c
[template-ors]
filename = instance-ors.cfg
md5sum = f5c76c3443b75569eb18503dce38e783
md5sum = 1e7d200bfbbbae26e56585017177aaee
[slaplte.jinja2]
_update_hash_filename_ = slaplte.jinja2
......
......@@ -39,66 +39,82 @@ configuration = $${slap-configuration:configuration}
init =
import subprocess
range_map = {
"B28": "758MHz - 803MHz",
"B38": "2570MHz - 2620MHz",
"B39": "1880MHz - 1920MHz",
"B40": "2300MHz - 2400MHz",
"B41": "2496MHz - 2690MHz",
"B42": "3400MHz - 3600MHz",
"B43": "3600MHz - 3800MHz",
"B28": "758MHz - 803MHz",
"N77": "3300MHz - 4200MHz",
"N79": "4400MHz - 5000MHz",
"UNKNOWN": "Information not available for this band",
}
default_tx_gain_map = {
"B28": (60, 62),
"B38": (59, 65),
"B39": (59, 64),
"B40": (59, 64),
"B41": (59, 64),
"B42": (63, 62),
"B43": (63, 62),
"B28": (60, 62),
"N77": (60, 62),
"N79": (60, 62),
"UNKNOWN": (60, 62),
}
default_rx_gain_map = {
"B38": (43, 43),
"B39": (43, 43),
"B42": (43, 43),
"B43": (43, 43),
"B28": (43, 43),
"N77": (43, 43),
"N79": (43, 43),
"UNKNOWN": (43, 43),
"B28": (25, 25),
"B38": (25, 25),
"B39": (25, 25),
"B40": (25, 25),
"B41": (25, 25),
"B42": (25, 25),
"B43": (25, 25),
"N77": (25, 25),
"N79": (25, 25),
"UNKNOWN": (25, 25),
}
default_earfcn_map = {
"B28": 9550,
"B38": 38050,
"B39": 38350,
"B40": 39150,
"B41": 40620,
"B42": 42590,
"B43": 44590,
"B28": 9550,
"N77": 0,
"N79": 0,
"UNKNOWN": 0,
}
default_nr_arfcn_map = {
"B28": 0,
"B38": 519000,
"B39": 378000,
"B40": 470000,
"B41": 518600,
"B42": 632628,
"B43": 646666,
"B28": 0,
"N77": 660000,
"N79": 720000,
"UNKNOWN": 0,
}
default_nr_band_map = {
"B28": 0,
"B38": 41,
"B39": 39,
"B40": 40,
"B41": 41,
"B42": 78,
"B43": 78,
"B28": 0,
"N77": 77,
"N79": 79,
"UNKNOWN": 0,
}
power_map = {
"B28": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"B38": (
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.004472751640641793) * x**2 + (1.6308290630103919) * x + (-81.84549245154561),
......@@ -107,6 +123,14 @@ init =
lambda x: (-0.008712931375092506) * x**2 + (2.1973585140044642) * x + (-94.29420762479742),
lambda x: (-0.0022523817802900985) * x**2 + (1.2674016231310092) * x + (-66.57165215468584),
),
"B40": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"B41": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"B42": (
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (0.003977721774394756) * x**2 + (0.527208191717173) * x + (-42.761142655285376),
......@@ -115,10 +139,6 @@ init =
lambda x: (-0.014198126839751619) * x**2 + (2.980758813262773) * x + (-125.25800492285738),
lambda x: (-0.0036530114002551943) * x**2 + (1.510856844601873) * x + (-74.58790185136355),
),
"B28": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
),
"N77": (
lambda x: "UNKNOWN",
lambda x: "UNKNOWN",
......
......@@ -132,10 +132,10 @@ init =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
# we don't select default software type to force user to choose the correct one
enb = dynamic-template-enb:output
core-network = dynamic-template-core-network:output
ue = dynamic-template-ue:output
RootSoftwareInstance = $${:core-network}
[dynamic-template-enb]
< = jinja2-template-base
......
......@@ -14,7 +14,7 @@
# not need these here).
[instance-profile]
filename = instance.cfg.in
md5sum = 145c7c84802ca0e3ee16ada31bde04b6
md5sum = 6bacd625936eed07a6025fd5be92614f
[instance-peertube]
_update_hash_filename_ = instance-peertube.cfg.in
......
......@@ -35,7 +35,6 @@ context =
[switch-softwaretype]
recipe = slapos.cookbook:switch-softwaretype
RootSoftwareInstance = $${:default}
default = peertube:output
[slap-configuration]
......
......@@ -14,7 +14,7 @@
# not need these here).
[template]
filename = instance.cfg
md5sum = 2f812f4814a0cc78a8b96d8014ac3104
md5sum = 6d9e7375732706593fabe2b3629dc699
[template-powerdns]
filename = instance-powerdns.cfg
......@@ -26,7 +26,7 @@ md5sum = 851353e1d4dd562ace58b3345c2da515
[template-dns-replicate]
_update_hash_filename_ = instance-powerdns-replicate.cfg.jinja2
md5sum = f0a127e858f49beff4a5fcd2e71c088d
md5sum = 4e9d75ae82ccca107b0903033b2095f2
[iso-list]
_update_hash_filename_ = template/zz.countries.nexedi.dk.rbldnsd
......
......@@ -15,7 +15,7 @@ context =
{% set part_list = [] -%}
{% set monitor_url_list = [] -%}
{% set single_type_key = 'single-' %}
{% if slap_software_type in ("replicate", "RootSoftwareInstance") %}
{% if slap_software_type in ("replicate", "default", "RootSoftwareInstance") %}
{% set dns_type = slapparameter_dict.pop('-dns-type', 'single-default') -%}
{% else -%}
{% set dns_type = "%s%s" % (single_type_key, slap_software_type) -%}
......
......@@ -12,9 +12,6 @@ recipe = slapos.cookbook:switch-softwaretype
default = dynamic-powerdns-replicate:output
single-default = dynamic-template-powerdns:output
# BBB
RootSoftwareInstance = $${:default}
[jinja2-template-base]
recipe = slapos.recipe.template:jinja2
output = $${buildout:directory}/$${:filename}
......@@ -44,6 +41,8 @@ filename = instance-powerdns-replicate.cfg
extensions = jinja2.ext.do
extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
# Keep RootSoftwareInstance for backward compatibility until we are sure all
# instances have software_type default
raw software_type RootSoftwareInstance-default
raw template_monitor ${monitor2-template:output}
......
......@@ -15,7 +15,7 @@
[instance-profile]
filename = instance.cfg.in
md5sum = 7f9749ab75475bd5d98be27a570c7731
md5sum = 8713d8a8d3f83bda2b6e825e9a4e5f56
[instance-default]
filename = instance-default.cfg.in
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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