Properly implement Insert
for fake enc
This commit is contained in:
parent
46cdd6c60c
commit
e7743f4fa8
@ -55,8 +55,12 @@ func (f *fakeClient) Insert(table, chain string, pos int, spec ...string) error
|
|||||||
if exists {
|
if exists {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// FIXME obey pos!
|
index := pos - 1 // iptables are 1-based
|
||||||
f.storage = append([]Rule{&rule{table: table, chain: chain, spec: spec}}, f.storage...)
|
rule := &rule{table: table, chain: chain, spec: spec}
|
||||||
|
prefix := append([]Rule{}, f.storage[:index]...)
|
||||||
|
suffix := append([]Rule{}, f.storage[index:]...)
|
||||||
|
prefix = append(prefix, rule)
|
||||||
|
f.storage = append(prefix, suffix...)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user