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

[3007.x] transport: tcp check that pull_path exists before chmod #66931

Open
wants to merge 2 commits into
base: 3007.x
Choose a base branch
from

Conversation

Sxderp
Copy link

@Sxderp Sxderp commented Sep 27, 2024

What does this PR do?

Check that pull_path is used before attempting to chmod. This was an oversight in the patch to open up the socket permissions. I'm not entirely sure how this doesn't break tests / functionality.. but whatever. The fix removes a traceback, which is good I suppose.

I'm not actually sure what kind of tests would be needed ... since the current tests seem not to have caught this?

What issues does this PR fix or reference?

Fixes

Previous Behavior

I noticed this traceback in some testing artifacts:

14:06:15,138 [tornado.application                                                             :758 ][ERROR   ][PublishServer(268624)] Exception in callback functools.partial(<bound method IOLoop._discard_future_result of <tornado.platform.asyncio.AsyncIOLoop object at 0x7f83475315e0>>, <Task finished name='Task-10' coro=<PublishServer.publisher() done, defined at /home/sdaniele3/salt/salt/transport/tcp.py:1372> exception=TypeError('chmod: path should be string, bytes, os.PathLike or integer, not NoneType')>)
Traceback (most recent call last):
  File "/home/sdaniele3/salt/.nox/test-parametrized-3-crypto-none-transport-zeromq-coverage-false/lib64/python3.9/site-packages/tornado/ioloop.py", line 738, in _run_callback
    ret = callback()
  File "/home/sdaniele3/salt/.nox/test-parametrized-3-crypto-none-transport-zeromq-coverage-false/lib64/python3.9/site-packages/tornado/ioloop.py", line 762, in _discard_future_result
    future.result()
  File "/home/sdaniele3/salt/salt/transport/tcp.py", line 1438, in publisher
    os.chmod(self.pull_path, self.pull_path_perms)
TypeError: chmod: path should be string, bytes, os.PathLike or integer, not NoneType

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

@Sxderp Sxderp requested a review from a team as a code owner September 27, 2024 18:10
@salt-project-bot-prod-environment salt-project-bot-prod-environment bot changed the title transport: tcp check that pull_path exists before chmod [3007.x] transport: tcp check that pull_path exists before chmod Sep 27, 2024
@Sxderp
Copy link
Author

Sxderp commented Sep 27, 2024

@dwoz You did the initial permission fixup. You're probably the best one to review.

@twangboy
Copy link
Contributor

twangboy commented Sep 30, 2024

Could we get a changelog and a test for this, please? That means you'll probably need to create an issue to link to.

@Sxderp Sxderp force-pushed the pr-3007.x-tcp-check-pull-path-before-chmod branch from cf8455f to a21cc46 Compare October 1, 2024 14:48
@Sxderp
Copy link
Author

Sxderp commented Oct 1, 2024

I'm not actually sure the best way to test. There's no functional issues. The async task just cancels right before it was going to exit anyway, but the other tasks it spawns are successful. In the codepath that causes the traceback the server is binding to a TCP port and thus chmod is also inconsequential.

I /could/ make a specific test for TCP that the "publisher" method is successful, but that seems a little silly to make one for a specific transport. Ideally all transports have the same "interface". Unfortunately making a generic one doesn't make sense either as each transport treats "publisher" differently (which maybe should be normalized?). For example WebSocket will hang indefinitely (on purpose) in that function and at the moment ZeroMQ publisher is "broken" (see #66751).

Do you have any suggestions?

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