Commit c15228c7 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Debian jessie support

parent 3bc92826
......@@ -8,6 +8,7 @@ env:
matrix:
- IMAGE=centos6
- IMAGE=centos7
- IMAGE=jessie
install:
- pip install -r test-requirements.txt
script:
......
......@@ -51,13 +51,13 @@ Initialize instance database schema with ``cubicweb-ctl db-init``.
Install and manage `supervisor`_ configuration for the saemref installation.
+----------+-----------------------------------------------------+-------------------------------------+
| OS | Restart instance | Restart supervisor |
+==========+=====================================================+=====================================+
| Centos 6 | ``su - saemref -c 'supervisorctl restart saemref'`` | ``/etc/init.d/supervisord restart`` |
+----------+-----------------------------------------------------+-------------------------------------+
| Centos 7 | ``supervisorctl restart saemref`` | ``systemctl restart supervisord`` |
+----------+-----------------------------------------------------+-------------------------------------+
+--------------------------+-----------------------------------------------------+-------------------------------------+
| OS | Restart instance | Restart supervisor |
+==========================+=====================================================+=====================================+
| Centos 6 | ``su - saemref -c 'supervisorctl restart saemref'`` | ``/etc/init.d/supervisord restart`` |
+--------------------------+-----------------------------------------------------+-------------------------------------+
| Centos 7 / Debian Jessie | ``supervisorctl restart saemref`` | ``systemctl restart supervisord`` |
+--------------------------+-----------------------------------------------------+-------------------------------------+
Requirements
============
......
......@@ -29,7 +29,7 @@ def image_exists(image):
raise RuntimeError("Cannot test if image exists")
image_option = click.argument("image", type=click.Choice(["centos6", "centos7"]))
image_option = click.argument("image", type=click.Choice(["centos6", "centos7", "jessie"]))
salt_option = click.option('--salt', is_flag=True, help="Run salt highstate")
......@@ -96,7 +96,7 @@ def dev(ctx, image, salt):
"-v", "{0}/{1}:/srv/formula/{1}".format(BASEDIR, _formula),
]
if image in ("centos7",):
if image in ("centos7", "jessie"):
# Systemd require privileged container
cmd.append("--privileged")
cmd.append(tag)
......
......@@ -4,10 +4,28 @@
include:
- saemref.logilab-repo
cubicweb-saem-ref:
cube-packages:
pkg.latest:
- pkgs:
- cubicweb-saem-ref
{% if grains['os_family'] == 'Debian' %}
- cubicweb-ctl
- cubicweb-server
- cubicweb-twisted
- skip_verify: true {# FIXME: key expired... #}
- require:
- pkgrepo: logilab-public-acceptance
{% else %}{# RedHat #}
- require:
- pkgrepo: logilab_extranet
{% endif %}
{% if grains['os_family'] == 'Debian' %}
# FIXME: https://www.logilab.org/ticket/6302914 workaround
python-logilab-common:
pkg.installed:
- version: 1.1.0-1
{% endif %}
create-saemref-user:
user.present:
......@@ -21,5 +39,5 @@ cubicweb-create:
- env:
CW_MODE: user
- require:
- pkg: cubicweb-saem-ref
- pkg: cube-packages
- user: {{ saemref.instance.user }}
{% if grains['os_family'] == 'Debian' %}
logilab-public-acceptance:
pkgrepo.managed:
- file: /etc/apt/sources.list.d/logilab-public-acceptance.list
- human_name: Logilab acceptance public Debian repository
- name: deb http://download.logilab.org/acceptance {{ grains['oscodename'] }}/
- gpgcheck: 1
- key_url: https://www.logilab.fr/logilab-dists-key.asc
{% elif grains['os_family'] == 'RedHat' %}
include:
......
......@@ -25,7 +25,9 @@
{% set supervisor_confdir = '/etc/supervisord.d/' %}
{% set supervisor_conffile = [supervisor_confdir, 'saemref.ini']|join('/') %}
{% endif %}
{% else %}
{% set supervisor_service_name = 'supervisord' %}
{% else %}{# Debian #}
{% set supervisor_confdir = '/etc/supervisor/conf.d' %}
{% set supervisor_conffile = [supervisor_confdir, 'saemref.conf']|join('/') %}
{% set supervisor_service_name = 'supervisor' %}
{% endif %}
{% from "saemref/map.jinja" import saemref, supervisor_confdir, supervisor_conffile with context %}
{% from "saemref/map.jinja" import saemref, supervisor_confdir, supervisor_conffile, supervisor_service_name with context %}
include:
- saemref.install
......@@ -81,9 +81,9 @@ Salt fail to enable a systemd service if systemd is not running (during the
docker build phase) This is a workaround.
#}
cmd.run:
- name: systemctl enable supervisord
- name: systemctl enable {{ supervisor_service_name }}
{% else %}
service.running:
- name: supervisord
- name: {{ supervisor_service_name }}
- enable: true
{% endif %}
......@@ -10,9 +10,11 @@ def TestinfraBackend(pytestconfig, request):
# all testinfra fixtures (i.e. modules) depend on it.
cmd = ["docker", "run", "-d"]
if "centos7" in request.param:
# Systemd require privileged container
cmd.append("--privileged")
for dist in ("centos7", "jessie"):
if dist in request.param:
# Systemd require privileged container
cmd.append("--privileged")
break
postgres_id = None
if request.scope == "function":
......@@ -82,9 +84,17 @@ def pytest_generate_tests(metafunc):
@pytest.fixture
def _wait_supervisord_started(Service):
def supervisor_service_name(SystemInfo):
if SystemInfo.distribution == "centos":
return "supervisord"
else:
return "supervisor"
@pytest.fixture
def _wait_supervisord_started(Service, supervisor_service_name):
for _ in range(10):
if Service("supervisord").is_running:
if Service(supervisor_service_name).is_running:
break
time.sleep(1)
else:
......
FROM debian:jessie
RUN apt-get update && apt-get -y install wget
RUN wget -O - https://repo.saltstack.com/apt/debian/8/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add -
RUN echo "deb http://repo.saltstack.com/apt/debian/8/amd64/latest jessie main" > /etc/apt/sources.list.d/saltstack.list
RUN apt-get update && apt-get -y install salt-minion git python-dulwich net-tools curl locales
# Systemd stuff
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do if ! test $i = systemd-tmpfiles-setup.service; then rm -f $i; fi; done) && \
rm -f /lib/systemd/system/multi-user.target.wants/* && \
rm -f /etc/systemd/system/*.wants/* && \
rm -f /lib/systemd/system/local-fs.target.wants/* && \
rm -f /lib/systemd/system/sockets.target.wants/*udev* && \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*
# Locale settings
RUN echo 'LANG="en_US.UTF-8"' > /etc/default/locale && \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen && update-locale
ENV LANG en_US.UTF-8
CMD ["/sbin/init"]
......@@ -7,14 +7,21 @@ wait_supervisord_started = pytest.mark.usefixtures("_wait_supervisord_started")
wait_saemref_started = pytest.mark.usefixtures("_wait_saemref_started")
@pytest.mark.parametrize("name, version", [
("cubicweb", "3.22.2"),
("cubicweb-saem-ref", "0.11.1"),
])
def test_packages(Package, name, version):
pkg = Package(name)
assert pkg.is_installed
assert pkg.version.startswith(version)
def test_package_saem_ref(Package):
cube = Package("cubicweb-saem-ref")
assert cube.is_installed
assert cube.version.startswith("0.11.1")
def test_package_cubicweb(Package, SystemInfo):
if SystemInfo.distribution == "centos":
name = "cubicweb"
else: # Debian
name = "cubicweb-server"
cubicweb = Package(name)
assert cubicweb.is_installed
assert cubicweb.version.startswith("3.22.2")
@wait_supervisord_started
......@@ -42,8 +49,8 @@ def test_idempotence(Salt, state, exclude):
@wait_saemref_started
def test_saemref_running(Process, Service, Socket, Command, is_centos6):
assert Service("supervisord").is_enabled
def test_saemref_running(Process, Service, Socket, Command, is_centos6, supervisor_service_name):
assert Service(supervisor_service_name).is_enabled
supervisord = Process.get(comm="supervisord")
......
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