zulip_tools: Make default default_value be None, not "".

This commit is contained in:
Alex Vandiver 2024-03-12 18:20:51 +00:00 committed by Tim Abbott
parent f9f9392b93
commit b36f389e9e
2 changed files with 15 additions and 5 deletions

View File

@ -272,7 +272,7 @@ class_renames = {
"zulip::rabbit": "zulip::profile::rabbitmq",
"zulip::voyager": "zulip::profile::standalone",
}
classes = re.split(r"\s*,\s*", get_config(config_file, "machine", "puppet_classes"))
classes = re.split(r"\s*,\s*", get_config(config_file, "machine", "puppet_classes", ""))
new_classes = [class_renames.get(c, c) for c in classes if c != "zulip::base"]
if classes != new_classes:
if args.skip_restart:

View File

@ -16,7 +16,7 @@ import sys
import time
import uuid
from datetime import datetime, timedelta
from typing import IO, Any, Dict, List, Sequence, Set, Union, overload
from typing import IO, Any, Dict, List, Optional, Sequence, Set, Union, overload
from urllib.parse import SplitResult
DEPLOYMENTS_DIR = "/home/zulip/deployments"
@ -585,7 +585,17 @@ def assert_running_as_root(strip_lib_from_paths: bool = False) -> None:
@overload
def get_config(
config_file: configparser.RawConfigParser, section: str, key: str, default_value: str = ""
config_file: configparser.RawConfigParser,
section: str,
key: str,
default_value: None,
) -> Optional[str]: ...
@overload
def get_config(
config_file: configparser.RawConfigParser,
section: str,
key: str,
default_value: str,
) -> str: ...
@overload
def get_config(
@ -595,8 +605,8 @@ def get_config(
config_file: configparser.RawConfigParser,
section: str,
key: str,
default_value: Union[str, bool] = "",
) -> Union[str, bool]:
default_value: Union[str, bool, None] = None,
) -> Union[str, bool, None]:
if config_file.has_option(section, key):
val = config_file.get(section, key)
if isinstance(default_value, bool):