Skip to content

Commit

Permalink
# improve share.py
Browse files Browse the repository at this point in the history
  • Loading branch information
czy21 committed Aug 13, 2024
1 parent 74b4f6a commit 380334e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions server/docker/db/redis/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ services:
--requirepass {{ param_db_redis_password }}
--appendonly yes
--ignore-warnings ARM64-COW-BUG
redis-exporter:
redis-exporter-{{ param_db_redis_port }}:
<<: *redis-exporter-common
labels:
<<: *traefik-exporter-label
container_name: redis-exporter
container_name: redis-exporter-{{ param_db_redis_port }}
user: root
expose:
- "9121"
Expand Down Expand Up @@ -67,11 +67,11 @@ services:
--cluster-enabled yes
--cluster-announce-ip {{ param_db_redis_cluster_ip }}
{%- endfor %}
redis-exporter:
redis-exporter-{{ param_db_redis_cluster_start_port }}:
<<: *redis-exporter-common
labels:
<<: *traefik-exporter-label
container_name: redis-exporter
container_name: redis-exporter-{{ param_db_redis_cluster_start_port }}
user: root
expose:
- "9121"
Expand Down
10 changes: 4 additions & 6 deletions server/share.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,10 @@ def _format_action_invocation(self, action: argparse.Action) -> str:
return ', '.join(t.strip() for t in parts)

def _get_default_metavar_for_optional(self, action: argparse.Action) -> str:
if action.type:
return action.type.__name__
return action.type.__name__ if action.type and action.type.__name__ else str.__name__

def _get_default_metavar_for_positional(self, action: argparse.Action) -> str:
if action.type:
return action.type.__name__
return action.type.__name__ if action.type and action.type.__name__ else str.__name__


class AbstractRole(metaclass=ABCMeta):
Expand Down Expand Up @@ -255,7 +253,7 @@ def __init__(self, root_path: pathlib.Path, role_class: typing.Type[AbstractRole
self.role_deep: int = role_deep
self.arg_parser: argparse.ArgumentParser = argparse.ArgumentParser(formatter_class=ArgParseHelpFormatter, usage='%(prog)s [command] [options]')
self.set_common_argument(self.arg_parser)
self.__command_parser = self.arg_parser.add_subparsers(title="commands", metavar="", dest="command")
self.__command_parser = self.arg_parser.add_subparsers(title="commands", metavar="", dest="command", required=True)
self.__init_install_parser()
self.__init_delete_parser()
self.__init_build_parser()
Expand Down Expand Up @@ -377,7 +375,7 @@ def __loop_namespaces(self, namespaces: list[Namespace], global_env: dict, args:
_rules = regex_util.match_rules([*jinja2ignore_rules], t.as_posix(), ".jinja2ignore {0}".format(self.__loop_namespaces.__name__))
role_output_file = role_output_path.joinpath(t.relative_to(role_path))
if not any(_rules.values()):
file_util.write_text(role_output_file, template_util.Template(file_util.read_text(t)).render(**role_env),t.stat().st_mode)
file_util.write_text(role_output_file, template_util.Template(file_util.read_text(t)).render(**role_env), t.stat().st_mode)
else:
file_util.copy(t, role_output_file)

Expand Down

0 comments on commit 380334e

Please sign in to comment.