Skip to content

Commit

Permalink
chore: cosmit.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfermigier committed Feb 1, 2024
1 parent b3d3d4d commit 948d3c1
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 24 deletions.
4 changes: 2 additions & 2 deletions nua-agent/src/nua/agent/scripts/app_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ def merge_files(self):
copy2(file, target.parent)

def test_build(self):
"""Execute a configured shell command or list of commands to check
that the build is successful."""
"""Execute a configured shell command or list of commands to check that the
build is successful."""
default = "test -f /nua/metadata/nua-config.*"
commands = self.config.build.get("test", default)
if not commands:
Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/autobuild/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script to build Nua own images."""

from typing import Optional

import typer
Expand Down
4 changes: 3 additions & 1 deletion nua-build/src/nua/build/autobuild/nua_image_builder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Script to build Nua own images."""

import tempfile
from pathlib import Path
from pprint import pformat

from nua.lib.actions import copy_from_package
from nua.lib.backports import chdir
from nua.lib.constants import NUA_BUILDER_TAG, NUA_PYTHON_TAG
Expand All @@ -12,7 +14,7 @@
docker_stream_build,
)
from nua.lib.nua_config import force_list
from nua.lib.panic import Abort, show, title, debug, vprint
from nua.lib.panic import Abort, debug, show, title, vprint
from nua.lib.shell import mkdir_p
from nua.lib.tool.state import verbosity

Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/autobuild/nua_wheel_builder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Script to build Nua own images."""

import re
import tempfile
import zipfile
Expand Down
3 changes: 2 additions & 1 deletion nua-build/src/nua/build/autobuild/register_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
Docker builders are defined by a json file of properties and a Dockerfile.
"""

import json
from importlib import resources as rso
from importlib.abc import Traversable
from pprint import pformat

from nua.lib.nua_config import force_list
from nua.lib.panic import bold_debug, warning, vprint
from nua.lib.panic import bold_debug, vprint, warning
from nua.lib.tool.state import verbosity


Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/builders/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
May be refactored later into a more abstract base class.
"""

from __future__ import annotations

import abc
Expand Down
11 changes: 7 additions & 4 deletions nua-build/src/nua/build/builders/docker.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
"""Docker builder (using dockerfile generated from the nua-config)."""

from __future__ import annotations

import logging
from contextlib import suppress
from importlib import resources as rso
from pathlib import Path
from shutil import copy2, copytree

import docker
from nua.build.autobuild.nua_image_builder import NuaImageBuilder
from nua.build.autobuild.register_builders import is_builder
from nua.lib.backports import chdir
from nua.lib.constants import NUA_BUILDER_TAG
from nua.lib.nua_config import hyphen_get, nua_config_names
from nua.lib.docker import (
display_docker_img,
docker_build_log_error,
docker_stream_build,
)
from nua.build.autobuild.nua_image_builder import NuaImageBuilder
from nua.build.autobuild.register_builders import is_builder
from nua.lib.backports import chdir
from nua.lib.nua_config import hyphen_get, nua_config_names
from nua.lib.panic import debug, info, vprint
from nua.lib.shell import rm_fr
from nua.lib.tool.state import verbosity, verbosity_level
Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/builders/factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Builder factory: create a Builder instance based on the nua-config.
"""

from __future__ import annotations

from dataclasses import dataclass, field
Expand Down
3 changes: 2 additions & 1 deletion nua-build/src/nua/build/builders/wrap.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"""Docker "wrap" builder: build a container from an existing dockerfile."""

from __future__ import annotations

import logging

import docker
from nua.lib.backports import chdir
from nua.lib.docker import (
display_docker_img,
docker_build_log_error,
docker_stream_build,
)
from nua.lib.backports import chdir
from nua.lib.panic import info
from nua.lib.shell import rm_fr
from nua.lib.tool.state import verbosity
Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Configuration of the nua_build instance."""

from importlib import resources as rso

import tomli
Expand Down
10 changes: 6 additions & 4 deletions nua-build/src/nua/build/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
Note: **currently use "nua-build ..." for command line**.
See later if move this to "nua ...".
"""

import argparse
import sys
import traceback
from time import perf_counter
from typing import Any

import pydantic
import snoop
from cleez.actions import VERSION, COUNT, STORE_TRUE
from nua.lib.nua_config import NuaConfigError, NuaConfig
from cleez.actions import COUNT, STORE_TRUE, VERSION
from nua.lib.elapsed import elapsed
from nua.lib.panic import Abort, red_line, show, info
from nua.lib.nua_config import NuaConfig, NuaConfigError
from nua.lib.panic import Abort, info, red_line, show
from nua.lib.tool.state import set_color, set_verbosity, verbosity
import pydantic

from . import __version__
from .builders import BuilderError, get_builder
Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/module_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Definitions are TOML descriptions of providers.
"""

from importlib import resources as rso
from pathlib import Path
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions nua-build/src/nua/build/scripts/test_replace_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
test1.example.com test1.yerom.xyz
test2.example.com test2.yerom.xyz
"""

import sys
from pathlib import Path

Expand Down
6 changes: 2 additions & 4 deletions nua-lib/src/nua/lib/normalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ def _normalize_port_item_proxy(port: dict[str, Any]) -> None:
# return
if not proxy and not port["host"] and port["name"].lower() != "web":
raise NuaConfigError(
(
"Only port.web can have an automatic 'proxy' value, other web "
"published ports muste provide a proxy number"
)
"Only port.web can have an automatic 'proxy' value, other web "
"published ports muste provide a proxy number"
)


Expand Down
8 changes: 3 additions & 5 deletions nua-orchestrator/src/nua/orchestrator/cli/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,8 @@ def _configured_registries(self) -> str:
lines.append("Configured registries:")
for reg in sorted(self._registries, key=itemgetter("priority")):
lines.append(
(
f' priority: {reg["priority"]:>2} '
f'format: {reg["format"]:<16} '
f'url: {reg["url"]}'
)
f' priority: {reg["priority"]:>2} '
f'format: {reg["format"]:<16} '
f'url: {reg["url"]}'
)
return "\n".join(lines)
5 changes: 3 additions & 2 deletions nua-server/src/nua_server/pages/admin.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from markupsafe import Markup
from prettyprinter import pformat
from webbits.html import html

from nua_server.app import app
from nua_server.client import get_client
from nua_server.menus import ADMIN_MENU, MAIN_MENU
from prettyprinter import pformat
from webbits.html import html


@app.get("/admin/")
Expand Down

0 comments on commit 948d3c1

Please sign in to comment.