refactor(pkgname): reserve 'pkg' as packaging dict

BREAKING CHANGE: the parameter `pkg` is now a dictionary. References
 to `template.pkg` should be changed to `template.pkg.name`.
This commit is contained in:
N 2019-06-05 22:35:46 +01:00
parent 9de820d71f
commit c6ae81cc65
No known key found for this signature in database
GPG key ID: 55A292EAB4E54067
8 changed files with 23 additions and 13 deletions

View file

@ -12,11 +12,13 @@ template:
# test the template formula itself. You should set these parameters to
# examples that make sense in the contexto of the formula you're writing.
{%- if grains.osfinger == 'CentOS-6' %}
pkg: cronie
pkg:
name: cronie
service:
name: crond
{%- else %}
pkg: bash
pkg:
name: bash
service:
name: systemd-udevd
{%- endif %}

View file

@ -2,7 +2,8 @@
# vim: ft=yaml
---
template:
pkg: template
pkg:
name: template
rootgroup: root
config: '/etc/template'
service:

View file

@ -15,20 +15,24 @@
{%- endif %}
Debian:
pkg: template-debian
pkg:
name: template-debian
config: /etc/template.d/custom.conf
RedHat:
pkg: template-redhat
pkg:
name: template-redhat
config: /etc/template.conf
Suse:
pkg: template-suse
pkg:
name: template-suse
Gentoo: {}
Arch:
pkg: template-arch
pkg:
name: template-arch
service:
name: service-arch

View file

@ -16,6 +16,7 @@ Ubuntu-18.04:
# os: CentOS
CentOS-6:
pkg: template-centos-6
pkg:
name: template-centos-6
config: /etc/template.d/custom-centos-6.conf
CentOS-7: {}

View file

@ -12,14 +12,16 @@
---
# os_family: Debian
Ubuntu:
pkg: template-ubuntu
pkg:
name: template-ubuntu
config: /etc/template.d/custom-ubuntu.conf
Raspbian: {}
# os_family: RedHat
Fedora:
pkg: template-fedora
pkg:
name: template-fedora
service:
name: service-fedora

View file

@ -11,6 +11,6 @@ include:
template-package-clean-pkg-removed:
pkg.removed:
- name: {{ template.pkg }}
- name: {{ template.pkg.name }}
- require:
- sls: {{ sls_config_clean }}

View file

@ -7,4 +7,4 @@
template-package-install-pkg-installed:
pkg.installed:
- name: {{ template.pkg }}
- name: {{ template.pkg.name }}

View file

@ -12,7 +12,7 @@ control 'Template configuration' do
its('content') { should include '"added_in_lookup": "lookup_value"' }
its('content') { should include '"config": "/etc/template-formula.conf"' }
its('content') { should include '"lookup": {"added_in_lookup": "lookup_value",' }
its('content') { should include '"pkg": "' }
its('content') { should include '"pkg": {"name": "' }
its('content') { should include '"service": {"name": "' }
its('content') { should include '"tofs": {"files_switch": ["any/path/can/be/used/here", "id", "osfinger", "os", "os_family"], "source_files": {"template-config-file-file-managed": ["example.tmpl.jinja"]}' }
its('content') { should include '"winner": "pillar"}' }