瀏覽代碼

improving the new code a bit

tags/v0.1
Arnold Bechtoldt 10 年之前
父節點
當前提交
59f8bf903f
共有 4 個檔案被更改,包括 20 行新增13 行删除
  1. +4
    -0
      README.rst
  2. +2
    -2
      network/defaults.yaml
  3. +10
    -7
      network/routes.sls
  4. +4
    -4
      pillar.example.sls

+ 4
- 0
README.rst 查看文件

@@ -42,6 +42,10 @@ Sets the network interfaces configuration
--------------------
Sets the resolver configuration

``network.routes``
------------------
Manages network routes

Additional resources
====================


+ 2
- 2
network/defaults.yaml 查看文件

@@ -21,7 +21,7 @@ Debian:
- pre_down_cmds
- post_up_cmds
- post_down_cmds
# bonding
{#- bonding #}
- master
- mode
- slaves
@@ -84,7 +84,7 @@ RedHat:
- pre_down_cmds
- post_up_cmds
- post_down_cmds
# bonding
{#- bonding #}
- master
- mode
- slaves

+ 10
- 7
network/routes.sls 查看文件

@@ -1,17 +1,20 @@
#!jinja|yaml
# vim: sts=2 ts=2 sw=2 et ai

{% from "network/defaults.yaml" import rawmap with context %}
{% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network')) %}

{% for r in datamap.routes %}
{# TODO: The function name 'routes' in 'network.routes' should be moved into the list as soon as it's possible
for code convention reasons. Unfortunately 'routes' is also used in **kwargs when calling ip.build_routes
in salt.states.network #}
{% for r in datamap.routes|default([]) %}
{{ r.name }}:
network.routes:
- name: {{ r.name }}
- routes:
{% for n in r.networks %}
- name: {{ n.name }}
{% for n in r.networks %}
- name: {{ n.name }}
ipaddr: {{ n.ipaddr }}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
netmask: {{ n.netmask }}
gateway: {{ n.gateway }}
{% endfor %}
{% endfor %}

+ 4
- 4
pillar.example.sls 查看文件

@@ -67,8 +67,8 @@ network:
routes:
- name: eth1
networks:
- name: for_lan
ipaddr: 172.16.0.0
- name: for_lan
ipaddr: 172.16.0.0
netmask: 255.255.0.0
gateway: 192.168.2.1
gateway: 192.168.2.1

Loading…
取消
儲存