瀏覽代碼

Manage grains using support metadata

Change-Id: I25fb0eb0d4b922b8853eceb0c1c220a4040e1704
pull/92/head
Filip Pytloun 7 年之前
父節點
當前提交
e70606d0d2
共有 5 個文件被更改,包括 17 次插入41 次删除
  1. +0
    -10
      linux/files/sphinx.grain
  2. +0
    -3
      linux/map.jinja
  3. +13
    -1
      linux/meta/salt.yml
  4. +4
    -24
      linux/system/doc.sls
  5. +0
    -3
      linux/system/init.sls

+ 0
- 10
linux/files/sphinx.grain 查看文件

@@ -1,10 +0,0 @@
{%- set service_grains = {'sphinx': {'doc': {}}} %}
{%- for service_name, service in pillar.items() %}
{%- if service.get('_support', {}).get('sphinx', {}).get('enabled', False) %}
{%- set grains_fragment_file = service_name+'/meta/sphinx.yml' %}
{%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
{%- set grains_yaml = load_grains_file()|load_yaml %}
{%- set _dummy = service_grains.sphinx.doc.update({ service_name: grains_yaml.doc }) %}
{%- endif %}
{%- endfor %}
{{ service_grains|yaml(False) }}

+ 0
- 3
linux/map.jinja 查看文件

@@ -18,7 +18,6 @@
},
'selinux': 'permissive',
'ca_certs_dir': '/usr/local/share/ca-certificates',
'doc_validity_pkgs': ['python-yaml'],
},
'Debian': {
'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
@@ -39,7 +38,6 @@
},
'selinux': 'permissive',
'ca_certs_dir': '/usr/local/share/ca-certificates',
'doc_validity_pkgs': ['python-yaml'],
},
'RedHat': {
'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
@@ -60,7 +58,6 @@
},
'selinux': 'permissive',
'ca_certs_dir': '/usr/local/share/ca-certificates',
'doc_validity_pkgs': ['PyYAML'],
},
}, grain='os_family', merge=salt['pillar.get']('linux:system')) %}


+ 13
- 1
linux/meta/salt.yml 查看文件

@@ -1,3 +1,4 @@
{%- from "linux/map.jinja" import system with context -%}
orchestrate:
system:
priority: 30
@@ -5,4 +6,15 @@ orchestrate:
priority: 40
storage:
priority: 50

grain:
sphinx:
{%- set service_grains = {'sphinx': {'doc': {}}} %}
{%- for service_name, service in pillar.items() %}
{%- if service.get('_support', {}).get('sphinx', {}).get('enabled', False) %}
{%- set grains_fragment_file = service_name+'/meta/sphinx.yml' %}
{%- macro load_grains_file() %}{% include grains_fragment_file %}{% endmacro %}
{%- set grains_yaml = load_grains_file()|load_yaml %}
{%- do service_grains.sphinx.doc.update({ service_name: grains_yaml.doc }) %}
{%- endif %}
{%- endfor %}
{{ service_grains|yaml(False)|indent(4) }}

+ 4
- 24
linux/system/doc.sls 查看文件

@@ -1,30 +1,10 @@
{%- from "linux/map.jinja" import system with context %}
{%- if system.enabled %}

linux_system_doc_grains_dir:
file.directory:
- name: /etc/salt/grains.d
- mode: 700
- makedirs: true
- user: root
# This state is obsolete, grains are now managed from salt.minion.grains so we
# will just include it

linux_system_doc_grain:
file.managed:
- name: /etc/salt/grains.d/sphinx
- source: salt://linux/files/sphinx.grain
- template: jinja
- mode: 600
- require:
- file: linux_system_doc_grains_dir

linux_system_doc_validity_check:
pkg.installed:
- pkgs: {{ system.doc_validity_pkgs }}
cmd.wait:
- name: python -c "import yaml; stream = file('/etc/salt/grains.d/sphinx', 'r'); yaml.load(stream); stream.close()"
- require:
- pkg: linux_system_doc_validity_check
- watch:
- file: linux_system_doc_grain
include:
- salt.minion.grains

{%- endif %}

+ 0
- 3
linux/system/init.sls 查看文件

@@ -59,9 +59,6 @@ include:
{%- if system.console is defined %}
- linux.system.console
{%- endif %}
{%- if system.doc is defined %}
- linux.system.doc
{%- endif %}
{%- if system.limit|length > 0 %}
- linux.system.limit
{%- endif %}

Loading…
取消
儲存