diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-08-17 18:23:45 -0700 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-08-17 18:23:45 -0700 |
commit | fb51829bb0331dff762fd558d75ddc08154b010d (patch) | |
tree | 93d3f54e335661b573fe0a71e512034bcd3749c7 | |
parent | 89e458ec902617b04898be427d2b6546e91de460 (diff) | |
download | vyatta-op-firewall-fb51829bb0331dff762fd558d75ddc08154b010d.tar.gz vyatta-op-firewall-fb51829bb0331dff762fd558d75ddc08154b010d.zip |
remove low-level config dir usage
21 files changed, 79 insertions, 31 deletions
diff --git a/templates/clear/firewall/ipv6-modify/node.tag/node.def b/templates/clear/firewall/ipv6-modify/node.tag/node.def index 521953c..693c0ae 100644 --- a/templates/clear/firewall/ipv6-modify/node.tag/node.def +++ b/templates/clear/firewall/ipv6-modify/node.tag/node.def @@ -1,2 +1,4 @@ help: Clear firewall rules for a given chain -allowed: ls /opt/vyatta/config/active/firewall/ipv6-modify/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall ipv6-modify))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/ipv6-modify/node.tag/rule/node.tag/node.def b/templates/clear/firewall/ipv6-modify/node.tag/rule/node.tag/node.def index dc954f5..f777438 100644 --- a/templates/clear/firewall/ipv6-modify/node.tag/rule/node.tag/node.def +++ b/templates/clear/firewall/ipv6-modify/node.tag/rule/node.tag/node.def @@ -1,2 +1,5 @@ help: Clear firewall statistics for given rule -allowed: ls /opt/vyatta/config/active/firewall/ipv6-modify/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-modify ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/ipv6-name/node.tag/node.def b/templates/clear/firewall/ipv6-name/node.tag/node.def index b35fe00..1019010 100644 --- a/templates/clear/firewall/ipv6-name/node.tag/node.def +++ b/templates/clear/firewall/ipv6-name/node.tag/node.def @@ -1,2 +1,4 @@ help: Clear firewall rules for a given chain -allowed: ls /opt/vyatta/config/active/firewall/ipv6-name/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall ipv6-name))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/ipv6-name/node.tag/rule/node.tag/node.def b/templates/clear/firewall/ipv6-name/node.tag/rule/node.tag/node.def index f740f57..2798002 100644 --- a/templates/clear/firewall/ipv6-name/node.tag/rule/node.tag/node.def +++ b/templates/clear/firewall/ipv6-name/node.tag/rule/node.tag/node.def @@ -1,2 +1,5 @@ help: Clear firewall statistics for given rule -allowed: ls /opt/vyatta/config/active/firewall/ipv6-name/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-name ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/modify/node.tag/node.def b/templates/clear/firewall/modify/node.tag/node.def index 458fcb7..748872d 100644 --- a/templates/clear/firewall/modify/node.tag/node.def +++ b/templates/clear/firewall/modify/node.tag/node.def @@ -1,2 +1,4 @@ help: Clear firewall rules for a given chain -allowed: ls /opt/vyatta/config/active/firewall/modify/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall modify))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/modify/node.tag/rule/node.tag/node.def b/templates/clear/firewall/modify/node.tag/rule/node.tag/node.def index 80a0676..6682b94 100644 --- a/templates/clear/firewall/modify/node.tag/rule/node.tag/node.def +++ b/templates/clear/firewall/modify/node.tag/rule/node.tag/node.def @@ -1,2 +1,5 @@ help: Clear firewall statistics for given rule -allowed: ls /opt/vyatta/config/active/firewall/modify/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall modify ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/name/node.tag/node.def b/templates/clear/firewall/name/node.tag/node.def index 1411a83..e02731a 100644 --- a/templates/clear/firewall/name/node.tag/node.def +++ b/templates/clear/firewall/name/node.tag/node.def @@ -1,2 +1,4 @@ help: Clear firewall rules for a given chain -allowed: ls /opt/vyatta/config/active/firewall/name/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall name))" + echo -n ${vals[@]} diff --git a/templates/clear/firewall/name/node.tag/rule/node.tag/node.def b/templates/clear/firewall/name/node.tag/rule/node.tag/node.def index 1830c94..0ac97ec 100644 --- a/templates/clear/firewall/name/node.tag/rule/node.tag/node.def +++ b/templates/clear/firewall/name/node.tag/rule/node.tag/node.def @@ -1,2 +1,5 @@ help: Clear firewall statistics for given rule -allowed: ls /opt/vyatta/config/active/firewall/name/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall name ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} diff --git a/templates/show/firewall/group/node.tag/node.def b/templates/show/firewall/group/node.tag/node.def index 85ebdc0..a819b48 100644 --- a/templates/show/firewall/group/node.tag/node.def +++ b/templates/show/firewall/group/node.tag/node.def @@ -1,7 +1,11 @@ help: Show IPv4 firewall group -allowed: local -a array - array=( /opt/vyatta/config/active/firewall/group/*/* ) - echo -n ${array[@]##*/} +allowed: local -a gtypes + local -a nodes + eval "gtypes=($(cli-shell-api listActiveNodes firewall group))" + for g in "${gtypes[@]}"; do + eval "nodes=($(cli-shell-api listActiveNodes firewall group $g))" + echo -n "${nodes[@]}" ' ' + done run: sudo /opt/vyatta/sbin/vyatta-ipset.pl --action=show-set-members --set-name="$4" diff --git a/templates/show/firewall/ipv6-modify/node.tag/detail/rule/node.tag/node.def b/templates/show/firewall/ipv6-modify/node.tag/detail/rule/node.tag/node.def index e2cf0a6..9fcb7a1 100644 --- a/templates/show/firewall/ipv6-modify/node.tag/detail/rule/node.tag/node.def +++ b/templates/show/firewall/ipv6-modify/node.tag/detail/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show detailed information for specified IPv6 firewall modify rule -allowed: ls /opt/vyatta/config/active/firewall/ipv6-modify/${COMP_WORDS[COMP_CWORD-3]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-modify ${COMP_WORDS[COMP_CWORD-3]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall_detail.xsl "$7" diff --git a/templates/show/firewall/ipv6-modify/node.tag/node.def b/templates/show/firewall/ipv6-modify/node.tag/node.def index 5fea204..d184b97 100644 --- a/templates/show/firewall/ipv6-modify/node.tag/node.def +++ b/templates/show/firewall/ipv6-modify/node.tag/node.def @@ -1,7 +1,7 @@ help: Show rules for given IPv6 firewall modify chain -allowed: - l1=`ls /opt/vyatta/config/active/firewall/ipv6-modify/ 2>/dev/null` - echo $l1 +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall ipv6-modify))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl diff --git a/templates/show/firewall/ipv6-modify/node.tag/rule/node.tag/node.def b/templates/show/firewall/ipv6-modify/node.tag/rule/node.tag/node.def index 3fff5e7..d0aa3db 100644 --- a/templates/show/firewall/ipv6-modify/node.tag/rule/node.tag/node.def +++ b/templates/show/firewall/ipv6-modify/node.tag/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show summary of IPv6 firewall modify rules -allowed: ls /opt/vyatta/config/active/firewall/ipv6-modify/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-modify ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl "$6" diff --git a/templates/show/firewall/ipv6-name/node.tag/detail/rule/node.tag/node.def b/templates/show/firewall/ipv6-name/node.tag/detail/rule/node.tag/node.def index 8ace257..c231a40 100644 --- a/templates/show/firewall/ipv6-name/node.tag/detail/rule/node.tag/node.def +++ b/templates/show/firewall/ipv6-name/node.tag/detail/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show detailed information for specified IPv6 firewall rule -allowed: ls /opt/vyatta/config/active/firewall/ipv6-name/${COMP_WORDS[COMP_CWORD-3]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-name ${COMP_WORDS[COMP_CWORD-3]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall_detail.xsl "$7" diff --git a/templates/show/firewall/ipv6-name/node.tag/node.def b/templates/show/firewall/ipv6-name/node.tag/node.def index d59127c..50597fa 100644 --- a/templates/show/firewall/ipv6-name/node.tag/node.def +++ b/templates/show/firewall/ipv6-name/node.tag/node.def @@ -1,7 +1,7 @@ help: Show rules for given IPv6 firewall chain -allowed: - l1=`ls /opt/vyatta/config/active/firewall/ipv6-name/ 2>/dev/null` - echo $l1 +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall ipv6-name))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl diff --git a/templates/show/firewall/ipv6-name/node.tag/rule/node.tag/node.def b/templates/show/firewall/ipv6-name/node.tag/rule/node.tag/node.def index 7870797..ee73ee7 100644 --- a/templates/show/firewall/ipv6-name/node.tag/rule/node.tag/node.def +++ b/templates/show/firewall/ipv6-name/node.tag/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show summary of IPv6 firewall rules -allowed: ls /opt/vyatta/config/active/firewall/ipv6-name/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall ipv6-name ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl "$6" diff --git a/templates/show/firewall/modify/node.tag/detail/rule/node.tag/node.def b/templates/show/firewall/modify/node.tag/detail/rule/node.tag/node.def index bc451e3..c69f5ac 100644 --- a/templates/show/firewall/modify/node.tag/detail/rule/node.tag/node.def +++ b/templates/show/firewall/modify/node.tag/detail/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show detailed information for specified IPv4 firewall modify rule -allowed: ls /opt/vyatta/config/active/firewall/modify/${COMP_WORDS[COMP_CWORD-3]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall modify ${COMP_WORDS[COMP_CWORD-3]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall_detail.xsl "$7" diff --git a/templates/show/firewall/modify/node.tag/node.def b/templates/show/firewall/modify/node.tag/node.def index 1bdce47..bdae565 100644 --- a/templates/show/firewall/modify/node.tag/node.def +++ b/templates/show/firewall/modify/node.tag/node.def @@ -1,7 +1,7 @@ help: Show rules for given IPv4 firewall modify chain -allowed: - l1=`ls /opt/vyatta/config/active/firewall/modify/ 2>/dev/null` - echo $l1 +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall modify))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl diff --git a/templates/show/firewall/modify/node.tag/rule/node.tag/node.def b/templates/show/firewall/modify/node.tag/rule/node.tag/node.def index be74324..d6cae43 100644 --- a/templates/show/firewall/modify/node.tag/rule/node.tag/node.def +++ b/templates/show/firewall/modify/node.tag/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show summary of IPv4 firewall modify rules -allowed: ls /opt/vyatta/config/active/firewall/modify/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall modify ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl "$6" diff --git a/templates/show/firewall/name/node.tag/detail/rule/node.tag/node.def b/templates/show/firewall/name/node.tag/detail/rule/node.tag/node.def index 8b6adc2..55ae0d6 100644 --- a/templates/show/firewall/name/node.tag/detail/rule/node.tag/node.def +++ b/templates/show/firewall/name/node.tag/detail/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show detailed information for specified IPv4 firewall rule -allowed: ls /opt/vyatta/config/active/firewall/name/${COMP_WORDS[COMP_CWORD-3]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall name ${COMP_WORDS[COMP_CWORD-3]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall_detail.xsl "$7" diff --git a/templates/show/firewall/name/node.tag/node.def b/templates/show/firewall/name/node.tag/node.def index 0557c38..09ac2e2 100644 --- a/templates/show/firewall/name/node.tag/node.def +++ b/templates/show/firewall/name/node.tag/node.def @@ -1,7 +1,7 @@ help: Show rules for given IPv4 firewall chain -allowed: - l1=`ls /opt/vyatta/config/active/firewall/name/ 2>/dev/null` - echo $l1 +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes firewall name))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl diff --git a/templates/show/firewall/name/node.tag/rule/node.tag/node.def b/templates/show/firewall/name/node.tag/rule/node.tag/node.def index 6a21197..9e00b38 100644 --- a/templates/show/firewall/name/node.tag/rule/node.tag/node.def +++ b/templates/show/firewall/name/node.tag/rule/node.tag/node.def @@ -1,5 +1,8 @@ help: Show summary of IPv4 firewall rules -allowed: ls /opt/vyatta/config/active/firewall/name/${COMP_WORDS[COMP_CWORD-2]}/rule/ 2>/dev/null +allowed: local -a vals + eval "vals=($(cli-shell-api listActiveNodes \ + firewall name ${COMP_WORDS[COMP_CWORD-2]} rule))" + echo -n ${vals[@]} run: ${vyatta_bindir}/vyatta-show-firewall.pl "$3_$4" /opt/vyatta/share/xsl/show_firewall.xsl "$6" |