Skip to content

mgr/cephadm: Some more typing#36497

Merged
sebastian-philipp merged 2 commits intoceph:masterfrom
sebastian-philipp:mgr-cephadm-entity-newtype
Aug 10, 2020
Merged

mgr/cephadm: Some more typing#36497
sebastian-philipp merged 2 commits intoceph:masterfrom
sebastian-philipp:mgr-cephadm-entity-newtype

Conversation

@sebastian-philipp
Copy link
Contributor

Make sure we don't mix daemon names, config entities and
auth entities. Cause all of them don't mix well together.

Signed-off-by: Sebastian Wagner sebastian.wagner@suse.com

Another fallout from #36432

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 api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

Make sure we don't mix daemon names, config entities and
auth entities. Cause all of them don't mix well together.

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
@sebastian-philipp sebastian-philipp requested a review from a team as a code owner August 6, 2020 15:51
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
@sebastian-philipp sebastian-philipp added the wip-swagner-testing My Teuthology tests label Aug 7, 2020
@sebastian-philipp
Copy link
Contributor Author

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.

couple of nits otherwise lgtm!


def name_to_auth_entity(daemon_type: str,
daemon_id: str,
host: str = "",
Copy link
Contributor

@mgfritch mgfritch Aug 8, 2020

Choose a reason for hiding this comment

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

Suggested change
host: str = "",
host: Optional[str] = None,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm that change was made by @jmolmo a few weeks back. I didn't want to revert this.

return 'client.' + daemon_type + "." + daemon_id
return AuthEntity('client.' + daemon_type + "." + daemon_id)
elif daemon_type == 'crash':
if host == "":
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
if host == "":
if not host:

if host == "":
raise OrchestratorError("Host not provided to generate <crash> auth entity name")
return 'client.' + daemon_type + "." + host
return AuthEntity('client.' + daemon_type + "." + host)
Copy link
Contributor

@mgfritch mgfritch Aug 8, 2020

Choose a reason for hiding this comment

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

Suggested change
return AuthEntity('client.' + daemon_type + "." + host)
return AuthEntity(f'client.{daemon_type}.{host}')

would an f-string be more readable?

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.

2 participants