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

🐛 switch providers after CLI parsing #2168

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Conversation

arlimus
Copy link
Member

@arlimus arlimus commented Oct 10, 2023

Early runtime checks can cause providers to switch. For example: A user may start with the aws provider, but really want to user the os provider to scan an instance in AWS:

cnquery shell aws ec2 instance-connect ec2-user@i-1234abc --region us-east-1 --profile home

In the above example, we use the aws provider to parse the CLI. However, after that it's all about handing off the actual asset to the os provider to execute the scan.

Related to #2166

Early runtime checks can cause providers to switch. For example: A user
may start with the `aws` provider, but really want to user the `os`
provider to scan an instance in AWS:

```bash
cnquery shell aws ec2 instance-connect ec2-user@i-1234abc --region us-east-1 --profile home
```

In the above example, we use the `aws` provider to parse the CLI.
However, after that it's all about handing off the actual asset to the
`os` provider to execute the scan.

Signed-off-by: Dominik Richter <[email protected]>
@arlimus arlimus requested a review from vjeffrey October 10, 2023 22:40
Copy link
Contributor

@vjeffrey vjeffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[10/10/23 16:44:30] ❯ go run apps/cnquery/cnquery.go shell aws ec2 instance-connect ec2-user@i-06a663a52ab28ca41 --region us-east-1 --profile home
→ no Mondoo configuration file provided, using defaults
→ connected to Amazon Linux 2023
  ___ _ __   __ _ _   _  ___ _ __ _   _
 / __| '_ \ / _` | | | |/ _ \ '__| | | |
| (__| | | | (_| | |_| |  __/ |  | |_| |
 \___|_| |_|\__, |\__,_|\___|_|   \__, |
  mondoo™      |_|                |___/  interactive shell

cnquery> asset { * }
1 error occurred:
	* To use this resource, you must authenticate with Mondoo Platform.
To learn how, read:
https://mondoo.com/docs/cnspec/cnspec-adv-install/registration/
asset: {
  kind: "baremetal"
  build: ""
  version: "2023"
  title: "Amazon Linux 2023, bare metal"
  ...

@vjeffrey
Copy link
Contributor

this is working great, thank you!

@vjeffrey vjeffrey merged commit 9da2623 into main Oct 10, 2023
10 checks passed
@vjeffrey vjeffrey deleted the dom/provider-runtime branch October 10, 2023 22:46
@github-actions github-actions bot locked and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants