feat(subcomponent): drop subcomponent, NSD does not have any

This commit is contained in:
Alexander Weidinger 2021-04-01 23:47:47 +02:00
parent 91f759f953
commit a5a8ec4113
35 changed files with 1 additions and 208 deletions

View File

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

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/nsd'
service:
name: nsd
subcomponent:
config: '/etc/nsd-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 nsd with context %}
include:
- {{ sls_service_clean }}
nsd-subcomponent-config-clean-file-absent:
file.absent:
- name: {{ nsd.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 nsd with context %}
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
include:
- {{ sls_config_file }}
nsd-subcomponent-config-file-file-managed:
file.managed:
- name: {{ nsd.subcomponent.config }}
- source: {{ files_switch(['subcomponent-example.tmpl'],
lookup='nsd-subcomponent-config-file-file-managed',
use_subpath=True
)
}}
- mode: 644
- user: root
- group: {{ nsd.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

View File

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

View File

@ -26,9 +26,7 @@ control 'nsd.config.file' do
should include(
'"tofs": {"files_switch": ["any/path/can/be/used/here", "id", '\
'"roles", "osfinger", "os", "os_family"], "source_files": '\
'{"nsd-config-file-file-managed": ["example.tmpl.jinja"], '\
'"nsd-subcomponent-config-file-file-managed": '\
'["subcomponent-example.tmpl.jinja"]}'
'{"nsd-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 'nsd.subcomponent.config.file' do
title 'Verify the subcomponent configuration file'
describe file('/etc/nsd-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://nsd/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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-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/nsd-subcomponent-formula.conf
tofs:
files_switch:
- any/path/can/be/used/here
@ -39,6 +37,4 @@ values:
source_files:
nsd-config-file-file-managed:
- example.tmpl.jinja
nsd-subcomponent-config-file-file-managed:
- subcomponent-example.tmpl.jinja
winner: pillar

View File

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