Skip to content

Commit fa32601

Browse files
authored
Merge pull request #23 from n-rodriguez/wip/kitchen
Upgrade formula to new standards
2 parents 8c7b3f0 + 8f6c57f commit fa32601

27 files changed

+374
-123
lines changed

.cirrus.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,33 @@ docker_builder:
66
env:
77
matrix:
88
- INSTANCE: default-debian-10-develop-py3
9-
- INSTANCE: default-ubuntu-1804-develop-py3
9+
# - INSTANCE: default-ubuntu-1804-develop-py3
1010
# - INSTANCE: default-centos-7-develop-py3
1111
# - INSTANCE: default-fedora-30-develop-py3
1212
# - INSTANCE: default-opensuse-leap-15-develop-py3
1313
# - INSTANCE: default-amazonlinux-2-develop-py2
14-
- INSTANCE: default-debian-9-2019-2-py3
14+
# - INSTANCE: default-arch-base-latest-develop-py2
15+
# - INSTANCE: default-debian-9-2019-2-py3
1516
- INSTANCE: default-ubuntu-1804-2019-2-py3
1617
# - INSTANCE: default-centos-7-2019-2-py3
1718
# - INSTANCE: default-fedora-30-2019-2-py3
1819
# - INSTANCE: default-opensuse-leap-15-2019-2-py3
19-
# - INSTANCE: default-amazonlinux-2-2019-2-py2
20-
- INSTANCE: default-debian-9-2018-3-py2
20+
- INSTANCE: default-amazonlinux-2-2019-2-py2
21+
- INSTANCE: default-arch-base-latest-2019-2-py2
22+
# - INSTANCE: default-debian-9-2018-3-py2
2123
# - INSTANCE: default-ubuntu-1604-2018-3-py2
2224
# - INSTANCE: default-centos-7-2018-3-py2
23-
# - INSTANCE: default-fedora-29-2018-3-py2
24-
# - INSTANCE: default-opensuse-leap-15-2018-3-py2
25+
- INSTANCE: default-fedora-29-2018-3-py2
26+
- INSTANCE: default-opensuse-leap-15-2018-3-py2
2527
# - INSTANCE: default-amazonlinux-2-2018-3-py2
28+
# - INSTANCE: default-arch-base-latest-2018-3-py2
2629
# - INSTANCE: default-debian-8-2017-7-py2
2730
# - INSTANCE: default-ubuntu-1604-2017-7-py2
28-
# - INSTANCE: default-centos-6-2017-7-py2
31+
- INSTANCE: default-centos-6-2017-7-py2
2932
# - INSTANCE: default-fedora-29-2017-7-py2
3033
# - INSTANCE: default-opensuse-leap-15-2017-7-py2
3134
# - INSTANCE: default-amazonlinux-2-2017-7-py2
35+
# - INSTANCE: default-arch-base-latest-2017-7-py2
3236
bundle_install_script: bundle install
3337
verify_script:
3438
- bin/kitchen verify ${INSTANCE}

docs/README.rst

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,18 @@ Available states
4949
^^^^^^^^^^^^^
5050
Installs and configures the syslog_ng package.
5151

52-
``syslog_ng.packages``
52+
``syslog_ng.package``
5353
^^^^^^^^^^^^^^^^^^^^^^
5454
Installs the syslog_ng package and optional packages which may provide additional functionalities.
5555

5656
``syslog_ng.config``
5757
^^^^^^^^^^^^^^^^^^^^
5858
This state manages the file ``syslog_ng.conf`` under ``/etc/syslog-ng`` (template found in "syslog_ng/files"). The configuration is populated by values in "syslog_ng/map.jinja" based on the package's default values (and RedHat, Debian, Suse and Arch family distribution specific values), which can then be overridden by values of the same name in pillar.
5959

60+
``syslog_ng.service``
61+
^^^^^^^^^^^^^^^^^^^^
62+
Manages the startup and running state of the syslog_ng service.
63+
6064
Testing
6165
-------
6266

@@ -72,32 +76,32 @@ Requirements
7276
7377
$ gem install bundler
7478
$ bundle install
75-
$ bundle exec kitchen test [platform]
79+
$ bin/kitchen test [platform]
7680
7781
Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
7882
e.g. ``debian-9-2019-2-py3``.
7983

80-
``kitchen converge``
81-
^^^^^^^^^^^^^^^^^^^^
84+
``bin/kitchen converge``
85+
^^^^^^^^^^^^^^^^^^^^^^^^
8286

83-
Creates the docker instance and runs the ``template`` main state, ready for testing.
87+
Creates the docker instance and runs the ``syslog_ng`` main state, ready for testing.
8488

85-
``kitchen verify``
86-
^^^^^^^^^^^^^^^^^^
89+
``bin/kitchen verify``
90+
^^^^^^^^^^^^^^^^^^^^^^
8791

8892
Runs the ``inspec`` tests on the actual instance.
8993

90-
``kitchen destroy``
91-
^^^^^^^^^^^^^^^^^^^
94+
``bin/kitchen destroy``
95+
^^^^^^^^^^^^^^^^^^^^^^^
9296

9397
Removes the docker instance.
9498

