Commit e9920e9c authored by Sylvain Thenault's avatar Sylvain Thenault Committed by Denis Laxalde
Browse files

Drop support for centos6

parent a182832c
......@@ -72,19 +72,19 @@ Testing
The script `run-test.py` can help to develop and test the formula using
`docker`_ and `testinfra`_.
The command ``./run-test.py dev centos6`` will build image from
``test/centos6.Dockerfile`` and span a shell in a new container with mounted
The command ``./run-test.py dev centos7`` will build image from
``test/centos7.Dockerfile`` and span a shell in a new container with mounted
volumes from the host (so you can develop formula on the host and test it in
the container with ``salt-call``).
The command ``./run-test.py dev centos6 --salt`` is the same as above but will
The command ``./run-test.py dev centos7 --salt`` is the same as above but will
provision the container (eg. calling ``salt-call state.highstate``)
The command ``./run-test.py test centos6`` built a provisioned image
The command ``./run-test.py test centos7`` built a provisioned image
(highstate) and run testinfra tests on it.
Note that you can add any parameters that testinfra (pytest) accept, for
instance ``./run-test.py test centos6 -- -k idempotence --pdb``.
instance ``./run-test.py test centos7 -- -k idempotence --pdb``.
Testing migration
......
......@@ -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", "jessie"]))
image_option = click.argument("image", type=click.Choice(["centos7", "jessie"]))
salt_option = click.option('--salt', is_flag=True, help="Run salt highstate")
......
......@@ -8,13 +8,8 @@ saemref:
port:
anonymous_user:
anonymous_password:
{% if grains['os_family'] == 'RedHat' and grains['osmajorrelease'] == '6' %}
wsgi: false
pool_size: 4
{% else %}
wsgi: true
pool_size: 8
{% endif %}
wsgi_threads: 8
wsgi_workers: 2
db:
......
......@@ -18,13 +18,8 @@
%}
{% if grains['os_family'] == 'RedHat' %}
{% if grains['osmajorrelease'] == '6' %}
{% set supervisor_confdir = ['/home', saemref.instance.user, 'etc', 'supervisor.d']|join('/') %}
{% set supervisor_conffile = [supervisor_confdir, 'saemref.conf']|join('/') %}
{% else %}
{% set supervisor_confdir = '/etc/supervisord.d/' %}
{% set supervisor_conffile = [supervisor_confdir, 'saemref.ini']|join('/') %}
{% endif %}
{% set supervisor_confdir = '/etc/supervisord.d/' %}
{% set supervisor_conffile = [supervisor_confdir, 'saemref.ini']|join('/') %}
{% set supervisor_service_name = 'supervisord' %}
{% else %}{# Debian #}
{% set supervisor_confdir = '/etc/supervisor/conf.d' %}
......
......@@ -3,53 +3,6 @@
include:
- saemref.install
{% if grains['os_family'] == 'RedHat' and grains['osmajorrelease'] == '6' %}
python-pip:
pkg:
- installed
supervisor:
pip.installed:
- user: {{ saemref.instance.user }}
- install_options:
- "--user"
- require:
- user: {{ saemref.instance.user }}
- pkg: python-pip
{% for fname in ('supervisorctl', 'supervisord') %}
/home/{{ saemref.instance.user }}/bin/{{ fname }}:
file.symlink:
- target: /home/{{ saemref.instance.user }}/.local/bin/{{ fname }}
- user: {{ saemref.instance.user }}
- makedirs: true
- require:
- pip: supervisor
{% endfor %}
supervisor_confdir:
file.directory:
- name: {{ supervisor_confdir }}
- user: {{ saemref.instance.user }}
- require:
- user: {{ saemref.instance.user }}
/home/{{ saemref.instance.user }}/etc/supervisord.conf:
file.managed:
- source: salt://saemref/files/supervisord.conf
- template: jinja
- user: {{ saemref.instance.user }}
/etc/init.d/supervisord:
file.managed:
- source: salt://saemref/files/supervisord.init
- template: jinja
- mode: 755
{% else %}
supervisor:
pkg:
- installed
......@@ -60,10 +13,6 @@ supervisor_confdir:
- require:
- pkg: supervisor
{% endif %}
{{ supervisor_conffile }}:
file.managed:
- source: salt://saemref/files/saemref-supervisor.conf
......
FROM centos:6
RUN yum -y install epel-release && \
yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-1.el6.noarch.rpm && \
yum clean expire-cache && \
yum -y install salt-minion python-pygit2 git
ENV LANG en_US.UTF-8
CMD ["/sbin/init"]
......@@ -102,11 +102,8 @@ def _wait_supervisord_started(Service, supervisor_service_name):
@pytest.fixture
def _wait_saemref_started(Command, _wait_supervisord_started, is_centos6):
if is_centos6:
cmd = "su - saemref -c 'supervisorctl status saemref'"
else:
cmd = "supervisorctl status saemref"
def _wait_saemref_started(Command, _wait_supervisord_started):
cmd = "supervisorctl status saemref"
for _ in range(20):
status = Command.check_output(cmd).split()
if status[1] == "RUNNING":
......@@ -116,8 +113,3 @@ def _wait_saemref_started(Command, _wait_supervisord_started, is_centos6):
time.sleep(1)
else:
raise RuntimeError("No running saemref")
@pytest.fixture
def is_centos6(SystemInfo):
return SystemInfo.distribution.lower() == "centos" and SystemInfo.release.startswith("6")
......@@ -55,17 +55,13 @@ def test_idempotence(Salt, state, exclude):
@wait_saemref_started
def test_saemref_running(Process, Service, Socket, Command, is_centos6, supervisor_service_name):
def test_saemref_running(Process, Service, Socket, Command, supervisor_service_name):
assert Service(supervisor_service_name).is_enabled
supervisord = Process.get(comm="supervisord")
if is_centos6:
assert supervisord.user == "saemref"
assert supervisord.group == "saemref"
else:
assert supervisord.user == "root"
assert supervisord.group == "root"
assert supervisord.user == "root"
assert supervisord.group == "root"
cubicweb = Process.get(ppid=supervisord.pid)
......@@ -77,15 +73,10 @@ def test_saemref_running(Process, Service, Socket, Command, is_centos6, supervis
html = Command.check_output("curl http://localhost:8080")
assert "<title>accueil (Référentiel SAEM)</title>" in html
if not is_centos6:
assert cubicweb.comm == "uwsgi"
# Should have 2 worker process with 8 thread each and 1 http proccess with one thread
child_threads = sorted([c.nlwp for c in Process.filter(ppid=cubicweb.pid)])
assert child_threads == [1, 8, 8]
else:
# twisted
assert cubicweb.comm == "cubicweb-ctl"
assert cubicweb.comm == "uwsgi"
# Should have 2 worker process with 8 thread each and 1 http proccess with one thread
child_threads = sorted([c.nlwp for c in Process.filter(ppid=cubicweb.pid)])
assert child_threads == [1, 8, 8]
def test_saemref_sync_source_cronjob(Command):
......
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