Преглед изворни кода

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…
Откажи
Сачувај