diff --git a/main.go b/main.go index dcab8512..98564ab5 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,6 @@ import ( "github.com/Scalingo/go-utils/logger/plugins/rollbarplugin" "github.com/Scalingo/link/config" "github.com/Scalingo/link/models" - "github.com/Scalingo/link/network" "github.com/Scalingo/link/scheduler" "github.com/Scalingo/link/web" "github.com/sirupsen/logrus" @@ -32,11 +31,6 @@ func main() { panic(err) } - netInterface, err := network.NewNetworkInterfaceFromName(config.Interface) - if err != nil { - panic(err) - } - storage := models.NewEtcdStorage(config) scheduler := scheduler.NewIPScheduler(config, etcd, storage) @@ -60,7 +54,7 @@ func main() { } } - controller := web.NewIPController(scheduler, netInterface) + controller := web.NewIPController(scheduler) r := handlers.NewRouter(log) if config.User != "" || config.Password != "" { diff --git a/mocks_sig.json b/mocks_sig.json index 34429498..7d5ca469 100644 --- a/mocks_sig.json +++ b/mocks_sig.json @@ -1 +1 @@ -{"github.com/Scalingo/link/api.Client":"62 a2 59 e0 47 34 c7 57 6c ee bf 94 e1 d7 45 65 38 29 f9 54","github.com/Scalingo/link/healthcheck.Checker":"1d f8 80 35 ac c7 d3 08 fd 14 96 d6 26 bd cb fd cf 5f af bc","github.com/Scalingo/link/locker.Locker":"a5 24 96 0f 1b f5 df b8 d8 dd 15 83 a1 d2 b2 d3 53 fa 25 0d","github.com/Scalingo/link/models.Storage":"6c 64 ff a2 f6 e0 72 82 d9 cd 56 6a 64 4b 8d 96 5d fe cd 7e","github.com/Scalingo/link/network.ARP":"20 bb b8 da 57 d8 84 21 24 36 cc 40 34 be f6 c3 e6 e9 f9 78","github.com/Scalingo/link/network.NetworkInterface":"0f c6 8d 68 bd 46 0d 9b 52 80 b5 7c 69 13 c0 dc 8a 44 cc 53","github.com/Scalingo/link/scheduler.Scheduler":"63 e6 1d f4 4a 3b e4 79 f8 98 23 ac 9f 11 91 fa b7 11 26 f6","github.com/coreos/etcd/clientv3.KV":"03 55 dc 9d 49 95 06 33 f3 03 cf d7 5b 47 3a 96 69 93 a2 de","github.com/coreos/etcd/clientv3.Lease":"1a b5 94 5c c5 bb d0 78 62 3e 7f 6d d2 74 aa ae 95 70 93 09","github.com/coreos/etcd/clientv3.Txn":"ed f4 4b 6f bf c7 79 91 fe a6 b9 5e 6d 1e 34 a0 6a 10 4d 51"} \ No newline at end of file +{"github.com/Scalingo/link/api.Client":"56 fe 67 7b 99 0f 7b 6c cb 88 8c 20 a2 a1 84 26 6c 5a b1 f8","github.com/Scalingo/link/healthcheck.Checker":"1d f8 80 35 ac c7 d3 08 fd 14 96 d6 26 bd cb fd cf 5f af bc","github.com/Scalingo/link/locker.Locker":"a5 24 96 0f 1b f5 df b8 d8 dd 15 83 a1 d2 b2 d3 53 fa 25 0d","github.com/Scalingo/link/models.Storage":"6c 64 ff a2 f6 e0 72 82 d9 cd 56 6a 64 4b 8d 96 5d fe cd 7e","github.com/Scalingo/link/network.ARP":"20 bb b8 da 57 d8 84 21 24 36 cc 40 34 be f6 c3 e6 e9 f9 78","github.com/Scalingo/link/network.NetworkInterface":"02 61 47 58 85 b3 ce f2 ee 69 f8 58 4b ca cd eb 5b ed f9 3c","github.com/Scalingo/link/scheduler.Scheduler":"63 e6 1d f4 4a 3b e4 79 f8 98 23 ac 9f 11 91 fa b7 11 26 f6","github.com/coreos/etcd/clientv3.KV":"b5 dc 10 4e dc 95 f2 cf 0a 6c e7 c5 ac 0a 47 5f 60 44 31 40","github.com/coreos/etcd/clientv3.Lease":"f2 a5 ea a9 0e 16 01 d7 6c 2b 05 1c f1 e6 5b 1d a5 a2 87 27","github.com/coreos/etcd/clientv3.Txn":"2b d8 86 0c 62 87 e9 d4 e5 71 78 81 ef 89 ec 5a e8 30 43 e1"} \ No newline at end of file diff --git a/network/network.go b/network/network.go index cd13a9fa..8bcf542b 100644 --- a/network/network.go +++ b/network/network.go @@ -6,7 +6,6 @@ import ( ) type NetworkInterface interface { - HasIP(string) (bool, error) EnsureIP(string) error RemoveIP(string) error } @@ -30,15 +29,6 @@ func NewNetworkInterfaceFromName(name string) (networkInterface, error) { }, nil } -func (i networkInterface) HasIP(ip string) (bool, error) { - addr, err := netlink.ParseAddr(ip) - if err != nil { - return false, errors.Wrapf(err, "invalid IP: %s", ip) - } - - return i.hasIP(addr) -} - func (i networkInterface) hasIP(addr *netlink.Addr) (bool, error) { addrs, err := netlink.AddrList(i.link, netlink.FAMILY_ALL) if err != nil { diff --git a/network/networkmock/networkinterface_mock.go b/network/networkmock/networkinterface_mock.go index c953135a..30308184 100644 --- a/network/networkmock/networkinterface_mock.go +++ b/network/networkmock/networkinterface_mock.go @@ -45,19 +45,6 @@ func (mr *MockNetworkInterfaceMockRecorder) EnsureIP(arg0 interface{}) *gomock.C return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnsureIP", reflect.TypeOf((*MockNetworkInterface)(nil).EnsureIP), arg0) } -// HasIP mocks base method -func (m *MockNetworkInterface) HasIP(arg0 string) (bool, error) { - ret := m.ctrl.Call(m, "HasIP", arg0) - ret0, _ := ret[0].(bool) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HasIP indicates an expected call of HasIP -func (mr *MockNetworkInterfaceMockRecorder) HasIP(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasIP", reflect.TypeOf((*MockNetworkInterface)(nil).HasIP), arg0) -} - // RemoveIP mocks base method func (m *MockNetworkInterface) RemoveIP(arg0 string) error { ret := m.ctrl.Call(m, "RemoveIP", arg0)