From 92069b1338710ba110ed707ac96ad1550f003305 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 16:08:05 -0600 Subject: [PATCH 01/31] Wow --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 906d6e3a..c58cebc8 100644 --- a/README.md +++ b/README.md @@ -528,3 +528,5 @@ Useful commands: install and run linter `make run-lint` + +new line here!! From fb4ec3284ecbc9fea4bfad6508acd10eb76b69b9 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 16:10:34 -0600 Subject: [PATCH 02/31] Testing --- internal/api/connectors/inventory/inventory.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index ac633e84..a70a521f 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -101,6 +101,8 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe }, } + fmt.Printf("*** client: %+v\n", client) + return &inventoryConnectorImpl{ client: client, } From a9e867c7be0f70a6cc51b4d6eb4f0a8b9a0d65dc Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 16:16:07 -0600 Subject: [PATCH 03/31] Testing --- internal/api/connectors/inventory/inventory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index a70a521f..7aab02a8 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -101,7 +101,7 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe }, } - fmt.Printf("*** client: %+v\n", client) + fmt.Printf("*** client.ClientInterface: %+v\n", client.ClientInterface) return &inventoryConnectorImpl{ client: client, From 792a8d62e62cee8e151e82267eb7cd2a57e3c884 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 16:20:54 -0600 Subject: [PATCH 04/31] Testing --- internal/api/connectors/inventory/inventory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 7aab02a8..04befd42 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -12,7 +12,7 @@ import ( "github.com/spf13/viper" ) -const basePath = "/api/inventory/" +const basePath = "/api/inventory/v1/hosts" type inventoryConnectorImpl struct { client ClientWithResponsesInterface From 52638dd8d4c54343be137f8ee7e1012cc14874ac Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 22:50:22 -0600 Subject: [PATCH 05/31] Testing - don't require a PSK for the high level connection status --- internal/api/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/main.go b/internal/api/main.go index 0e992374..3785e7ce 100644 --- a/internal/api/main.go +++ b/internal/api/main.go @@ -127,13 +127,13 @@ func Start( internal.Use(oapiMiddleware.OapiRequestValidator(privateSpec)) // Authorization header not required for GET /internal/version internal.GET("/version", privateController.ApiInternalVersion) + internal.POST("/v2/connection_status", privateController.ApiInternalHighlevelConnectionStatus) internal.Use(middleware.CheckPskAuth(authConfig)) internal.Use(echo.WrapMiddleware(middleware.StoreAPIVersion)) internal.POST("/dispatch", privateController.ApiInternalRunsCreate) internal.POST("/v2/recipients/status", privateController.ApiInternalV2RecipientsStatus) internal.POST("/v2/dispatch", privateController.ApiInternalV2RunsCreate) internal.POST("/v2/cancel", privateController.ApiInternalV2RunsCancel) - internal.POST("/v2/connection_status", privateController.ApiInternalHighlevelConnectionStatus) publicController := public.CreateController(db, cloudConnectorClient) public := server.Group("/api/playbook-dispatcher") From cb9e17dd49f63d428338caf059f78c57c82b6d66 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 23:07:36 -0600 Subject: [PATCH 06/31] adding more debug logging --- internal/api/connectors/inventory/inventory.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 04befd42..019c0bb6 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -93,6 +93,7 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe req.Header.Set(constants.HeaderRequestId, request_id.GetReqID(ctx)) if identity, ok := ctx.Value(constants.HeaderIdentity).(string); ok { + fmt.Printf("*** setting header - %s - %s\n", constants.HeaderIdentity, identity) req.Header.Set(constants.HeaderIdentity, identity) } From cb3eb1ac9caeaebb3d369f84e6a2f221565b19b2 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Thu, 14 Dec 2023 23:20:20 -0600 Subject: [PATCH 07/31] adding more debug logging --- internal/api/connectors/inventory/inventory.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 019c0bb6..43711000 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -92,6 +92,7 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe RequestEditor: func(ctx context.Context, req *http.Request) error { req.Header.Set(constants.HeaderRequestId, request_id.GetReqID(ctx)) + fmt.Printf("*** inside request editor") if identity, ok := ctx.Value(constants.HeaderIdentity).(string); ok { fmt.Printf("*** setting header - %s - %s\n", constants.HeaderIdentity, identity) req.Header.Set(constants.HeaderIdentity, identity) From 8baf2f3d48abe0fd73d397b58294a098742ecd8a Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 08:30:14 -0600 Subject: [PATCH 08/31] Try to require the identity header and store it in the request context --- internal/api/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/main.go b/internal/api/main.go index 3785e7ce..4e04ad3f 100644 --- a/internal/api/main.go +++ b/internal/api/main.go @@ -127,7 +127,7 @@ func Start( internal.Use(oapiMiddleware.OapiRequestValidator(privateSpec)) // Authorization header not required for GET /internal/version internal.GET("/version", privateController.ApiInternalVersion) - internal.POST("/v2/connection_status", privateController.ApiInternalHighlevelConnectionStatus) + internal.POST("/v2/connection_status", privateController.ApiInternalHighlevelConnectionStatus, echo.WrapMiddleware(identity.EnforceIdentity), middleware.ExtractHeaders(constants.HeaderIdentity)) internal.Use(middleware.CheckPskAuth(authConfig)) internal.Use(echo.WrapMiddleware(middleware.StoreAPIVersion)) internal.POST("/dispatch", privateController.ApiInternalRunsCreate) From 6c19792b79b2d8e25aa69a750da129a6391e3b7d Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 14:50:52 -0600 Subject: [PATCH 09/31] More debugging --- deploy/clowdapp.yaml | 4 ++++ go.mod | 10 ++++++-- go.sum | 24 +++++++++++++++++++ .../api/connectors/inventory/inventory.gen.go | 1 + 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/deploy/clowdapp.yaml b/deploy/clowdapp.yaml index f3d7033d..a2b3bc13 100644 --- a/deploy/clowdapp.yaml +++ b/deploy/clowdapp.yaml @@ -168,6 +168,10 @@ objects: value: ${INVENTORY_CONNECTOR_HOST} - name: INVENTORY_CONNECTOR_PORT value: ${INVENTORY_CONNECTOR_PORT} + - name: INVENTORY_CONNECTOR_ORDERED_HOW + value: "ASC" + - name: INVENTORY_CONNECTOR_ORDERED_BY + value: "display_name" - name: SOURCES_CONNECTOR_IMPL value: ${SOURCES_CONNECTOR_IMPL} diff --git a/go.mod b/go.mod index c345fd7c..4da3bfbc 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/qri-io/jsonschema v0.2.0 github.com/redhatinsights/app-common-go v1.6.2 github.com/redhatinsights/platform-go-middlewares v0.17.0 - github.com/spf13/cobra v1.0.0 + github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.7.1 github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 go.uber.org/zap v1.10.0 @@ -31,17 +31,20 @@ require ( ) require ( + github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/fatih/color v1.13.0 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/swag v0.19.5 // indirect + github.com/goccy/go-yaml v1.11.2 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/chunkreader/v2 v2.0.1 // indirect github.com/jackc/pgconn v1.8.0 // indirect github.com/jackc/pgio v1.0.0 // indirect @@ -53,6 +56,7 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b // indirect github.com/labstack/gommon v0.4.0 // indirect github.com/lib/pq v1.10.0 // indirect github.com/magiconair/properties v1.8.1 // indirect @@ -60,6 +64,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.17 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/pelletier/go-toml v1.8.1 // indirect @@ -67,6 +72,7 @@ require ( github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect github.com/qri-io/jsonpointer v0.1.1 // indirect + github.com/sanity-io/litter v1.5.5 // indirect github.com/spf13/afero v1.2.2 // indirect github.com/spf13/cast v1.3.0 // indirect github.com/spf13/jwalterweatherman v1.0.0 // indirect diff --git a/go.sum b/go.sum index e2957d5b..a296a383 100644 --- a/go.sum +++ b/go.sum @@ -109,6 +109,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c h1:PiewfwkLThFaGs2TgsAZHha7WiECq5k5uddKG5IQkCE= +github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c/go.mod h1:ZC7LrGMdCQI5dvNpxKU8KbLfRJz2rpAyxqiOyTJT4n8= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.34.2/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= @@ -291,6 +293,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= @@ -300,6 +303,7 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s= github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8= github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I= +github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -347,6 +351,8 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -425,6 +431,8 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= +github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= github.com/gocql/gocql v0.0.0-20210515062232-b7ef815b4556/go.mod h1:DL0ekTmBSTdlNF25Orwt/JMzqIq3EJ4MVa/J/uK64OY= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= @@ -592,6 +600,8 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/j-keck/arping v0.0.0-20160618110441-2cf9dc699c56/go.mod h1:ymszkNOg6tORTn+6F6j+Jc8TOr5osrynvN6ivFWZ2GA= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= @@ -705,6 +715,8 @@ github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq19sBYvuMoyQ4= +github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b h1:yhv01T9j1k7K/DsNkukw1CMv+KjdPaMGpkn9AykaGXc= +github.com/kulshekhar/fungen v0.0.0-20180224173454-7ed9e430524b/go.mod h1:DUEJ+lstFLzs07dkWsLsEZJtWQcTWAs/4BgfepBMkoI= github.com/labstack/echo/v4 v4.1.10/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M= @@ -736,6 +748,7 @@ github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcncea github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -768,6 +781,8 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= @@ -875,6 +890,7 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -936,9 +952,12 @@ github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= +github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo= +github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= @@ -976,6 +995,8 @@ github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKv github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -994,6 +1015,7 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1123,6 +1145,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 h1:qCEDpW1G+vcj3Y7Fy52pEM1AWm3abj8WimGYejI3SC4= +golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 543eb159..596814ad 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1495,6 +1495,7 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, return nil, err } } + fmt.Println("req:", req) return c.Client.Do(req) } From e31580601a73e11f70294cd724fd32e6cc3268fb Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 15:06:52 -0600 Subject: [PATCH 10/31] Testing --- internal/api/connectors/inventory/inventory.gen.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 596814ad..6d33aec1 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1496,7 +1496,9 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, } } fmt.Println("req:", req) - return c.Client.Do(req) + resp, err := c.Client.Do(req) + fmt.Println("resp:", resp) + return resp, err } func (c *Client) ApiHostPatchByIdWithBody(ctx context.Context, hostIdList HostIdList, params *ApiHostPatchByIdParams, contentType string, body io.Reader) (*http.Response, error) { From dbc54dd91cc189a2b90e78784ceaa2250ff4595e Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 15:15:58 -0600 Subject: [PATCH 11/31] TEsting --- internal/api/connectors/inventory/inventory.gen.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 6d33aec1..5eba3120 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1498,6 +1498,10 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, fmt.Println("req:", req) resp, err := c.Client.Do(req) fmt.Println("resp:", resp) + + bodyBytes, _ := io.ReadAll(resp.Body) + fmt.Println("resp:", string(bodyBytes)) + return resp, err } From e3754fb0989b87419df2f3d4968d43fddd47a1c5 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 15:25:36 -0600 Subject: [PATCH 12/31] More --- internal/api/connectors/inventory/inventory.gen.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 5eba3120..8971acc4 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1497,10 +1497,11 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, } fmt.Println("req:", req) resp, err := c.Client.Do(req) + /* fmt.Println("resp:", resp) - bodyBytes, _ := io.ReadAll(resp.Body) fmt.Println("resp:", string(bodyBytes)) + */ return resp, err } From 04d54d4416892db7e80d4901b1d3da2579f3c003 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 15:30:32 -0600 Subject: [PATCH 13/31] More --- internal/api/connectors/inventory/inventory.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 43711000..0c3422dc 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -130,6 +130,8 @@ func (this *inventoryConnectorImpl) getHostDetails( params := createHostGetHostByIdParams(orderBy, orderHow) response, err := this.client.ApiHostGetHostByIdWithResponse(ctx, IDs, params) + fmt.Println("repsonse: ", response) + fmt.Println("err: ", err) if err != nil { return nil, err From 43ef2173e852a5f0b67b883f08b3c5372d5e72b7 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 15 Dec 2023 15:38:59 -0600 Subject: [PATCH 14/31] More --- internal/api/connectors/inventory/inventory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 0c3422dc..8a69ccaa 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -130,7 +130,7 @@ func (this *inventoryConnectorImpl) getHostDetails( params := createHostGetHostByIdParams(orderBy, orderHow) response, err := this.client.ApiHostGetHostByIdWithResponse(ctx, IDs, params) - fmt.Println("repsonse: ", response) + fmt.Println("repsonse: ", string(response.Body)) fmt.Println("err: ", err) if err != nil { From 40d645df03f57254e4545b60ff44aca16b0bbc6a Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 22:27:29 -0600 Subject: [PATCH 15/31] Closer --- deploy/clowdapp.yaml | 2 +- internal/api/connectors/inventory/inventory.gen.go | 14 +++++++------- internal/api/connectors/inventory/inventory.go | 14 +++++++++----- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/deploy/clowdapp.yaml b/deploy/clowdapp.yaml index a2b3bc13..aeb2c3c9 100644 --- a/deploy/clowdapp.yaml +++ b/deploy/clowdapp.yaml @@ -169,7 +169,7 @@ objects: - name: INVENTORY_CONNECTOR_PORT value: ${INVENTORY_CONNECTOR_PORT} - name: INVENTORY_CONNECTOR_ORDERED_HOW - value: "ASC" + value: "display_name" - name: INVENTORY_CONNECTOR_ORDERED_BY value: "display_name" diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 8971acc4..2a21a21e 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1495,13 +1495,13 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, return nil, err } } - fmt.Println("req:", req) - resp, err := c.Client.Do(req) - /* - fmt.Println("resp:", resp) - bodyBytes, _ := io.ReadAll(resp.Body) - fmt.Println("resp:", string(bodyBytes)) - */ + fmt.Println("req:", req) + resp, err := c.Client.Do(req) + /* + fmt.Println("resp:", resp) + bodyBytes, _ := io.ReadAll(resp.Body) + fmt.Println("resp:", string(bodyBytes)) + */ return resp, err } diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 8a69ccaa..5ebc4c77 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -92,9 +92,9 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe RequestEditor: func(ctx context.Context, req *http.Request) error { req.Header.Set(constants.HeaderRequestId, request_id.GetReqID(ctx)) - fmt.Printf("*** inside request editor") + fmt.Printf("*** inside request editor") if identity, ok := ctx.Value(constants.HeaderIdentity).(string); ok { - fmt.Printf("*** setting header - %s - %s\n", constants.HeaderIdentity, identity) + fmt.Printf("*** setting header - %s - %s\n", constants.HeaderIdentity, identity) req.Header.Set(constants.HeaderIdentity, identity) } @@ -103,7 +103,7 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe }, } - fmt.Printf("*** client.ClientInterface: %+v\n", client.ClientInterface) + fmt.Printf("*** client.ClientInterface: %+v\n", client.ClientInterface) return &inventoryConnectorImpl{ client: client, @@ -130,8 +130,8 @@ func (this *inventoryConnectorImpl) getHostDetails( params := createHostGetHostByIdParams(orderBy, orderHow) response, err := this.client.ApiHostGetHostByIdWithResponse(ctx, IDs, params) - fmt.Println("repsonse: ", string(response.Body)) - fmt.Println("err: ", err) + fmt.Println("repsonse: ", string(response.Body)) + fmt.Println("err: ", err) if err != nil { return nil, err @@ -178,6 +178,10 @@ func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context return nil, err } + if len(hostResults) == 0 { + return nil, nil + } + systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_by, order_how, limit, offset) if err != nil { From 0b781dd5a1d50c501385f5b448fb27a1137fea1f Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 22:28:01 -0600 Subject: [PATCH 16/31] ah, ha...how and by are swapped here --- internal/api/connectors/inventory/inventory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 5ebc4c77..a0fe13c2 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -147,8 +147,8 @@ func (this *inventoryConnectorImpl) getHostDetails( func (this *inventoryConnectorImpl) getSystemProfileDetails( ctx context.Context, IDs []string, - orderBy string, orderHow string, + orderBy string, limit int, offset int, ) (details map[string]HostSystemProfileOut, err error) { From a5d5611b65f6d6de753a0110e7882bd590c78e72 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 22:45:13 -0600 Subject: [PATCH 17/31] Trying to figure out if system profile call is working --- internal/api/connectors/inventory/inventory.gen.go | 3 +++ internal/api/connectors/inventory/inventory.go | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 2a21a21e..cdc4468c 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1608,6 +1608,9 @@ func (c *Client) ApiHostGetHostSystemProfileById(ctx context.Context, hostIdList return nil, err } } + + fmt.Println("req:", req) + return c.Client.Do(req) } diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index a0fe13c2..0ce4baee 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -121,8 +121,8 @@ func NewInventoryClient(cfg *viper.Viper) InventoryConnector { func (this *inventoryConnectorImpl) getHostDetails( ctx context.Context, IDs []string, - orderBy string, orderHow string, + orderBy string, limit int, offset int, ) (details []HostOut, err error) { @@ -157,6 +157,9 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( response, err := this.client.ApiHostGetHostSystemProfileByIdWithResponse(ctx, IDs, params) + fmt.Println("system profile response: ", response) + fmt.Println("system profile err: ", err) + if err != nil { return nil, err } @@ -182,7 +185,7 @@ func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context return nil, nil } - systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_by, order_how, limit, offset) + systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_how, order_by, limit, offset) if err != nil { return nil, err From c9af27f61cda558c2d7a87c6fc44d4b28709c524 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 23:01:43 -0600 Subject: [PATCH 18/31] My simple caveman brain can't keep the orderBy vs orderHow straight. They are both strings so the compiler can't catch us/help us when these get reversed. We could make this separate type defs to help with that. Looks like orderBy should be first in the arg list...so that's what i'm trying to go with. --- deploy/clowdapp.yaml | 2 +- internal/api/connectors/inventory/inventory.go | 10 +++++----- .../controllers/private/highlevelConnectionStatus.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/deploy/clowdapp.yaml b/deploy/clowdapp.yaml index aeb2c3c9..a2b3bc13 100644 --- a/deploy/clowdapp.yaml +++ b/deploy/clowdapp.yaml @@ -169,7 +169,7 @@ objects: - name: INVENTORY_CONNECTOR_PORT value: ${INVENTORY_CONNECTOR_PORT} - name: INVENTORY_CONNECTOR_ORDERED_HOW - value: "display_name" + value: "ASC" - name: INVENTORY_CONNECTOR_ORDERED_BY value: "display_name" diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 0ce4baee..6656a02f 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -121,8 +121,8 @@ func NewInventoryClient(cfg *viper.Viper) InventoryConnector { func (this *inventoryConnectorImpl) getHostDetails( ctx context.Context, IDs []string, - orderHow string, orderBy string, + orderHow string, limit int, offset int, ) (details []HostOut, err error) { @@ -147,8 +147,8 @@ func (this *inventoryConnectorImpl) getHostDetails( func (this *inventoryConnectorImpl) getSystemProfileDetails( ctx context.Context, IDs []string, - orderHow string, orderBy string, + orderHow string, limit int, offset int, ) (details map[string]HostSystemProfileOut, err error) { @@ -173,9 +173,9 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( return formatedResults, nil } -func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context, IDs []string, order_how string, order_by string, limit int, offset int) (details []HostDetails, err error) { +func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context, IDs []string, order_by string, order_how string, limit int, offset int) (details []HostDetails, err error) { - hostResults, err := this.getHostDetails(ctx, IDs, order_how, order_by, limit, offset) + hostResults, err := this.getHostDetails(ctx, IDs, order_by, order_how, limit, offset) if err != nil { return nil, err @@ -185,7 +185,7 @@ func (this *inventoryConnectorImpl) GetHostConnectionDetails(ctx context.Context return nil, nil } - systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_how, order_by, limit, offset) + systemProfileResults, err := this.getSystemProfileDetails(ctx, IDs, order_by, order_how, limit, offset) if err != nil { return nil, err diff --git a/internal/api/controllers/private/highlevelConnectionStatus.go b/internal/api/controllers/private/highlevelConnectionStatus.go index 89e4ffb5..f6c0f5b7 100644 --- a/internal/api/controllers/private/highlevelConnectionStatus.go +++ b/internal/api/controllers/private/highlevelConnectionStatus.go @@ -36,8 +36,8 @@ func (this *controllers) ApiInternalHighlevelConnectionStatus(ctx echo.Context) hostConnectorDetails, err := this.inventoryConnectorClient.GetHostConnectionDetails( ctx.Request().Context(), input.Hosts, - this.config.GetString("inventory.connector.ordered.how"), this.config.GetString("inventory.connector.ordered.by"), + this.config.GetString("inventory.connector.ordered.how"), this.config.GetInt("inventory.connector.limit"), this.config.GetInt("inventory.connector.offset"), ) From 1ad85039df5c2437e9f916a0571a894576af27ac Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 10 Jan 2024 23:05:00 -0600 Subject: [PATCH 19/31] Print the response out in human readable form...because i'm a human and i want to read it --- internal/api/connectors/inventory/inventory.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 6656a02f..bc8dd5e2 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -157,7 +157,7 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( response, err := this.client.ApiHostGetHostSystemProfileByIdWithResponse(ctx, IDs, params) - fmt.Println("system profile response: ", response) + fmt.Println("system profile response: ", string(response)) fmt.Println("system profile err: ", err) if err != nil { From 163f99ab27a93d5ab45459a5bc5b2b597fc3d625 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Fri, 12 Jan 2024 09:07:23 -0600 Subject: [PATCH 20/31] rebased --- go.mod | 3 ++- go.sum | 4 ++++ internal/api/connectors/inventory/inventory.go | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 4da3bfbc..76fff6d2 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( ) require ( - github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c // indirect + github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/fatih/color v1.13.0 // indirect @@ -84,6 +84,7 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.5.0 // indirect golang.org/x/crypto v0.17.0 // indirect + golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.15.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/go.sum b/go.sum index a296a383..309f6386 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c h1:PiewfwkLThFaGs2TgsAZHha7WiECq5k5uddKG5IQkCE= github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c/go.mod h1:ZC7LrGMdCQI5dvNpxKU8KbLfRJz2rpAyxqiOyTJT4n8= +github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4 h1:uo39K0ppKZC7zdbnJGzd/nda9nCRRI5K5GCCIU4Exsc= +github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4/go.mod h1:8NPlb6MYKVe+5PUpG1ol2aLqVq1yZJC6/1OTv4ilQnw= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.34.2/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= @@ -1147,6 +1149,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 h1:qCEDpW1G+vcj3Y7Fy52pEM1AWm3abj8WimGYejI3SC4= golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE= +golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index bc8dd5e2..6656a02f 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -157,7 +157,7 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( response, err := this.client.ApiHostGetHostSystemProfileByIdWithResponse(ctx, IDs, params) - fmt.Println("system profile response: ", string(response)) + fmt.Println("system profile response: ", response) fmt.Println("system profile err: ", err) if err != nil { From 95a2518a2651f5ffaa3ecb371ae4627a20b798f9 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Tue, 16 Jan 2024 11:19:22 -0600 Subject: [PATCH 21/31] Cleanup --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index c58cebc8..906d6e3a 100644 --- a/README.md +++ b/README.md @@ -528,5 +528,3 @@ Useful commands: install and run linter `make run-lint` - -new line here!! From 6be32aab8349506ed9d6d3dfea877b26b7817ba0 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 08:29:31 -0600 Subject: [PATCH 22/31] Trying to fix the tests --- go.mod | 12 +++++++----- go.sum | 18 ++++++++++++++++++ internal/api/connectors/inventory/inventory.go | 4 ++-- .../private/highLevelConnectionStatus_test.go | 3 ++- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 76fff6d2..bf346cc4 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( ) require ( - github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4 // indirect + github.com/atombender/go-jsonschema v0.14.2-0.20240112180320-6fcc83b8eebe // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/fatih/color v1.13.0 // indirect @@ -83,11 +83,13 @@ require ( github.com/valyala/fasttemplate v1.2.2 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.5.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.18.0 // indirect + golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect + golang.org/x/mod v0.14.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.16.0 // indirect golang.org/x/text v0.14.0 // indirect + golang.org/x/tools v0.17.0 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/ini.v1 v1.51.0 // indirect diff --git a/go.sum b/go.sum index 309f6386..e84c44f2 100644 --- a/go.sum +++ b/go.sum @@ -113,6 +113,8 @@ github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c h1:Pie github.com/atombender/go-jsonschema v0.14.2-0.20231214214958-2cee8731362c/go.mod h1:ZC7LrGMdCQI5dvNpxKU8KbLfRJz2rpAyxqiOyTJT4n8= github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4 h1:uo39K0ppKZC7zdbnJGzd/nda9nCRRI5K5GCCIU4Exsc= github.com/atombender/go-jsonschema v0.14.2-0.20240111021801-2623e07d6fb4/go.mod h1:8NPlb6MYKVe+5PUpG1ol2aLqVq1yZJC6/1OTv4ilQnw= +github.com/atombender/go-jsonschema v0.14.2-0.20240112180320-6fcc83b8eebe h1:RsHzL4oUs1TaiW/wVK8iycuirZg4zXH5lrW7Ln6beKo= +github.com/atombender/go-jsonschema v0.14.2-0.20240112180320-6fcc83b8eebe/go.mod h1:JqTHPe4S0pVB4LH/CGKJzX+di8cnLwSYkDDXFoOewLw= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.17.7/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.34.2/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= @@ -1133,6 +1135,8 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= +golang.org/x/crypto v0.18.0 h1:PGVlW0xEltQnzFZ55hkuX5+KLyrMYhHld1YHO4AKcdc= +golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1151,6 +1155,8 @@ golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 h1:qCEDpW1G+vcj3Y7Fy52pEM1AW golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBiPtYx0F0Bbm1kriShfE= golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o= +golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= @@ -1185,6 +1191,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= +golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1247,6 +1255,10 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211013171255-e13a2654a71e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/oauth2 v0.0.0-20180227000427-d7d64896b5ff/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1382,6 +1394,8 @@ golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1474,6 +1488,10 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM= +golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0= +golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc= +golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index 6656a02f..b8263ef7 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -157,8 +157,8 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( response, err := this.client.ApiHostGetHostSystemProfileByIdWithResponse(ctx, IDs, params) - fmt.Println("system profile response: ", response) - fmt.Println("system profile err: ", err) + fmt.Println("system profile response: ", response) + fmt.Println("system profile err: ", err) if err != nil { return nil, err diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index 2eab0d41..4d482f60 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -10,7 +10,8 @@ import ( ) func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequestBody) (*HighLevelRecipientStatus, *ApiInternalHighlevelConnectionStatusResponse) { - resp, err := client.ApiInternalHighlevelConnectionStatus(test.TestContext(), payload) + ctx := common.ContextWithIdentity(test.WithOrgId()) + resp, err := client.ApiInternalHighlevelConnectionStatus(ctx, payload) Expect(err).ToNot(HaveOccurred()) res, err := ParseApiInternalHighlevelConnectionStatusResponse(resp) Expect(err).ToNot(HaveOccurred()) From 9a214f206b62af6d26c0c90ee2c3ad68c6d99629 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 08:34:06 -0600 Subject: [PATCH 23/31] Fingers crossed --- internal/api/tests/private/highLevelConnectionStatus_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index 4d482f60..4a8b7d86 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -4,6 +4,7 @@ import ( "net/http" "playbook-dispatcher/internal/api/controllers/public" "playbook-dispatcher/internal/common/utils/test" + "playbook-dispatcher/internal/api/tests/common" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" From cad9b6a9f46745b89c65346b39b163597b76399c Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 08:43:33 -0600 Subject: [PATCH 24/31] Try this --- internal/api/tests/private/highLevelConnectionStatus_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index 4a8b7d86..c817207f 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -3,15 +3,16 @@ package private import ( "net/http" "playbook-dispatcher/internal/api/controllers/public" - "playbook-dispatcher/internal/common/utils/test" "playbook-dispatcher/internal/api/tests/common" + "playbook-dispatcher/internal/common/utils/test" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequestBody) (*HighLevelRecipientStatus, *ApiInternalHighlevelConnectionStatusResponse) { - ctx := common.ContextWithIdentity(test.WithOrgId()) + orgId := test.WithOrgId() + ctx := common.ContextWithIdentity(orgId()) resp, err := client.ApiInternalHighlevelConnectionStatus(ctx, payload) Expect(err).ToNot(HaveOccurred()) res, err := ParseApiInternalHighlevelConnectionStatusResponse(resp) From 29226bddc74cd3801e26b4b2f0091268b54ddee7 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 09:36:19 -0600 Subject: [PATCH 25/31] This seems to work. Create a local instance of a client that passes the idnetity header along while calling the high level connection status checking endpoint --- .../private/highLevelConnectionStatus_test.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index c817207f..754603ce 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -4,16 +4,22 @@ import ( "net/http" "playbook-dispatcher/internal/api/controllers/public" "playbook-dispatcher/internal/api/tests/common" - "playbook-dispatcher/internal/common/utils/test" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequestBody) (*HighLevelRecipientStatus, *ApiInternalHighlevelConnectionStatusResponse) { - orgId := test.WithOrgId() - ctx := common.ContextWithIdentity(orgId()) - resp, err := client.ApiInternalHighlevelConnectionStatus(ctx, payload) + orgId := "12345" + // Build a test client that passes an identity header because the high + // level interface requires the identity header + identityPassingClient := &Client{ + Server: common.TestServer, + Client: common.TestClient, + RequestEditor: common.TestRequestEditor, + } + ctx := common.ContextWithIdentity(orgId) + resp, err := identityPassingClient.ApiInternalHighlevelConnectionStatus(ctx, payload) Expect(err).ToNot(HaveOccurred()) res, err := ParseApiInternalHighlevelConnectionStatusResponse(resp) Expect(err).ToNot(HaveOccurred()) @@ -24,6 +30,7 @@ func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequest var _ = Describe("high level connection status", func() { It("get status for multiple different recipients", func() { + satID := SatelliteId("bd54e0e9-5310-45be-b107-fd7c96672ce5") satOrgID := SatelliteOrgId("5") satelliteHost := []HostId{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"} From fcefdb587c4e2dd41fdfb0dd4387164e2437a326 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 09:36:50 -0600 Subject: [PATCH 26/31] go fmt --- .../tests/private/highLevelConnectionStatus_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index 754603ce..355000bb 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -11,11 +11,11 @@ import ( func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequestBody) (*HighLevelRecipientStatus, *ApiInternalHighlevelConnectionStatusResponse) { orgId := "12345" - // Build a test client that passes an identity header because the high - // level interface requires the identity header - identityPassingClient := &Client{ - Server: common.TestServer, - Client: common.TestClient, + // Build a test client that passes an identity header because the high + // level interface requires the identity header + identityPassingClient := &Client{ + Server: common.TestServer, + Client: common.TestClient, RequestEditor: common.TestRequestEditor, } ctx := common.ContextWithIdentity(orgId) From 6f187eebefb953439cff450eb98cd7c6f51477bd Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 11:30:54 -0600 Subject: [PATCH 27/31] Cleaning up a bit --- internal/api/connectors/inventory/inventory.gen.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index cdc4468c..15a64087 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1495,14 +1495,6 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, return nil, err } } - fmt.Println("req:", req) - resp, err := c.Client.Do(req) - /* - fmt.Println("resp:", resp) - bodyBytes, _ := io.ReadAll(resp.Body) - fmt.Println("resp:", string(bodyBytes)) - */ - return resp, err } @@ -1608,9 +1600,6 @@ func (c *Client) ApiHostGetHostSystemProfileById(ctx context.Context, hostIdList return nil, err } } - - fmt.Println("req:", req) - return c.Client.Do(req) } From 2bf14b0a1f35a307ec9a5a285ac86b15edc98ad1 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 11:31:51 -0600 Subject: [PATCH 28/31] Cleaning up a bit --- internal/api/connectors/inventory/inventory.gen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/connectors/inventory/inventory.gen.go b/internal/api/connectors/inventory/inventory.gen.go index 15a64087..543eb159 100644 --- a/internal/api/connectors/inventory/inventory.gen.go +++ b/internal/api/connectors/inventory/inventory.gen.go @@ -1495,7 +1495,7 @@ func (c *Client) ApiHostGetHostById(ctx context.Context, hostIdList HostIdList, return nil, err } } - return resp, err + return c.Client.Do(req) } func (c *Client) ApiHostPatchByIdWithBody(ctx context.Context, hostIdList HostIdList, params *ApiHostPatchByIdParams, contentType string, body io.Reader) (*http.Response, error) { From 5669cdd11b19f5b3b35b2ad72eb2c5abc88b42c9 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 11:33:17 -0600 Subject: [PATCH 29/31] Cleaning up a bit --- internal/api/connectors/inventory/inventory.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/internal/api/connectors/inventory/inventory.go b/internal/api/connectors/inventory/inventory.go index b8263ef7..1200dee7 100644 --- a/internal/api/connectors/inventory/inventory.go +++ b/internal/api/connectors/inventory/inventory.go @@ -92,9 +92,7 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe RequestEditor: func(ctx context.Context, req *http.Request) error { req.Header.Set(constants.HeaderRequestId, request_id.GetReqID(ctx)) - fmt.Printf("*** inside request editor") if identity, ok := ctx.Value(constants.HeaderIdentity).(string); ok { - fmt.Printf("*** setting header - %s - %s\n", constants.HeaderIdentity, identity) req.Header.Set(constants.HeaderIdentity, identity) } @@ -103,8 +101,6 @@ func NewInventoryClientWithHttpRequestDoer(cfg *viper.Viper, doer HttpRequestDoe }, } - fmt.Printf("*** client.ClientInterface: %+v\n", client.ClientInterface) - return &inventoryConnectorImpl{ client: client, } @@ -130,8 +126,6 @@ func (this *inventoryConnectorImpl) getHostDetails( params := createHostGetHostByIdParams(orderBy, orderHow) response, err := this.client.ApiHostGetHostByIdWithResponse(ctx, IDs, params) - fmt.Println("repsonse: ", string(response.Body)) - fmt.Println("err: ", err) if err != nil { return nil, err @@ -157,9 +151,6 @@ func (this *inventoryConnectorImpl) getSystemProfileDetails( response, err := this.client.ApiHostGetHostSystemProfileByIdWithResponse(ctx, IDs, params) - fmt.Println("system profile response: ", response) - fmt.Println("system profile err: ", err) - if err != nil { return nil, err } From e9ecd1ae82fa287ac9150fce3917fdefdcf23187 Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 11:38:28 -0600 Subject: [PATCH 30/31] Cleaning up a bit --- deploy/clowdapp.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/deploy/clowdapp.yaml b/deploy/clowdapp.yaml index a2b3bc13..f3d7033d 100644 --- a/deploy/clowdapp.yaml +++ b/deploy/clowdapp.yaml @@ -168,10 +168,6 @@ objects: value: ${INVENTORY_CONNECTOR_HOST} - name: INVENTORY_CONNECTOR_PORT value: ${INVENTORY_CONNECTOR_PORT} - - name: INVENTORY_CONNECTOR_ORDERED_HOW - value: "ASC" - - name: INVENTORY_CONNECTOR_ORDERED_BY - value: "display_name" - name: SOURCES_CONNECTOR_IMPL value: ${SOURCES_CONNECTOR_IMPL} From 0100940d9f6e53acb99da07ec0d8077783f72f7f Mon Sep 17 00:00:00 2001 From: Derek Horton Date: Wed, 17 Jan 2024 11:40:00 -0600 Subject: [PATCH 31/31] Cleaning up a bit --- internal/api/tests/private/highLevelConnectionStatus_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/api/tests/private/highLevelConnectionStatus_test.go b/internal/api/tests/private/highLevelConnectionStatus_test.go index 355000bb..44c50137 100644 --- a/internal/api/tests/private/highLevelConnectionStatus_test.go +++ b/internal/api/tests/private/highLevelConnectionStatus_test.go @@ -30,7 +30,6 @@ func getConnectionStatus(payload ApiInternalHighlevelConnectionStatusJSONRequest var _ = Describe("high level connection status", func() { It("get status for multiple different recipients", func() { - satID := SatelliteId("bd54e0e9-5310-45be-b107-fd7c96672ce5") satOrgID := SatelliteOrgId("5") satelliteHost := []HostId{"c484f980-ab8d-401b-90e7-aa1d4ccf8c0e"}