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

service_account_scopes nilclass #227

Merged
merged 3 commits into from
Jan 21, 2020
Merged

service_account_scopes nilclass #227

merged 3 commits into from
Jan 21, 2020

Conversation

bgeesaman
Copy link

@bgeesaman bgeesaman commented Jan 16, 2020

Description

If a google_compute_instance has no service account scopes assigned, the following logic:

    describe "[#{gcp_project_id}] Instance #{instance[:zone]}/#{instance[:name]}" do
      subject { google_compute_instance(project: gcp_project_id, zone: instance[:zone], name: instance[:name]) }
      its('service_account_scopes') { should_not include 'https://www.googleapis.com/auth/cloud-platform' }
    end

causes:

     ×  [my-project] Instance us-central1-f/my-instance service_account_scopes 
     undefined method `[]' for nil:NilClass

This adds a quick check to see if that dynamic method is available before seeing what's in the array.

Issues Resolved

N/A

@bgeesaman bgeesaman requested a review from a team as a code owner January 16, 2020 21:10
Brad Geesaman added 2 commits January 16, 2020 16:12
Signed-off-by: Brad Geesaman <bgeesaman@google.com>
…n/inspec-gcp into service_account_scopes-nilclass
Copy link

@skpaterson skpaterson left a comment

Choose a reason for hiding this comment

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

Thanks for this @bgeesaman !

@skpaterson skpaterson merged commit 384cc43 into inspec:master Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants