Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
b2f0c03d
Commit
b2f0c03d
authored
Oct 02, 2020
by
Francesc Guasch
Browse files
refactor(test): best way to clean iptables
issue #1324
parent
3aade061
Changes
1
Hide whitespace changes
Inline
Side-by-side
t/lib/Test/Ravada.pm
View file @
b2f0c03d
...
...
@@ -1193,8 +1193,24 @@ sub _unlock_all {
}
}
sub
_clean_iptables_ravada
($node) {
my
(
$out
,
$err
)
=
$node
->
run_command
("
iptables-save
","
-t
","
filter
");
is
(
$err
,'');
for
my
$line
(
split
/\n/
,
$out
)
{
my
(
$rule
)
=
$line
=~
/-A (.*RAVADA.*)/i
;
next
if
!
$rule
;
if
(
!
$node
->
is_local
)
{
my
(
$out2
,
$err2
)
=
$node
->
run_command
("
iptables
","
-t
","
filter
","
-D
",
$rule
);
warn
$node
->
name
.
"
: '-D
$rule
'
$err2
"
if
$err2
;
}
else
{
`
iptables -D
$rule
`;
}
}
}
sub
flush_rules_node
($node) {
_lock_fw
();
_clean_iptables_ravada
(
$node
);
$node
->
create_iptables_chain
(
$CHAIN
);
my
(
$out
,
$err
)
=
$node
->
run_command
("
iptables
","
-F
",
$CHAIN
);
is
(
$err
,'');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment