Closed Bug 1713988 Opened 4 years ago Closed 4 years ago

make `mach doctor` architecture simpler

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: sheehan, Assigned: sheehan)

Details

Attachments

(4 files)

In it's current state, mach doctor prints some useful debugging information to the screen, and in some cases attempts to fix issues found on your system. Its implementation is a bit messy, using an object-oriented approach and requiring updating an array of values to add a new check. Each check returns a stringly-typed dict which is then parsed and printed to the screen.

We should make mach doctor simpler so we can expand on it as a tool for helping with self-service debugging. Each check should be a simple function that returns a well defined data structure. An entrypoint function can be used to run the checks and display information in a well defined manner, and we should also be able to run the checks and parse their values from a library. mach doctor should print nothing but errors to the screen by default, so users can run it to verify issues on their systems.

Rewrite doctor.py from an object-oriented paradigm to a simpler
function-based architecture. Each check is a function that returns
or yields DoctorChecks. DoctorChecks contain a status that describes
the status of the check (success, warning, fatal error etc), a string
of text with useful information for display to the terminal, and may
optionally attach a callable which can be executed to fix issues found
by the checks.

mach doctor is updated to use the new run_doctor function instead
of creating a Doctor object. The default value of verbose in run_doctor
is False, meaning only issues with the users system are printed to the
screen.

Most of the existing check logic is left intact from the previous
implementation. Checks for platform are changed to use the
sys.platform.startswith pattern. The latest MozillaBuild version is
pulled by querying the tip commit on hg.mozilla.org instead of using
a hard-coded variable.

Pushed by cosheehan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2cd03d6cba7f rewrite `mach doctor` to be function based, simplify some things r=mhentges
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch

Adds a simple DNS query to mozilla.org as a doctor check.
We use socket.getaddrinfo to resolve the hostname to IP.

Adds a simple check that a Mozilla domain is reachable over HTTPS.

Depends on D117078

Adds a check that SSH access to hg.mozilla.org is properly configured.
Attempt to run ssh hg.mozilla.org which will authorize to hg over
SSH via pash, without running any commands on the service. In the case
the user has properly configured SSH we will see a success message and
information on the SCM levels granted to the user. If we don't see
a successful connection, parse the output to ensure the user is using
an email address as their username (which is require on hg.mozilla.org).
If the user couldn't connect yet does have an email address as their
username, notify them that they do not have permission to push to hgmo.

Depends on D117079

Pushed by cosheehan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cbdaa2cf2836 add a `mach doctor` check for a DNS query r=mhentges https://hg.mozilla.org/integration/autoland/rev/fe50f1a6121e add a check that `mozilla.org` is reachable over https r=mhentges
Pushed by cosheehan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a7f9b8d4f32 add a check for ssh access to `hg.mozilla.org` to mach doctor r=mhentges
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: