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

CFINSPEC-269 Adds resource_id group 8 #6107

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

Vasu1105
Copy link
Contributor

@Vasu1105 Vasu1105 commented Jun 2, 2022

Signed-off-by: Vasu1105 vasundhara.jagdale@chef.io

Description

This adds resource_id for the following resources.

  • npm
  • ntp_conf
  • oneget
  • opa_api
  • opa_cli

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New content (non-breaking change)
  • Breaking change (a content change which would break existing functionality or processes)

Checklist:

  • I have read the CONTRIBUTING document.

@Vasu1105 Vasu1105 requested a review from a team as a code owner June 2, 2022 11:40
@Vasu1105 Vasu1105 requested review from Nik08 and ahasunos June 2, 2022 11:40
@netlify
Copy link

netlify bot commented Jun 2, 2022

Deploy Preview for chef-inspec canceled.

Name Link
🔨 Latest commit 5d47334
🔍 Latest deploy log https://app.netlify.com/sites/chef-inspec/deploys/62a05c453d845f00084463c0

@Vasu1105 Vasu1105 force-pushed the vasundhara/group8_resource_ids branch from 720a5e5 to ca7b5cf Compare June 2, 2022 16:11
@Vasu1105 Vasu1105 changed the title CFINSPEC-269 Adds resource_id for few more resources. CFINSPEC-269 Adds resource_id group 8 Jun 3, 2022
@@ -18,6 +24,10 @@ def allow
@content["result"]
end

def resource_id
@url
Copy link
Contributor

Choose a reason for hiding this comment

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

This might lead to nil error since in line 16 @url is initialized as @url = opts[:url] || nil.
Suggested fix: `@nil || "OPA api"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes but there is validation also below that which does not allow URL as nil.

@@ -22,6 +28,10 @@ def allow
@content["result"][0]["expressions"][0]["value"] if @content["result"][0]["expressions"][0]["text"].include?("allow")
end

def resource_id
"#{@policy}:#{@query}"
Copy link
Contributor

Choose a reason for hiding this comment

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

This might lead to nil error too, since in line 17 @policy = opts[:policy] || nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here there is validation.

@Vasu1105 Vasu1105 force-pushed the vasundhara/group8_resource_ids branch 2 times, most recently from d1a2dc7 to e02932b Compare June 6, 2022 06:18
…_cli resource and unit test for the same

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
@Vasu1105 Vasu1105 force-pushed the vasundhara/group8_resource_ids branch from e02932b to 5d47334 Compare June 8, 2022 08:22
@clintoncwolfe clintoncwolfe merged commit 9076dd6 into main Jun 8, 2022
@clintoncwolfe clintoncwolfe deleted the vasundhara/group8_resource_ids branch June 8, 2022 20:03
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.

3 participants