Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inventory is returning a fact as a float. We were expecting it to be a string. #320

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
)

require (
github.com/atombender/go-jsonschema v0.15.1-0.20240118015147-40f48ce0470e // indirect
github.com/atombender/go-jsonschema v0.15.1-0.20240119115630-8bc07a9849d1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/fatih/color v1.16.0 // indirect
Expand Down Expand Up @@ -84,7 +84,7 @@ require (
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.5.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a // 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
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ github.com/atombender/go-jsonschema v0.14.2-0.20240112180320-6fcc83b8eebe h1:RsH
github.com/atombender/go-jsonschema v0.14.2-0.20240112180320-6fcc83b8eebe/go.mod h1:JqTHPe4S0pVB4LH/CGKJzX+di8cnLwSYkDDXFoOewLw=
github.com/atombender/go-jsonschema v0.15.1-0.20240118015147-40f48ce0470e h1:HYGyiXgVzqcD5o4Tk7VGmwou+/FqmlLwBT62Qt8uCDU=
github.com/atombender/go-jsonschema v0.15.1-0.20240118015147-40f48ce0470e/go.mod h1:2HVikrSiZk0Y2+E6qeLQBQypLwpu0K68Y8a2C9Snc+w=
github.com/atombender/go-jsonschema v0.15.1-0.20240119115630-8bc07a9849d1 h1:rlcsPLlEWYiDxt1r1bHBfDQraV5IMvi4sgNOM9nyoUc=
github.com/atombender/go-jsonschema v0.15.1-0.20240119115630-8bc07a9849d1/go.mod h1:/+2LNadsDUmKibSR+qfKXzCiuMZEDpDYQpjK9wFvfvc=
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=
Expand Down Expand Up @@ -1163,6 +1165,8 @@ golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e h1:723BNChdd0c2Wk6WOE320qGBi
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/exp v0.0.0-20240119083558-1b970713d09a h1:Q8/wZp0KX97QFTc2ywcOE0YRjZPVIx+MXInMzdvQqcA=
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a/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=
Expand Down
17 changes: 14 additions & 3 deletions internal/api/connectors/inventory/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ func getSatelliteFacts(facts *[]FactSet) satelliteFacts {
satelliteOrgID, orgIDExists := fact.Facts["organization_id"]

if idExists {
strigifiedInstanceID := satelliteInstanceID.(string)
strigifiedInstanceID := convertInterfaceToString(satelliteInstanceID)
satelliteFacts.SatelliteInstanceID = &strigifiedInstanceID
}

if versionExists {
stringifiedVersion := satelliteVersion.(string)
stringifiedVersion := convertInterfaceToString(satelliteVersion)
satelliteFacts.SatelliteVersion = &stringifiedVersion
}

if orgIDExists {
stringifiedOrgID := satelliteOrgID.(string)
stringifiedOrgID := convertInterfaceToString(satelliteOrgID)
satelliteFacts.SatelliteOrgID = &stringifiedOrgID
}
}
Expand All @@ -56,6 +56,17 @@ func getSatelliteFacts(facts *[]FactSet) satelliteFacts {
return satelliteFacts
}

func convertInterfaceToString(v interface{}) string {
switch result := v.(type) {
case float64:
return fmt.Sprintf("%f", result)
case string:
return v.(string)
default:
return ""
}
}

func createHostGetHostByIdParams(orderBy string, orderHow string) *ApiHostGetHostByIdParams {
orderByParam := OrderByParam(orderBy)
orderHowParam := OrderHowParam(OrderHowParam_ASC)
Expand Down
Loading