Properly implement Insert for fake enc
				
					
				
			This commit is contained in:
		| @@ -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 | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user