Skip to content

Commit

Permalink
refactor(jinja): tidyup indention on jinja rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Jul 1, 2019
1 parent 2db3acc commit 86211e0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 40 deletions.
2 changes: 1 addition & 1 deletion deepsea/config.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml

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

deepsea-config-global:
file.line:
Expand Down
6 changes: 4 additions & 2 deletions deepsea/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ deepsea:
# ideally `DeepSea` (or `packages-formula`) handle package dependencies.
managed: False
required:
- python-setuptools
- python3
- python3-setuptools
- python3-boto
- python3-configobj
- python3-click
- python3-rados
- python3-tox
- lsscsi
- jq # needs epel on centos
- pciutils
Expand Down
30 changes: 19 additions & 11 deletions deepsea/install.sls
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml

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

include:
- deepsea.config
- deepsea.service
{% if deepsea.packages.managed %}
- deepsea.packages
{% endif %}

deepsea-directories:
file.directory:
Expand All @@ -26,8 +23,18 @@ deepsea-directories:
- require_in:
- file: deepsea-software

{%- if deepsea.packages.managed and deepsea.packages.required %}
deepsea-packages-common-dependencies:
pkg.installed:
- pkgs:
- make
- {{ deepsea.packages.required|json }}
- require_in:
- cmd: deepsea-software
{% endif %}

deepsea-software:
{% if deepsea.use_upstream_pkgrepo %}
{%- if deepsea.use_upstream_pkgrepo %}
pkgrepo.managed:
- name: deepsea-{{ deepsea.release }}
- humanname: {{ deepsea.repo.name }}
Expand All @@ -40,10 +47,8 @@ deepsea-software:
pkg.installed:
- name: deepsea

{% else %}
{%- else %}

pkg.installed:
- name: make
pkgrepo.absent:
- name: deepsea-{{ deepsea.release }}
- require_in:
Expand All @@ -65,10 +70,13 @@ deepsea-software:
cmd.run:
- name: make install
- cwd: {{ deepsea.tmpdir }}/DeepSea
{% endif %}
{%- endif %}
- require_in:
- file: deepsea-config-global
- require:
- file: deepsea-directories
- pkg: deepsea-software
- pkgrepo: deepsea-software
- require_in:
- file: deepsea-config-global
{%- if deepsea.packages.managed and deepsea.packages.required %}
- pkg: deepsea-packages-common-dependencies
{%- endif %}
11 changes: 1 addition & 10 deletions deepsea/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ Suse:
- gptfdisk
- iperf
- lsof
- python3-setuptools
- python3-click
- python3-tox
- python3-configobj

Debian:
packages:
required:
- gdisk
- iperf
- python-tox

RedHat:
services:
Expand All @@ -40,11 +35,7 @@ RedHat:
- salt-minion
packages:
required:
- python-setuptools
- python-configobj
- python-click
- python-tox
- python-netaddr
- python3-netaddr
- iperf3
- gdisk
- lshw
Expand Down
12 changes: 0 additions & 12 deletions deepsea/packages.sls

This file was deleted.

2 changes: 1 addition & 1 deletion deepsea/remove.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml

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

deepsea-cleanup:
file.absent:
Expand Down
5 changes: 2 additions & 3 deletions deepsea/service.sls
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
# -*- coding: utf-8 -*-
# vim: ft=sls

{% from "deepsea/map.jinja" import deepsea with context %}
{% for svc in deepsea.services.running %}
{%- for svc in deepsea.services.running %}
deepsea-{{ svc }}-running:
service.running:
- name: {{ svc }}
- enable: True
{% endfor %}
{% for svc in deepsea.services.dead %}
{%- for svc in deepsea.services.dead %}
deepsea-{{ svc }}-notrunning:
service.dead:
- name: {{ svc }}
Expand Down

0 comments on commit 86211e0

Please sign in to comment.