Skip to content

Commit

Permalink
refactor(pkgname): reserve 'pkg' as packaging dict
Browse files Browse the repository at this point in the history
BREAKING CHANGE: the parameter `pkg` is now a dictionary. References
 to `template.pkg` should be changed to `template.pkg.name`.
  • Loading branch information
noelmcloughlin committed Jun 12, 2019
1 parent 9de820d commit c6ae81c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 13 deletions.
6 changes: 4 additions & 2 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
3 changes: 2 additions & 1 deletion template/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# vim: ft=yaml
---
template:
pkg: template
pkg:
name: template
rootgroup: root
config: '/etc/template'
service:
Expand Down
12 changes: 8 additions & 4 deletions template/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion template/osfingermap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
6 changes: 4 additions & 2 deletions template/osmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion template/package/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ include:
template-package-clean-pkg-removed:
pkg.removed:
- name: {{ template.pkg }}
- name: {{ template.pkg.name }}
- require:
- sls: {{ sls_config_clean }}
2 changes: 1 addition & 1 deletion template/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
template-package-install-pkg-installed:
pkg.installed:
- name: {{ template.pkg }}
- name: {{ template.pkg.name }}
2 changes: 1 addition & 1 deletion test/integration/default/controls/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
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"}' }
Expand Down

0 comments on commit c6ae81c

Please sign in to comment.