95-
``kitchen test``
96-
^^^^^^^^^^^^^^^^
99+
``bin/kitchen test``
100+
^^^^^^^^^^^^^^^^^^^^
97101

98102
Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.
99103

100-
``kitchen login``
101-
^^^^^^^^^^^^^^^^^
104+
``bin/kitchen login``
105+
^^^^^^^^^^^^^^^^^^^^^
102106

103107
Gives you SSH access to the instance for manual testing.

kitchen.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ platforms:
5353
provision_command:
5454
- curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
5555
- sh bootstrap-salt.sh -XdPbfrq -x python2 git develop
56+
- name: arch-base-latest-develop-py2
57+
driver:
58+
image: netmanagers/salt-develop-py2:arch-base-latest
59+
provision_command:
60+
- curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
61+
- sh bootstrap-salt.sh -XdPbfrq -x python2 git develop
62+
run_command: /usr/lib/systemd/systemd
5663

5764
## SALT `2019.2`
5865
- name: debian-9-2019-2-py3
@@ -78,6 +85,10 @@ platforms:
7885
- name: amazonlinux-2-2019-2-py2
7986
driver:
8087
image: netmanagers/salt-2019.2-py2:amazonlinux-2
88+
- name: arch-base-latest-2019-2-py2
89+
driver:
90+
image: netmanagers/salt-2019.2-py2:arch-base-latest
91+
run_command: /usr/lib/systemd/systemd
8192

8293
## SALT `2018.3`
8394
- name: debian-9-2018-3-py2
@@ -103,6 +114,10 @@ platforms:
103114
- name: amazonlinux-2-2018-3-py2
104115
driver:
105116
image: netmanagers/salt-2018.3-py2:amazonlinux-2
117+
- name: arch-base-latest-2018-3-py2
118+
driver:
119+
image: netmanagers/salt-2018.3-py2:arch-base-latest
120+
run_command: /usr/lib/systemd/systemd
106121

107122
## SALT `2017.7`
108123
- name: debian-8-2017-7-py2
@@ -129,6 +144,10 @@ platforms:
129144
- name: amazonlinux-2-2017-7-py2
130145
driver:
131146
image: netmanagers/salt-2017.7-py2:amazonlinux-2
147+
- name: arch-base-latest-2017-7-py2
148+
driver:
149+
image: netmanagers/salt-2017.7-py2:arch-base-latest
150+
run_command: /usr/lib/systemd/systemd
132151

133152
provisioner:
134153
name: salt_solo
@@ -154,14 +173,14 @@ suites:
154173
state_top:
155174
base:
156175
'*':
157-
- syslog_ng.config
176+
- syslog_ng
158177
pillars:
159178
top.sls:
160179
base:
161180
'*':
162181
- syslog_ng
163182
pillars_from_files:
164-
syslog_ng.sls: pillar.example
183+
syslog_ng.sls: test/salt/pillar/syslog_ng.sls
165184
verifier:
166185
inspec_tests:
167186
- path: test/integration/default

syslog_ng/config.sls

Lines changed: 0 additions & 15 deletions
This file was deleted.

syslog_ng/config/file.sls

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
{#- Get the `tplroot` from `tpldir` #}
5+
{%- set tplroot = tpldir.split('/')[0] %}
6+
{%- set sls_package_install = tplroot ~ '.package.install' %}
7+
{%- from tplroot ~ "/map.jinja" import syslog_ng with context %}
8+
9+
include:
10+
- {{ sls_package_install }}
11+
12+
syslog_ng/config/install:
13+
file.managed:
14+
- name: {{ syslog_ng.syslog_ng_config }}
15+
- source: {{ syslog_ng.syslog_ng_config_src }}
16+
- template: jinja
17+
- user: root
18+
- group: root
19+
- mode: 644
20+
- require:
21+
- sls: {{ sls_package_install }}
22+
- context:
23+
syslog_ng: {{ syslog_ng | json }}

syslog_ng/config/init.sls

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
4+
include:
5+
- .file

syslog_ng/defaults.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
syslog_ng:
5+
package: syslog-ng
6+
service: syslog-ng
7+
syslog_ng_config: /etc/syslog-ng/syslog-ng.conf
8+
syslog_ng_config_src: salt://syslog_ng/files/syslog-ng.conf

syslog_ng/defaults.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

syslog_ng/files/syslog-ng.conf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
{%- from "syslog_ng/macro.jinja" import rule_builder -%}
2-
{%- from "syslog_ng/map.jinja" import syslog_ng with context -%}
1+
########################################################################
2+
# File managed by Salt at <{{ source }}>.
3+
# Your changes will be overwritten.
4+
########################################################################
5+
6+
{%- from "syslog_ng/macro.jinja" import rule_builder %}
37

48
@version: {{ syslog_ng.get('version', '3.3') }}
59

syslog_ng/init.sls

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
{% from "syslog_ng/map.jinja" import syslog_ng with context %}
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
23

3-
syslog_ng:
4-
pkg.installed:
5-
- name: {{ syslog_ng.package }}
6-
7-
service.running:
8-
- enable: True
9-
- name: {{ syslog_ng.service }}
10-
- watch:
11-
- pkg: syslog_ng
4+
include:
5+
- .package
6+
- .config
7+
- .service

0 commit comments

Comments
 (0)