-
Notifications
You must be signed in to change notification settings - Fork 24
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
✨ Set asset.kind
to virtualmachine
when in cloud
#5267
Conversation
Signed-off-by: Salim Afiune Maya <[email protected]>
72cfe53
to
25e7f47
Compare
@@ -29,16 +29,25 @@ var detectors = []detectorFunc{ | |||
gcp.Detect, | |||
} | |||
|
|||
const AssetKind = "virtualmachine" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets find a better name for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shared kinds probably belong into the provider sdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move it into platform.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't put it there since we will have a cyclical dependency, but I think it would be a great idea to move these constants (for the near future) into the actual inventory
package.
I think we will benefit from using them in the backend.
type detectResult struct { | ||
platformId string | ||
platformName string | ||
relatedPlatformIds []string | ||
} | ||
|
||
func Detect(conn shared.Connection, p *inventory.Platform) (PlatformID, PlatformName, []RelatedPlatformID) { | ||
type PlatformInfo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add comments
mgr, err := smbios.ResolveManager(conn, p) | ||
if err != nil { | ||
return "", "", nil | ||
return PlatformInfo{"", "", "", nil} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this return nil? But we need to check the error handling on the other side.
…kind/virtual_machine
Signed-off-by: Salim Afiune Maya <[email protected]>
eff89a2
to
55c17ea
Compare
Signed-off-by: Salim Afiune Maya <[email protected]>
…kind/virtual_machine
providers/aws/connection/platform.go
Outdated
@@ -14,7 +16,7 @@ func GetPlatformForObject(platformName string, accountId string) *inventory.Plat | |||
return &inventory.Platform{ | |||
Name: platformName, | |||
Title: getTitleForPlatformName(platformName), | |||
Kind: "aws-object", | |||
Kind: getPlatformKind(platformName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be reverted. We only want to label os scans.
Signed-off-by: Salim Afiune Maya <[email protected]>
…kind/virtual_machine
Signed-off-by: Salim Afiune Maya <[email protected]>
Signed-off-by: Salim Afiune Maya <[email protected]>
This change consolidates
asset.kind
forvirtualmachine
andbaremetal
.I am proposing having a single file where we define these asset kinds so that we
can later use them in the backend (follow up PR).
We are also changing the kind of an asset if:
How to test this change
cnquery shell
)asset.kind
comes back asvirtualmachine
Alternatively, build the binary locally and connect to an
aws
instance via:Select and asset and check that
asset.kind
comes back asvirtualmachine