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

Add enabled property for gcp.project.dataproc. Only query clusters if… #940

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

preslavgerchev
Copy link
Contributor

… service's enabled (#939)

Fixes #938, the DataProc Cloud service can also be disabled for a project, which means we cannot fetch clusters from it. To fix this, I am adding an enabled field to the service and skipping clusters retrieval if the service is disabled:

On a GCP with DataProc disabled

cnquery> gcp.project.dataproc.enabled
[failed] gcp.project.dataproc.enabled
  expected: == true
  actual:   false

cnquery> gcp.project.dataproc.clusters
! DataProc Cloud API is not enabled, not querying clusters
gcp.project.dataproc.clusters: []

On a GCP with DataProc enabled

cnquery> gcp.project.dataproc.enabled
[ok] value: true

cnquery> gcp.project.dataproc.clusters
gcp.project.dataproc.clusters: []

We should probably do this for all GCP services since most of them can be disabled

  • Test with a cnspec scan

… service's enabled (#939)

Fixes #938, the `DataProc Cloud` service can also be disabled for a
project, which means we cannot fetch clusters from it.
To fix this, I am adding an `enabled` field to the service and skipping
clusters retrieval if the service is disabled:

On a GCP with DataProc disabled
```
cnquery> gcp.project.dataproc.enabled
[failed] gcp.project.dataproc.enabled
  expected: == true
  actual:   false

cnquery> gcp.project.dataproc.clusters
! DataProc Cloud API is not enabled, not querying clusters
gcp.project.dataproc.clusters: []
```

On a GCP with DataProc enabled
```
cnquery> gcp.project.dataproc.enabled
[ok] value: true

cnquery> gcp.project.dataproc.clusters
gcp.project.dataproc.clusters: []
```

We should probably do this for all GCP services since most of them can
be disabled


 - [x] Test with a `cnspec scan`
@preslavgerchev preslavgerchev merged commit 17cec10 into v7 Feb 15, 2023
@preslavgerchev preslavgerchev deleted the preslav/backport-v7-gcp branch February 15, 2023 18:13
@github-actions github-actions bot locked and limited conversation to collaborators Feb 15, 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.

1 participant