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

Windows support for Service tool added. #3573

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SRIKKANTH
Copy link
Collaborator

@SRIKKANTH SRIKKANTH commented Dec 30, 2024

This pull request adds Windows support for the Service tool.

@SRIKKANTH SRIKKANTH force-pushed the smyakam/service_tool_29_12_20024 branch 5 times, most recently from 5678bbc to 2f38007 Compare December 30, 2024 20:05
lisa/schema.py Outdated Show resolved Hide resolved
output_json=True,
fail_on_error=False,
)
if not service_status:
Copy link
Member

Choose a reason for hiding this comment

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

Use above fail_on_error, instead of custom error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Copy link
Member

Choose a reason for hiding this comment

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

it looks not fixed. Set above fail_on_error=True, let the above line failed. If the error message is not clear, catch it and add more information.

@SRIKKANTH SRIKKANTH force-pushed the smyakam/service_tool_29_12_20024 branch from 9cfc7ab to 727572d Compare January 1, 2025 08:18
@SRIKKANTH SRIKKANTH marked this pull request as ready for review January 1, 2025 08:23
@SRIKKANTH SRIKKANTH requested a review from LiliDeng as a code owner January 1, 2025 08:23
@SRIKKANTH SRIKKANTH force-pushed the smyakam/service_tool_29_12_20024 branch from 5b555e0 to 72582c5 Compare January 2, 2025 05:53
This pull request adds Windows support for the Service tool.

if timeout < timer.elapsed():
raise LisaException(
f"service '{name}' still in '{current_service_status}' state after '{timeout}' seconds" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

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

Change it to multiple lines, not to overuse E501.

f"service '{name}' still in '{current_service_status}' state "
f"after '{timeout}' seconds"

return WindowsServiceStatus(int(service_status["Status"]))

def _is_service_inactive(self, name: str) -> bool:
return self._get_status(name) == WindowsServiceStatus.STOPPED
Copy link
Member

Choose a reason for hiding this comment

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

Should it use the same result as _check_service_running? If the service is in other statuses, what's expected?

self._get_status(name)
return True
except LisaException:
return False
Copy link
Member

Choose a reason for hiding this comment

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

  1. When checking the service exist or not, use more accurate checking, like parse output, instead of getting status, and judge non-exists on any exception.
  2. Not overuse try/except on normal status.

)
self.wait_for_service_stop(name)

def wait_for_service_start(self, name: str) -> None:
Copy link
Member

@squirrelsc squirrelsc Jan 2, 2025

Choose a reason for hiding this comment

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

If the method is not used outside of the class, remove them.

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