Skip to content

mgr/cephadm: Cleanup code#36325

Closed
votdev wants to merge 1 commit intoceph:masterfrom
votdev:cleanup_cephadm_mgr_module
Closed

mgr/cephadm: Cleanup code#36325
votdev wants to merge 1 commit intoceph:masterfrom
votdev:cleanup_cephadm_mgr_module

Conversation

@votdev
Copy link
Member

@votdev votdev commented Jul 28, 2020

Remove obvious Python issues reported by the IDE. The whole code should be reformated with a tool like YAPF.

Signed-off-by: Volker Theile vtheile@suse.com

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard backend
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@votdev votdev requested a review from a team as a code owner July 28, 2020 13:53
Remove obvious Python issues reported by the IDE. The whole code should be reformated with a tool like YAPF.

Signed-off-by: Volker Theile <vtheile@suse.com>
@votdev votdev force-pushed the cleanup_cephadm_mgr_module branch from dbf0586 to 9fa4196 Compare July 28, 2020 14:13
Copy link
Contributor

@mgfritch mgfritch left a comment

Choose a reason for hiding this comment

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

I'm also wondering if it might be worth converting many of the py2 string formatting style to f-strings?

Comment on lines +53 to +60
def __init__(
self,
spec, # type: ServiceSpec
get_hosts_func, # type: Callable
get_daemons_func, # type: Callable[[str],List[orchestrator.DaemonDescription]]
filter_new_host=None, # type: Optional[Callable[[str],bool]]
scheduler=None, # type: Optional[BaseScheduler]
):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def __init__(
self,
spec, # type: ServiceSpec
get_hosts_func, # type: Callable
get_daemons_func, # type: Callable[[str],List[orchestrator.DaemonDescription]]
filter_new_host=None, # type: Optional[Callable[[str],bool]]
scheduler=None, # type: Optional[BaseScheduler]
):
def __init__(
self,
spec: ServiceSpec,
get_hosts_func: Callable,
get_daemons_func: Callable[[str],List[orchestrator.DaemonDescription]],
filter_new_host: Optional[Callable[[str],bool]] = None,
scheduler: Optional[BaseScheduler] = None,
):

might as well covert these to py3 style too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Please do that in a separate PR.

def name_to_auth_entity(daemon_type, # type: str
daemon_id, # type: str
host = "" # type Optional[str] = ""
host='' # type Optional[str] = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

convert to py3 style type checking?

Copy link
Member Author

@votdev votdev Jul 29, 2020

Choose a reason for hiding this comment

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

This should be done in a separate PR. There is really really much work to do with this mgr module code.

@votdev
Copy link
Member Author

votdev commented Jul 29, 2020

I'm also wondering if it might be worth converting many of the py2 string formatting style to f-strings?

As mentioned in the PR description, this PR will only fix obvious issues. The whole code needs a complete refactoring which should happen in a separate PR. Additionally a lint infrastructure (e.g. using tox) should be established for the cephadm mgr module to prevent various Python issues in future.

I'm really tempted to chase the entire source code through YAPF or a similar tool to reformat it, but that should be done by a cephadm team member.

@votdev
Copy link
Member Author

votdev commented Jul 30, 2020

Replaced by #36348

@votdev votdev closed this Jul 30, 2020
@votdev votdev deleted the cleanup_cephadm_mgr_module branch July 30, 2020 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants