feat(subcomponent): drop subcomponent, unbound does not have any.

This commit is contained in:
Alexander Weidinger 2021-03-31 10:37:04 +02:00
parent ab5d798c84
commit ec6ea521b6
35 changed files with 1 additions and 208 deletions

View File

@ -129,28 +129,6 @@ dependency on ``unbound.service.clean`` via include list.
This state will remove the unbound package and has a depency on
``unbound.config.clean`` via include list.
``unbound.subcomponent``
^^^^^^^^^^^^^^^^^^^^^^^^^
*Meta-state (This is a state that includes other states)*.
This state installs a subcomponent configuration file before
configuring and starting the unbound service.
``unbound.subcomponent.config``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This state will configure the unbound subcomponent and has a
dependency on ``unbound.config`` via include list.
``unbound.subcomponent.config.clean``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This state will remove the configuration of the unbound subcomponent
and reload the unbound service by a dependency on
``unbound.service.running`` via include list and ``watch_in``
requisite.
Testing
-------

View File

@ -49,8 +49,6 @@ unbound:
source_files:
unbound-config-file-file-managed:
- 'example.tmpl.jinja'
unbound-subcomponent-config-file-file-managed:
- 'subcomponent-example.tmpl.jinja'
# Just for testing purposes
winner: pillar

View File

@ -26,9 +26,7 @@ control 'unbound.config.file' do
should include(
'"tofs": {"files_switch": ["any/path/can/be/used/here", "id", '\
'"roles", "osfinger", "os", "os_family"], "source_files": '\
'{"unbound-config-file-file-managed": ["example.tmpl.jinja"], '\
'"unbound-subcomponent-config-file-file-managed": '\
'["subcomponent-example.tmpl.jinja"]}'
'{"unbound-config-file-file-managed": ["example.tmpl.jinja"]}'
)
# rubocop:enable Layout/LineLength
# rubocop:enable Lint/RedundantCopDisableDirective

View File

@ -1,25 +0,0 @@
# frozen_string_literal: true
control 'unbound.subcomponent.config.file' do
title 'Verify the subcomponent configuration file'
describe file('/etc/unbound-subcomponent-formula.conf') do
it { should be_file }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0644' }
its('content') do
should include(
'# File managed by Salt at '\
'<salt://unbound/subcomponent/config/files/default/'\
'subcomponent-example.tmpl.jinja>.'
)
end
its('content') do
should include(
'This is another subcomponent example file from SaltStack '\
'template-formula.'
)
end
end
end

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: crond
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: crond
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: mtab
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -26,8 +26,6 @@ values:
rootgroup: root
service:
name: systemd-journald
subcomponent:
config: /etc/unbound-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
unbound-config-file-file-managed:
- example.tmpl.jinja
unbound-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

@ -44,8 +44,6 @@ unbound:
source_files:
unbound-config-file-file-managed:
- 'example.tmpl.jinja'
unbound-subcomponent-config-file-file-managed:
- 'subcomponent-example.tmpl.jinja'
# Just for testing purposes
winner: pillar

View File

@ -2,7 +2,6 @@
# vim: ft=sls
include:
- .subcomponent.clean
- .service.clean
- .config.clean
- .package.clean

View File

@ -5,4 +5,3 @@ include:
- .package
- .config
- .service
- .subcomponent

View File

@ -10,8 +10,6 @@ values:
config: '/etc/unbound'
service:
name: unbound
subcomponent:
config: '/etc/unbound-subcomponent-formula.conf'
# Just here for testing
added_in_defaults: defaults_value
winner: defaults

View File

@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- .config.clean

View File

@ -1,16 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_service_clean = tplroot ~ '.service.clean' %}
{%- from tplroot ~ "/map.jinja" import mapdata as unbound with context %}
include:
- {{ sls_service_clean }}
unbound-subcomponent-config-clean-file-absent:
file.absent:
- name: {{ unbound.subcomponent.config }}
- watch_in:
- sls: {{ sls_service_clean }}

View File

@ -1,27 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
{#- Get the `tplroot` from `tpldir` #}
{%- set tplroot = tpldir.split('/')[0] %}
{%- set sls_config_file = tplroot ~ '.config.file' %}
{%- from tplroot ~ "/map.jinja" import mapdata as unbound with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_config_file }}
unbound-subcomponent-config-file-file-managed:
file.managed:
- name: {{ unbound.subcomponent.config }}
- source: {{ files_switch(['subcomponent-example.tmpl'],
lookup='unbound-subcomponent-config-file-file-managed',
use_subpath=True
)
}}
- mode: 644
- user: root
- group: {{ unbound.rootgroup }}
- makedirs: True
- template: jinja
- require_in:
- sls: {{ sls_config_file }}

View File

@ -1,6 +0,0 @@
########################################################################
# File managed by Salt at <{{ source }}>.
# Your changes will be overwritten.
########################################################################
This is a subcomponent example file from SaltStack template-formula.

View File

@ -1,6 +0,0 @@
########################################################################
# File managed by Salt at <{{ source }}>.
# Your changes will be overwritten.
########################################################################
This is another subcomponent example file from SaltStack template-formula.

View File

@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- .file

View File

@ -1,5 +0,0 @@
# -*- coding: utf-8 -*-
# vim: ft=sls
include:
- .config