Fix Powerdns api key rendering

also added simple kitchen tests, to prevent such issues
to appear in future.

Change-Id: Idd8a6ce7cb37e913c24c8911c547d4346324c5ea
Related-Prod: OSCORE-286
diff --git a/.kitchen.openstack.yml b/.kitchen.openstack.yml
new file mode 100644
index 0000000..6dbf7b2
--- /dev/null
+++ b/.kitchen.openstack.yml
@@ -0,0 +1,41 @@
+
+# usage: `KITCHEN_LOCAL_YAML=.kitchen.openstack.yml kitchen test`
+
+# https://docs.chef.io/config_yml_kitchen.html
+# https://github.com/test-kitchen/kitchen-openstack
+
+---
+driver:
+  name: openstack
+  openstack_auth_url: <%= ENV['OS_AUTH_URL'] %>/tokens
+  openstack_username: <%= ENV['OS_USERNAME'] || 'ci' %>
+  openstack_api_key:  <%= ENV['OS_PASSWORD'] || 'ci' %>
+  openstack_tenant:   <%= ENV['OS_TENANT_NAME'] || 'ci_jenkins' %>
+
+  #floating_ip_pool: <%= ENV['OS_FLOATING_IP_POOL'] || 'nova' %>
+  key_name: <%= ENV['BOOTSTRAP_SSH_KEY_NAME'] || 'bootstrap_insecure' %>
+  private_key_path: <%= ENV['BOOTSTRAP_SSH_KEY_PATH'] || "#{ENV['HOME']}/.ssh/id_rsa_bootstrap_insecure" %>
+
+
+platforms:
+  - name: ubuntu-14.04
+    driver:
+      username: <%= ENV['OS_UBUNTU_IMAGE_USER'] || 'root' %>
+      image_ref: <%= ENV['OS_UBUNTU_IMAGE_REF'] || 'ubuntu-14-04-x64-1455869035' %>
+      flavor_ref: m1.medium
+      network_ref:
+        <% if ENV['OS_NETWORK_REF'] -%>
+        - <% ENV['OS_NETWORK_REF'] %>
+        <% else -%>
+        - ci-net
+        <% end -%>
+    # force update apt cache on the image
+    run_list:
+      - recipe[apt]
+    attributes:
+      apt:
+          compile_time_update: true
+transport:
+  username: <%= ENV['OS_UBUNTU_IMAGE_USER'] || 'root' %>
+
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.kitchen.vagrant.yml b/.kitchen.vagrant.yml
new file mode 100644
index 0000000..f02b728
--- /dev/null
+++ b/.kitchen.vagrant.yml
@@ -0,0 +1,30 @@
+---
+driver:
+  name: vagrant
+  vm_hostname: powerdns.ci.local
+  use_sudo: false
+  customize:
+    memory: 512
+
+
+provisioner:
+  name: salt_solo
+  salt_install: bootstrap
+  salt_bootstrap_url: https://bootstrap.saltstack.com
+  salt_version: latest
+  require_chef: false
+  formula: powerdns
+  log_level: info
+  state_top:
+    base:
+      "*":
+        - powerdns
+  pillars:
+    top.sls:
+      base:
+        "*":
+          - powerdns
+  grains:
+    noservices: True
+
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..3af6abf
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,44 @@
+---
+driver:
+  name: docker
+  hostname: powerdns.ci.local
+  use_sudo: false
+
+provisioner:
+  name: salt_solo
+  salt_install: bootstrap
+  salt_bootstrap_url: https://bootstrap.saltstack.com
+  salt_version: latest
+  require_chef: false
+  log_level: error
+  formula: powerdns
+  grains:
+    noservices: True
+  state_top:
+    base:
+      "*":
+        - powerdns
+  pillars:
+    top.sls:
+      base:
+        "*":
+          - powerdns
+
+verifier:
+  name: inspec
+  sudo: true
+
+
+platforms:
+  - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+    driver_config:
+      image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+      platform: ubuntu
+
+suites:
+
+  - name: server
+    provisioner:
+      pillars-from-files:
+        powerdns.sls: tests/pillar/server.sls
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..7a77247
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,39 @@
+sudo: required
+services:
+  - docker
+
+install:
+  - pip install PyYAML
+  - pip install virtualenv
+  - |
+    test -e Gemfile || cat <<EOF > Gemfile
+    source 'https://rubygems.org'
+    gem 'rake'
+    gem 'test-kitchen'
+    gem 'kitchen-docker'
+    gem 'kitchen-inspec'
+    gem 'inspec'
+    gem 'kitchen-salt', :git => 'https://github.com/salt-formulas/kitchen-salt.git'
+  - bundle install
+
+env:
+    - PLATFORM=trevorj/salty-whales:trusty
+    - PLATFORM=trevorj/salty-whales:xenial
+
+before_script:
+  - set -o pipefail
+  - make test | tail
+
+script:
+  - test ! -e .kitchen.yml || bundle exec kitchen test -t tests/integration
+
+notifications:
+  webhooks:
+    urls:
+      - https://webhooks.gitter.im/e/6123573504759330786b
+    on_success: change  # options: [always|never|change] default: always
+    on_failure: never  # options: [always|never|change] default: always
+    on_start: never     # options: [always|never|change] default: always
+    on_cancel: never    # options: [always|never|change] default: always
+    on_error: never    # options: [always|never|change] default: always
+  email: false
diff --git a/powerdns/files/pdns.conf b/powerdns/files/pdns.conf
index d40feb7..dc4f8cb 100644
--- a/powerdns/files/pdns.conf
+++ b/powerdns/files/pdns.conf
@@ -3,7 +3,7 @@
 allow-axfr-ips={{ server.axfr_ips|join(',') }}
 allow-recursion=127.0.0.1
 {%- if server.api.enabled %}
-api-key={{ server.api_key }}
+api-key={{ server.api.key }}
 api=yes
 {%- endif %}
 config-dir=/etc/powerdns