Merge pull request 'don't register global logger, this interferes currently with that we have in ssh.py' (#392) from Mic92-kvm-fix into main
This commit is contained in:
7
flake.lock
generated
7
flake.lock
generated
@@ -7,16 +7,15 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1695379860,
|
"lastModified": 1696266752,
|
||||||
"narHash": "sha256-ADsWLw33T/6APAoEfwPVkhuUHbH/BW/Jz5cgTgijsIs=",
|
"narHash": "sha256-wJnMDFM21+xXdsXSs6pXMElbv4YfqmQslcPApRuaYKs=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "26cf7576b85fd0b4070d8bd84475021e01d63814",
|
"rev": "646ee25c25fffee122a66282861f5f56ad3e0fd9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"ref": "party",
|
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
{
|
{
|
||||||
description = "clan.lol base operating system";
|
description = "clan.lol base operating system";
|
||||||
|
|
||||||
|
nixConfig.extra-substituters = [ "https://cache.clan.lol" ];
|
||||||
|
nixConfig.extra-trusted-public-keys = [ "cache.clan.lol-1:3KztgSAB5R1M+Dz7vzkBGzXdodizbgLXGXKXlcQLA28=" ];
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
#nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
# https://github.com/NixOS/nixpkgs/pull/257462
|
# https://github.com/NixOS/nixpkgs/pull/257462
|
||||||
nixpkgs.url = "github:Mic92/nixpkgs/fakeroot";
|
nixpkgs.url = "github:Mic92/nixpkgs/fakeroot";
|
||||||
floco.url = "github:aakropotkin/floco";
|
floco.url = "github:aakropotkin/floco";
|
||||||
floco.inputs.nixpkgs.follows = "nixpkgs";
|
floco.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
disko.url = "github:nix-community/disko/party";
|
disko.url = "github:nix-community/disko";
|
||||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
sops-nix.url = "github:Mic92/sops-nix";
|
sops-nix.url = "github:Mic92/sops-nix";
|
||||||
sops-nix.inputs.nixpkgs.follows = "sops-nix";
|
sops-nix.inputs.nixpkgs.follows = "sops-nix";
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import logging
|
|
||||||
import sys
|
import sys
|
||||||
from types import ModuleType
|
from types import ModuleType
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from . import config, create, custom_logger, machines, secrets, vms, webui
|
from . import config, create, machines, secrets, vms, webui
|
||||||
from .errors import ClanError
|
from .errors import ClanError
|
||||||
from .ssh import cli as ssh_cli
|
from .ssh import cli as ssh_cli
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
argcomplete: Optional[ModuleType] = None
|
argcomplete: Optional[ModuleType] = None
|
||||||
try:
|
try:
|
||||||
import argcomplete # type: ignore[no-redef]
|
import argcomplete # type: ignore[no-redef]
|
||||||
@@ -66,19 +63,12 @@ def main() -> None:
|
|||||||
parser = create_parser()
|
parser = create_parser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.debug:
|
|
||||||
custom_logger.register(logging.DEBUG)
|
|
||||||
log.debug("Debug logging enabled")
|
|
||||||
else:
|
|
||||||
custom_logger.register(logging.INFO)
|
|
||||||
|
|
||||||
if not hasattr(args, "func"):
|
if not hasattr(args, "func"):
|
||||||
log.error("No argparse function registered")
|
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
args.func(args)
|
args.func(args)
|
||||||
except ClanError as e:
|
except ClanError as e:
|
||||||
log.exception(e)
|
print(e, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user