Last active
February 12, 2016 20:03
-
-
Save mjinks/cfefc0c50a5a6dd3f5d4 to your computer and use it in GitHub Desktop.
BIND: 'notify' item required, was: Jinja goose chase: "notify"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind_local_config: | |
file.managed: | |
- name: {{ map.local_config }} | |
- source: 'salt://{{ map.config_source_dir }}/named.conf.local' | |
- template: jinja | |
- user: {{ salt['pillar.get']('bind:config:user', map.user) }} | |
- group: {{ salt['pillar.get']('bind:config:group', map.group) }} | |
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }} | |
- context: | |
map: {{ map }} | |
- require: | |
- pkg: bind | |
- file: {{ map.log_dir }}/query.log | |
- watch_in: | |
- service: bind | |
{# taking on: #} | |
- defaults: | |
wibble: {{ pillar['bind'] }} | |
- order: 2 | |
{# ...with varying 'order' numbers and various pillars pointed at, with no change, | |
so i'm guessing i'm barking up a wrong tree. #} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind: | |
lookup: | |
pkgs: | |
- bind9 | |
service: bind9 | |
config: | |
tmpl: salt://bind/files/debian/named.conf | |
user: root | |
group: bind | |
mode: 640 | |
configured_zones: | |
peerlessnetwork.com: | |
type: master | |
also_notify: "172.16.52.197; 172.16.51.98; 208.93.42.60;" | |
40.93.208.in-addr.arpa: | |
type: slave | |
notify: False | |
available_zones: | |
peerlessnetwork.com: | |
file: db.peerlessnetwork.com | |
masters: "208.93.40.52, 208.93.42.60;" | |
40.93.208.in-addr.arpa: | |
file: slave.40.93.208 | |
masters: "208.93.40.52, 208.93.42.60;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From the "bind" formula, in 'config.sls': | |
bind_local_config: | |
file.managed: | |
- name: {{ map.local_config }} | |
- source: 'salt://{{ map.config_source_dir }}/named.conf.local' | |
- template: jinja | |
- user: {{ salt['pillar.get']('bind:config:user', map.user) }} | |
- group: {{ salt['pillar.get']('bind:config:group', map.group) }} | |
- mode: {{ salt['pillar.get']('bind:config:mode', '644') }} | |
- context: | |
map: {{ map }} | |
- require: | |
- pkg: bind | |
- file: {{ map.log_dir }}/query.log | |
- watch_in: | |
- service: bind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# the "also_notify" is my addition, but the same error happens after a rollback #} | |
{%- macro zone(key, args, file, masters) %} | |
zone "{{ key }}" { | |
type {{ args['type'] }}; | |
{% if args['dnssec'] is defined and args['dnssec'] -%} | |
file "zones/{{ file }}.signed"; | |
{% else -%} | |
file "zones/{{ file }}"; | |
{%- endif %} | |
{% if args['allow-update'] is defined -%} | |
allow-update { {{args['allow-update']}}; }; | |
{%- endif %} | |
{%- if args.update_policy is defined %} | |
update-policy { | |
{%- for policy in args.update_policy %} | |
{{ policy }}; | |
{%- endfor %} | |
}; | |
{%- endif %} | |
{%- if args.allow_transfer is defined %} | |
allow-transfer { | |
{% for remote in args.get('allow-transfer', {}) %} | |
{{ remote }}; | |
{% endfor %} | |
}; | |
{%- endif -%} | |
{% if args['type'] == "master" -%} | |
{% if args['notify'] -%} | |
notify yes; | |
{% else -%} | |
notify no; | |
{%- endif -%} | |
{% if args['also_notify'] -%} | |
also-notify { {{ also_notify }} }; | |
{%- endif -%} | |
{% else -%} | |
notify no; | |
masters { {{ masters }} }; | |
{%- endif %} | |
}; | |
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------- | |
ID: bind_local_config | |
Function: file.managed | |
Name: /etc/bind/named.conf.local | |
Result: False | |
Comment: An exception occurred in this state: Traceback (most recent call last): | |
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1560, in call | |
**cdata['kwargs']) | |
File "/usr/lib/python2.7/dist-packages/salt/states/file.py", line 1423, in managed | |
**kwargs | |
File "/usr/lib/python2.7/dist-packages/salt/modules/file.py", line 3142, in check_managed_changes | |
**kwargs) | |
File "/usr/lib/python2.7/dist-packages/salt/modules/file.py", line 2841, in get_managed | |
**kwargs) | |
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 121, in render_tmpl | |
output = render_str(tmplstr, context, tmplpath) | |
File "/usr/lib/python2.7/dist-packages/salt/utils/templates.py", line 324, in render_jinja_tmpl | |
buf=tmplstr) | |
SaltRenderError: Jinja variable 'dict object' has no attribute 'notify' | |
Started: 14:14:38.812499 | |
Duration: 68.325 ms | |
Changes: | |
---------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If anybody's looking: found the trouble. In hindsight I see I'd just misread the error, but given its phrasing I'm cutting myself some slack.
I had an entry in my pillar under 'configured_zones' that didn't have a 'notify:' item at all. Plug that in, set to to either 'True' or 'False', and all is well.
The error was:
SaltRenderError: Jinja variable 'dict object' has no attribute 'notify'
But if it'd been phrased:
SaltRenderError: Jinja variable 'dict object' has no attribute: 'notify'
...I might have caught on sooner.