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

refactor(update-server): Split name_management into submodules #10523

Merged

Conversation

SyntaxColoring
Copy link
Contributor

@SyntaxColoring SyntaxColoring commented May 27, 2022

Overview

Refactors to update-server, in pursuit of a fix for #10126.

Note that this PR will merge into the avahi_name_conflict feature branch, not into edge. (This is per discussion on the Robot Services team. We're trying it out!)

Changelog

The otupdate.common.name_management module was getting unwieldy, so this PR splits it into several submodules:

  • otupdate.common.name_management: Top-level HTTP endpoint functions; an English overview of the robot's various names; and selected re-exports from submodules.
  • otupdate.common.name_management.avahi: Restarting the Avahi daemon and telling the Avahi daemon what service name it should use when advertising the machine.
  • otupdate.common.name_management.pretty_hostname: Reading and storing the machine's pretty hostname.
  • otupdate.common.name_management.static_hostname: Setting up the machine's static hostname.

No behavioral code changes. Just moving stuff around.

Review requests

  • Do the names and organization make sense?

  • Do the docstrings make sense?

    In particular, each submodule points back to the main otupdate.common.name_management docstring for background information on the various names. Would it be clearer if this relationship were reversed, and the names were canonically explained in the various submodules?

    The distinctions between the different names are both important and subtle, so I feel like it's important to organize this documentation well.

I wouldn't bother testing this on a robot just yet. This PR is merging into a feature branch, not into edge, and it's going to be followed by more meaningful behavioral changes. Those changes will have to be tested thoroughly, so we may as well wait to test the whole thing then.

Risk assessment

Low so far, since there are no behavioral code changes.

@SyntaxColoring SyntaxColoring added refactor update server robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience). labels May 27, 2022
This reverts commit 1907669.

Moving this to another PR to simplify the diff.
This reverts commit 0369605.

Moving this to another PR to simplify the diff.
@SyntaxColoring SyntaxColoring marked this pull request as ready for review May 27, 2022 21:50
@SyntaxColoring SyntaxColoring requested a review from a team as a code owner May 27, 2022 21:50
@codecov
Copy link

codecov bot commented May 27, 2022

Codecov Report

Merging #10523 (2a99407) into avahi_name_conflict (faacde2) will increase coverage by 0.00%.
The diff coverage is 40.14%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           avahi_name_conflict   #10523   +/-   ##
====================================================
  Coverage                73.67%   73.68%           
====================================================
  Files                     2138     2141    +3     
  Lines                    57457    57469   +12     
  Branches                  5777     5777           
====================================================
+ Hits                     42333    42344   +11     
- Misses                   13917    13918    +1     
  Partials                  1207     1207           
Flag Coverage Δ
update-server 72.71% <40.14%> (+0.21%) ⬆️

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

Impacted Files Coverage Δ
...otupdate/common/name_management/static_hostname.py 23.52% <23.52%> (ø)
...otupdate/common/name_management/pretty_hostname.py 28.94% <28.94%> (ø)
...te-server/otupdate/common/name_management/avahi.py 29.26% <29.26%> (ø)
...server/otupdate/common/name_management/__init__.py 89.65% <89.65%> (ø)

Copy link
Contributor

@mcous mcous left a comment

Choose a reason for hiding this comment

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

Looks like a clean split and rename from checking the diffs manually

try:
import dbus

class DBusState:
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding this note for future cleanup since this PR only moved this code, it did not introduce it: a whole class definition inside a try is a little funky. Can this be done some other way?

@SyntaxColoring SyntaxColoring merged commit 89deec4 into avahi_name_conflict May 31, 2022
@SyntaxColoring SyntaxColoring deleted the avahi_name_conflict_name_management_split branch May 31, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor robot-svcs Falls under the purview of the Robot Services squad (formerly CPX, Core Platform Experience). update server
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants