From a842dbe6218b9605cce9248442eb247cb7436fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=A4mer?= Date: Mon, 5 Sep 2016 10:48:31 +0200 Subject: [PATCH 1/2] Fixes saltstack-formulas/salt-formula#190 --- salt/map.jinja | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/salt/map.jinja b/salt/map.jinja index c256f0c..2b14108 100644 --- a/salt/map.jinja +++ b/salt/map.jinja @@ -1,6 +1,33 @@ # -*- coding: utf-8 -*- # vim: ft=jinja +{%- macro deep_merge(a, b) %} +{%- for k,v in b.iteritems() %} +{%- if v is string or v is number %} +{%- do a.update({ k: v }) %} +{%- elif v is not mapping %} +{%- if a[k] is not defined %} +{%- do a.update({ k: v }) %} +{%- elif a[k] is iterable and a[k] is not mapping and a[k] is not string %} +{%- do a.update({ k: v|list + a[k]|list}) %} +{%- else %} +{%- do a.update({ k: v }) %} +{%- endif %} +{%- elif v is mapping %} +{%- if a[k] is not defined %} +{%- do a.update({ k: v }) %} +{%- elif a[k] is not mapping %} +{%- do a.update({ k: v }) %} +{%- else %} +{%- do deep_merge(a[k], v) %} +{%- endif %} +{%- else %} +{%- do a.update({ k: 'ERROR: case not contempled in merging!' }) %} +{%- endif %} +{%- endfor %} +{%- endmacro %} + + {## Start with defaults from defaults.yaml ##} {% import_yaml "salt/defaults.yaml" as default_settings %} @@ -109,7 +136,7 @@ that differ from whats in defaults.yaml %} {## Merge the flavor_map to the default settings ##} -{% do default_settings.salt.update(os_family_map) %} +{% do deep_merge(default_settings.salt,os_family_map) %} {## Merge in salt:lookup pillar ##} {% set salt_settings = salt['pillar.get']( From 749bf0e8634c44b4156eaf597d3045dbb73b3192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=A4mer?= Date: Tue, 13 Sep 2016 09:03:06 +0200 Subject: [PATCH 2/2] [BIGFUX] make pygit2 work with ubuntu xenial --- salt/map.jinja | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/salt/map.jinja b/salt/map.jinja index 2b14108..f237dde 100644 --- a/salt/map.jinja +++ b/salt/map.jinja @@ -126,6 +126,16 @@ that differ from whats in defaults.yaml 'pkgrepo': 'deb http://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main', 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest/SALTSTACK-GPG-KEY.pub', + 'pygit2': 'python-pygit2', + 'gitfs': { + 'pygit2': { + 'install_from_source': False, + 'git': { + 'require_state': False, + 'install_from_package': None, + }, + }, + }, }, 'Raspbian': { 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +