Merge pull request 'generate: don't set type=bool in argparse.BooleanOptionalAction' (#2190) from fix-warning into main
This commit is contained in:
@@ -245,7 +245,6 @@ def register_generate_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--regenerate",
|
"--regenerate",
|
||||||
type=bool,
|
|
||||||
action=argparse.BooleanOptionalAction,
|
action=argparse.BooleanOptionalAction,
|
||||||
help="whether to regenerate facts for the specified machine",
|
help="whether to regenerate facts for the specified machine",
|
||||||
default=None,
|
default=None,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ def flash_machine(
|
|||||||
secret_facts_store: SecretStoreBase = secret_facts_module.SecretStore(
|
secret_facts_store: SecretStoreBase = secret_facts_module.SecretStore(
|
||||||
machine=machine
|
machine=machine
|
||||||
)
|
)
|
||||||
with TemporaryDirectory() as tmpdir_:
|
with TemporaryDirectory(prefix="disko-install-") as tmpdir_:
|
||||||
tmpdir = Path(tmpdir_)
|
tmpdir = Path(tmpdir_)
|
||||||
upload_dir = machine.secrets_upload_directory
|
upload_dir = machine.secrets_upload_directory
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ def install_nixos(
|
|||||||
generate_facts([machine], None, False)
|
generate_facts([machine], None, False)
|
||||||
generate_vars([machine], None, False)
|
generate_vars([machine], None, False)
|
||||||
|
|
||||||
with TemporaryDirectory() as tmpdir_:
|
with TemporaryDirectory(prefix="nixos-install-") as tmpdir_:
|
||||||
tmpdir = Path(tmpdir_)
|
tmpdir = Path(tmpdir_)
|
||||||
upload_dir_ = machine.secrets_upload_directory
|
upload_dir_ = machine.secrets_upload_directory
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ def nix_eval(flags: list[str]) -> list[str]:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
if os.environ.get("IN_NIX_SANDBOX"):
|
if os.environ.get("IN_NIX_SANDBOX"):
|
||||||
with tempfile.TemporaryDirectory() as nix_store:
|
with tempfile.TemporaryDirectory(prefix="nix-store-") as nix_store:
|
||||||
return [
|
return [
|
||||||
*default_flags,
|
*default_flags,
|
||||||
"--override-input",
|
"--override-input",
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ def execute_generator(
|
|||||||
raise ClanError(msg) from e
|
raise ClanError(msg) from e
|
||||||
|
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
with TemporaryDirectory() as tmp:
|
with TemporaryDirectory(prefix="vars-") as tmp:
|
||||||
tmpdir = Path(tmp)
|
tmpdir = Path(tmp)
|
||||||
tmpdir_in = tmpdir / "in"
|
tmpdir_in = tmpdir / "in"
|
||||||
tmpdir_prompts = tmpdir / "prompts"
|
tmpdir_prompts = tmpdir / "prompts"
|
||||||
@@ -394,7 +394,6 @@ def register_generate_parser(parser: argparse.ArgumentParser) -> None:
|
|||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--regenerate",
|
"--regenerate",
|
||||||
type=bool,
|
|
||||||
action=argparse.BooleanOptionalAction,
|
action=argparse.BooleanOptionalAction,
|
||||||
help="whether to regenerate facts for the specified machine",
|
help="whether to regenerate facts for the specified machine",
|
||||||
default=None,
|
default=None,
|
||||||
|
|||||||
@@ -129,11 +129,13 @@ def run_vm(
|
|||||||
cache.mkdir(exist_ok=True)
|
cache.mkdir(exist_ok=True)
|
||||||
|
|
||||||
if cachedir is None:
|
if cachedir is None:
|
||||||
cache_tmp = stack.enter_context(TemporaryDirectory(dir=cache))
|
cache_tmp = stack.enter_context(
|
||||||
|
TemporaryDirectory(prefix="vm-cache-", dir=cache)
|
||||||
|
)
|
||||||
cachedir = Path(cache_tmp)
|
cachedir = Path(cache_tmp)
|
||||||
|
|
||||||
if socketdir is None:
|
if socketdir is None:
|
||||||
socket_tmp = stack.enter_context(TemporaryDirectory())
|
socket_tmp = stack.enter_context(TemporaryDirectory(prefix="vm-sockets-"))
|
||||||
socketdir = Path(socket_tmp)
|
socketdir = Path(socket_tmp)
|
||||||
|
|
||||||
# TODO: We should get this from the vm argument
|
# TODO: We should get this from the vm argument
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ def create_flake(
|
|||||||
sp.run(["git", "commit", "-a", "-m", "Initial commit"], cwd=flake, check=True)
|
sp.run(["git", "commit", "-a", "-m", "Initial commit"], cwd=flake, check=True)
|
||||||
|
|
||||||
if remote:
|
if remote:
|
||||||
with tempfile.TemporaryDirectory():
|
with tempfile.TemporaryDirectory(prefix="flake-"):
|
||||||
yield FlakeForTest(flake)
|
yield FlakeForTest(flake)
|
||||||
else:
|
else:
|
||||||
yield FlakeForTest(flake)
|
yield FlakeForTest(flake)
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SshdConfig:
|
|||||||
def sshd_config(test_root: Path) -> Iterator[SshdConfig]:
|
def sshd_config(test_root: Path) -> Iterator[SshdConfig]:
|
||||||
# FIXME, if any parent of the sshd directory is world-writable than sshd will refuse it.
|
# FIXME, if any parent of the sshd directory is world-writable than sshd will refuse it.
|
||||||
# we use .direnv instead since it's already in .gitignore
|
# we use .direnv instead since it's already in .gitignore
|
||||||
with TemporaryDirectory() as _dir:
|
with TemporaryDirectory(prefix="sshd-") as _dir:
|
||||||
tmpdir = Path(_dir)
|
tmpdir = Path(_dir)
|
||||||
host_key = test_root / "data" / "ssh_host_ed25519_key"
|
host_key = test_root / "data" / "ssh_host_ed25519_key"
|
||||||
host_key.chmod(0o600)
|
host_key.chmod(0o600)
|
||||||
|
|||||||
Reference in New Issue
Block a user