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

fix: datasource pass unicode to foreach_execute in py26 #4232

Merged
merged 1 commit into from
Sep 29, 2024

Conversation

xiangce
Copy link
Contributor

@xiangce xiangce commented Sep 29, 2024

  • when collecting in py26 env, if the foreach_execute specs depends
    on datasource, the provider will be in unicode type and cause validate()
    failed
  • this change converted the unicode to string by force for all 'cmd' passed to
    CommandOutputProvider

Signed-off-by: Xiangce Liu [email protected]

rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED

All Pull Requests:

Check all that apply:

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

Complete Description of Additions/Changes:

  • In the integration test under py26, the foreach_execute depends on
    datasources cannot be collected as expected due to the following error:
  File "/root/insights-core/insights.zip/insights/core/spec_factory.py", line 365, in validate
    if not which(cmd, env=self._env):
  File "/root/insights-core/insights.zip/insights/util/__init__.py", line 60, in which
    if os.access(cmd, os.X_OK) and os.path.isfile(cmd):
TypeError: access() argument 1 must be encoded string without NULL bytes, not str

- this PR coverted the unicode to string by force when py2

Signed-off-by: Xiangce Liu <[email protected]>

rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
@codecov-commenter
Copy link

codecov-commenter commented Sep 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.69%. Comparing base (ccb65c1) to head (04b7bcf).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4232   +/-   ##
=======================================
  Coverage   76.69%   76.69%           
=======================================
  Files         759      759           
  Lines       41788    41788           
  Branches     9603     9603           
=======================================
  Hits        32051    32051           
  Misses       8638     8638           
  Partials     1099     1099           
Flag Coverage Δ
unittests 76.67% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xiangce xiangce changed the title fix: datasource unicode to foreach_execute in py26 fix: datasource pass unicode to foreach_execute in py26 Sep 29, 2024
@xiangce xiangce merged commit 16406b4 into RedHatInsights:master Sep 29, 2024
13 of 14 checks passed
@xiangce xiangce deleted the foreach_cmd branch September 29, 2024 12:34
xiangce added a commit to xiangce/insights-core that referenced this pull request Sep 30, 2024
…ghts#4232)

- when collecting in py26 env, if the foreach_execute specs depends
  on DatasourceProvider, the provider will be in unicode type and causes
  the followed validate() fail
- this change converted the unicode to string by force for all 'cmd' passed to
  CommandOutputProvider

Signed-off-by: Xiangce Liu <[email protected]>

rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
xiangce added a commit that referenced this pull request Sep 30, 2024
- when collecting in py26 env, if the foreach_execute specs depends
  on DatasourceProvider, the provider will be in unicode type and causes
  the followed validate() fail
- this change converted the unicode to string by force for all 'cmd' passed to
  CommandOutputProvider

Signed-off-by: Xiangce Liu <[email protected]>

rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
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