Skip to content

Latest commit

 

History

History
57 lines (30 loc) · 2.68 KB

File metadata and controls

57 lines (30 loc) · 2.68 KB

Mreg CLI

Category and Location Validation

Add category and location validation to CLI commands in mreg-cli. They have been removed from model methods such as Network.set_category() and Network.set_location() in this package.

List GET Request Limits

Adjust limit for list GET requests when using MregClient to be 500 (if desired). New default is None (no limit). This affects the following methods:

  • MregClient.get_list()
  • MregClient.get_list_generic()
  • MregClient.get_typed()

OutputManager Removal in models

OutputManager.add_line() calls have been removed from mreg_api.models.models and replaced with an internal note system using FrozenModel.add_note(). This allows tracking informational messages without direct CLI output.

For now, this is implemented as a list[str] private attribute _notes in FrozenModel, with an add_note() method to append notes. However, if richer functionality is needed later, a Note class could be created.

Commands can retrieve notes from model instances using a new get_notes() method.

Token

Token needs to be retrieved from the client (MregClient.get_token()) and saved by the CLI. Token file management is not a part of the API client.

HostName validation

HostName validation has been decoupled from MregCliConfig. The domain used for wildcard hostname validation is now stored in a context var named hostname_domain in mreg_api.models.fields. This variable is automatically set upon client initialization to the domain used in the client.

Mreg API

Docstrings

Ruff's pydocstyle ruleset does not support sphinx style docstrings. Docstrings should be converted to google style.

https://docs.astral.sh/ruff/settings/#lint_pydocstyle_convention

Force

References to "force" in error messages should be removed. The CLI should be the only place where "force" is relevant.

Recording

We need to store requests in some internal client data structure that Mreg-CLI can read to generate its recording file.

IMPORTANT: mreg-cli needs to remember to clear this recording data structure between commands and store it in its OutputManager.

Singleton instantation in models

We could change the API of MregClient to require an init or setup() method to configure the singleton instance, which would let us call client = MregClient() at the top-level of mreg_api.models instead of requiring inline imports with client instantation in every method.

Follow redirects

Automatic following of redirects can be enabled with a new follow_redirects parameter to MregClient.