Skip to content

Commit

Permalink
fix(everything): review comments & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rbjorklin committed Mar 30, 2019
1 parent 15d4e34 commit 297d784
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ suites:
state_top:
base:
'*':
- vault
- vault.package
pillars:
top.sls:
base:
Expand All @@ -52,7 +52,7 @@ suites:
vault:
# version: 0.11.1 # test upgrades by doing a double-converge, changing the version pillar between each one
version: 0.11.2
secure_download: false
verify_download: False

- name: dev_server
provisioner:
Expand Down Expand Up @@ -83,7 +83,7 @@ suites:
vault:
tls_disable: 1
self_signed_cert:
enabled: true
enabled: True
hostname: localhost
password: localhost
country: GB
Expand Down
2 changes: 1 addition & 1 deletion test/integration/dev_server/vault_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
it { should be_running }
end

describe file("/etc/vault/config/server.hcl") do
describe file("/etc/vault/conf.d/config.json") do
it { should_not be_a_file }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/install_binary/vault_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
it { should_not be_running }
end

describe file("/etc/vault/config/server.hcl") do
describe file("/etc/vault/conf.d/config.json") do
it { should_not be_a_file }
end
2 changes: 1 addition & 1 deletion test/integration/prod_server/vault_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
its(:stdout) { should match(/\/vault = cap_ipc_lock\+ep$/) }
end

describe file('/etc/vault/config/server.hcl') do
describe file('/etc/vault/conf.d/config.json') do
it { should be_a_file }
end

Expand Down
15 changes: 15 additions & 0 deletions vault/config/config.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent

{% from "vault/map.jinja" import vault with context -%}

vault-config-init-file-serialize:
file.serialize:
- name: /etc/vault/conf.d/config.json
- encoding: utf-8
- formatter: json
- dataset: {{ vault.config | json }}
- user: root
- group: vault
- mode: 640
- makedirs: True
19 changes: 6 additions & 13 deletions vault/config/init.sls
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent

{% from "vault/map.jinja" import vault with context -%}
{% from "vault/map.jinja" import vault with context %}

vault-config-init-file-serialize:
file.serialize:
- name: /etc/vault/conf.d/config.json
- encoding: utf-8
- formatter: json
- dataset: {{ vault.config | json }}
- user: root
- group: vault
- mode: 640
- makedirs: True
- watch_in:
- service: vault
include:
- .config
{%- if vault.self_signed_cert.enabled %}
- .self-sign
{%- endif %}
16 changes: 16 additions & 0 deletions vault/config/self-sign.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent

{% from "vault/map.jinja" import vault with context -%}

vault-config-self-signed-pkg-installed:
pkg.installed:
- name: openssl

vault-config-self-signed-cmd-script:
cmd.script:
- source: salt://vault/files/cert-gen.sh.j2
- template: jinja
- args: {{ vault.self_signed_cert.hostname }} {{ vault.self_signed_cert.password }}
- cwd: /etc/vault
- creates: /etc/vault/{{ vault.self_signed_cert.hostname }}.pem
2 changes: 2 additions & 0 deletions vault/yaml/defaults.yaml → vault/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ vault:
platform: linux_amd64
dev_mode: False
verify_download: True
self_signed_cert:
enabled: False
config:
storage:
file:
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions vault/map.jinja
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent

{% import_yaml "vault/yaml/defaults.yaml" as defaults %}
{% import_yaml "vault/yaml/osfamilymap.yaml" as osfamilymap %}
{% import_yaml "vault/yaml/initfamilymap.yaml" as initfamilymap %}
{% import_yaml "vault/defaults.yaml" as defaults %}
{% import_yaml "vault/osfamilymap.yaml" as osfamilymap %}
{% import_yaml "vault/initfamilymap.yaml" as initfamilymap %}

{% set vault = salt['grains.filter_by'](
defaults, merge=salt['grains.filter_by'](
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions vault/package/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

include:
- .install
{%- if vault.verify_download %}
{%- if vault.verify_download %}
- .gpg
- .signature
{%- endif %}
{%- endif %}
4 changes: 3 additions & 1 deletion vault/service/clean.sls
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent

{% from "vault/map.jinja" import vault with context %}

vault-service-clean-service-dead:
service.dead:
- name: vault
- enable: False

vault-service-clean-file-absent:
file.absent:
- name: /etc/systemd/system/vault.service
- name: {{ vault.service.path }}
2 changes: 0 additions & 2 deletions vault/service/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ vault-service-init-file-managed:
- name: {{ vault.service.path }}
- source: {{ vault.service.source }}
- template: jinja
- watch_in:
- service: vault

vault-service-init-service-running:
service.running:
Expand Down

0 comments on commit 297d784

Please sign in to comment.