update PC-SDK calls to new function (status still broken)

This commit is contained in:
schulze 2023-05-03 13:28:29 +02:00
parent 268824fb91
commit 9fa99118d5
2 changed files with 6 additions and 8 deletions

View File

@ -96,14 +96,13 @@ func indexAllInstances(config state.Config) state.Config {
func createTunnels(config state.Config) {
for serviceUUID, service := range config.MTD.Services {
if service.AdminEnabled && service.Active {
s := pcsdk.NewCommandStatus()
err := s.Execute(netip.AddrPortFrom(service.EntryIP, config.MTD.ManagementPort))
proxy := pcsdk.BuildProxy(netip.AddrPortFrom(service.EntryIP, config.MTD.ManagementPort))
err := proxy.Status()
if err != nil {
continue
}
// Reconfigure Proxy to new instance
c := pcsdk.NewCommandCreate(service.EntryPort, service.ServicePort, service.ServiceIP, serviceUUID)
err = c.Execute(netip.AddrPortFrom(service.EntryIP, config.MTD.ManagementPort))
err = proxy.Create(service.EntryPort, service.ServicePort, service.ServiceIP, serviceUUID)
if err != nil {
continue
}

View File

@ -31,8 +31,8 @@ func AWSMoveInstance(config state.Config) (state.Config) {
// Test Proxy Connection
t := time.Now()
s := pcsdk.NewCommandStatus()
err := s.Execute(netip.AddrPortFrom(instance.EntryIP, config.MTD.ManagementPort))
proxy := pcsdk.BuildProxy(netip.AddrPortFrom(instance.EntryIP, config.MTD.ManagementPort))
err := proxy.Status()
if err != nil {
fmt.Printf("error executing test command: %s\n", err)
return config
@ -93,8 +93,7 @@ func AWSMoveInstance(config state.Config) (state.Config) {
// Reconfigure Proxy to new instance
t = time.Now()
m := pcsdk.NewCommandModify(config.MTD.Services[serviceUUID].ServicePort, config.MTD.Services[serviceUUID].ServiceIP, serviceUUID)
err = m.Execute(netip.AddrPortFrom(config.MTD.Services[serviceUUID].EntryIP, config.MTD.ManagementPort))
err = proxy.Modify(config.MTD.Services[serviceUUID].ServicePort, config.MTD.Services[serviceUUID].ServiceIP, serviceUUID)
if err != nil {
fmt.Printf("error executing modify command: %s\n", err)
return config