Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions das-cli/src/commands/db/db_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,9 +506,10 @@ def _redis_node(
redis_port: int,
redis_cluster: bool,
) -> None:
node_context = str(redis_node.get("context", ""))
node_ip = str(redis_node.get("ip", ""))
node_username = str(redis_node.get("username", ""))
node_context = redis_node.get("context", "")
node_ip = redis_node.get("ip", "")
node_username = redis_node.get("username", "")
public_ip = self.get_execution_context().source.get("ip") or node_ip

try:
self._redis_container_manager.set_exec_context(node_context)
Expand All @@ -520,7 +521,7 @@ def _redis_node(
)
self._redis_container_manager.unset_exec_context()

success_message = f"Redis has started successfully on port {redis_port} at {node_ip}, operating under the server user {node_username}."
success_message = f"Redis has started successfully on port {redis_port} at {public_ip}, operating under the server user {node_username}."

self.stdout(
success_message,
Expand All @@ -536,7 +537,7 @@ def _redis_node(
extra_details={
"node": {
"context": node_context,
"ip": node_ip,
"ip": public_ip,
"username": node_username,
},
"cluster": redis_cluster,
Expand Down Expand Up @@ -621,9 +622,10 @@ def _mongodb_node(
is_cluster_enabled: bool = False,
mongodb_cluster_secret_key: Union[AnyStr, None] = None,
) -> None:
node_context = mongodb_node.get("context")
node_ip = mongodb_node.get("ip")
node_username = mongodb_node.get("username")
node_context = str(mongodb_node.get("context"))
node_ip = str(mongodb_node.get("ip"))
node_username = str(mongodb_node.get("username"))
public_ip = self.get_execution_context().source.get("ip") or node_ip

cluster_node = (
dict(
Expand All @@ -645,7 +647,7 @@ def _mongodb_node(
)
self._mongodb_container_manager.unset_exec_context()

success_message = f"MongoDB has started successfully on port {mongodb_port} at {node_ip}, operating under the server user {node_username}."
success_message = f"MongoDB has started successfully on port {mongodb_port} at {public_ip}, operating under the server user {node_username}."

self.stdout(
success_message,
Expand All @@ -661,7 +663,7 @@ def _mongodb_node(
extra_details={
"node": {
"context": node_context,
"ip": node_ip,
"ip": public_ip,
"username": node_username,
},
"cluster": is_cluster_enabled,
Expand Down
14 changes: 7 additions & 7 deletions das-cli/src/commands/dbms_adapter/dbms_peer/dbms_peer_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DbmsPeerRun(Command):
--client-username admin \\
--client-password secret \\
--client-database das_data \\
--context /etc/das/context.txt
--configpath /etc/das/context.txt
"""

params = [
Expand Down Expand Up @@ -104,7 +104,7 @@ class DbmsPeerRun(Command):
default="postgres",
),
CommandOption(
["--context"],
["--configpath"],
help="Path to the configuration file for the DBMS peer client.",
type=AbsolutePath(
file_okay=True,
Expand Down Expand Up @@ -135,7 +135,7 @@ def _get_container(self) -> Container:

def _start_client(
self,
context: str,
configpath: str,
hostname: str,
port: int,
username: str,
Expand All @@ -150,7 +150,7 @@ def _start_client(
show_logs = self.output_format == "plain"

self._dbms_peer_container_manager.start_container(
context,
configpath,
hostname,
port,
username,
Expand All @@ -177,7 +177,7 @@ def _start_client(
container=self._get_container(),
extra_details={
"client": {
"context": context,
"context": configpath,
"hostname": hostname,
"port": port,
"username": username,
Expand All @@ -198,7 +198,7 @@ def _start_client(
)
def run(
self,
context: str,
configpath: str,
client_hostname: str,
client_port: int,
client_username: str,
Expand All @@ -214,7 +214,7 @@ def run(
)

self._start_client(
context,
configpath,
client_hostname,
client_port,
client_username,
Expand Down
2 changes: 2 additions & 0 deletions das-cli/src/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .utils import (
deep_merge_dicts,
extract_service_name,
get_platform_info,
get_rand_token,
get_script_name,
get_server_username,
Expand All @@ -42,6 +43,7 @@
"logger",
"Module",
"get_public_ip",
"get_platform_info",
"Choice",
"KeyValueType",
"VersionType",
Expand Down
Loading