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 type check for the context root in ContentProvider #3421

Closed
wants to merge 2 commits into from
Closed

Add type check for the context root in ContentProvider #3421

wants to merge 2 commits into from

Conversation

shzhou12
Copy link
Contributor

@shzhou12 shzhou12 commented May 24, 2022

All Pull Requests:

Check all that apply:

  • Have you followed the guidelines in our Contributing document, including the instructions about commit messages?
  • Is this PR to correct an issue?
  • Is this PR an enhancement?

Complete Description of Additions/Changes:

ccx-ocp-core added a new execution context recently and the context root is not a string but a dictionary. This pull request adds type checks for the context root in class ContentProvider to avoid the TypeError exceptions.

@shzhou12
Copy link
Contributor Author

The exception detail when executing the insights run command:

  INFO:insights.core.dr:Trying insights.specs.default.DefaultSpecs.redhat_release
  WARNING:insights.core.dr:Traceback (most recent call last):
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/dr.py", line 967, in run
      result = DELEGATES[component].process(broker)
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/dr.py", line 686, in process
      return self.invoke(broker)
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/plugins.py", line 90, in invoke
      return self.component(broker)
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/spec_factory.py", line 569, in __call__
      return self.kind(ctx.locate_path(self.path), root=ctx.root, ds=self, ctx=ctx)
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/spec_factory.py", line 171, in __init__
      self.file_name = os.path.basename(self.path)
    File "/builds/ccx/ccx-rules-ocp/.tox/functional-py38/lib/python3.8/site-packages/insights/core/spec_factory.py", line 112, in path
      return os.path.join(self.root, self.relative_path)
    File "/usr/lib64/python3.8/posixpath.py", line 76, in join
      a = os.fspath(a)
  TypeError: expected str, bytes or os.PathLike object, not dict

@shzhou12
Copy link
Contributor Author

@xiangce Could you please help to review this pull request?

@ryan-blakley
Copy link
Contributor

@shzhou12 Could you provide more information on this issue, if it's a link to a jira if you'll email it to me? I feel like this is just covering up/ignoring the real issue that needs to be addressed. Because I can't think of a spec that would return a dict for the root or relative path.

@xiangce xiangce marked this pull request as draft October 13, 2022 03:04
@ryan-blakley
Copy link
Contributor

I think this can be closed, as the issue can be stopped by using the parameter added in pr #3434.

@ryan-blakley
Copy link
Contributor

Closing this as the issue was fixed by adding the --no-load-default parameter in 3434.

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