Skip to content

Commit

Permalink
remove stdio parameter for update_obcluster_nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodong-ji committed Nov 28, 2024
1 parent d5827ac commit 5887ef2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions common/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def get_observer_version(context):
stdio.verbose("get observer version, by sql")
obcluster = context.cluster_config
# by sql
observer_version = get_observer_version_by_sql(context, obcluster, stdio)
observer_version = get_observer_version_by_sql(context, obcluster)
except Exception as e:
try:
stdio.verbose("get observer version, by sql fail. by ssh")
Expand Down Expand Up @@ -325,15 +325,15 @@ def get_obproxy_version(context):
# Only applicable to the community version


def get_observer_version_by_sql(context, ob_cluster, stdio=None):
stdio.verbose("start get_observer_version_by_sql . input: {0}:{1}".format(ob_cluster.get("db_host"), ob_cluster.get("db_port")))
def get_observer_version_by_sql(context, ob_cluster):
context.stdio.verbose("start get_observer_version_by_sql . input: {0}:{1}".format(ob_cluster.get("db_host"), ob_cluster.get("db_port")))
try:
ob_connector = OBConnector(context=context, ip=ob_cluster.get("db_host"), port=ob_cluster.get("db_port"), username=ob_cluster.get("tenant_sys").get("user"), password=ob_cluster.get("tenant_sys").get("password"), timeout=100)
ob_version_info = ob_connector.execute_sql("select version();")
except Exception as e:
raise Exception("get_observer_version_by_sql Exception. Maybe cluster'info is error: " + e.__str__())
ob_version = ob_version_info[0]
stdio.verbose("get_observer_version_by_sql ob_version_info is {0}".format(ob_version))
context.stdio.verbose("get_observer_version_by_sql ob_version_info is {0}".format(ob_version))
version = re.findall(r'OceanBase(_)?(.CE)?-v(.+)', ob_version[0])
if len(version) > 0:
return version[0][2]
Expand Down
2 changes: 1 addition & 1 deletion core.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def update_obcluster_nodes(self, config):
if config_data['obcluster'] and config_data['obcluster']['servers'] and config_data['obcluster']['servers']['nodes']:
return
if Util.check_none_values(ob_cluster, self.stdio):
ob_version = get_observer_version_by_sql(self.context, ob_cluster, self.stdio)
ob_version = get_observer_version_by_sql(self.context, ob_cluster)
obConnetcor = OBConnector(context=self.context, ip=ob_cluster["db_host"], port=ob_cluster["db_port"], username=ob_cluster["tenant_sys"]["user"], password=ob_cluster["tenant_sys"]["password"], timeout=100)
sql = "select SVR_IP, SVR_PORT, ZONE, BUILD_VERSION from oceanbase.DBA_OB_SERVERS"
if ob_version.startswith("3") or ob_version.startswith("2") or ob_version.startswith("1"):
Expand Down
2 changes: 1 addition & 1 deletion handler/analyzer/analyze_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def init_option(self):
def get_version(self):
observer_version = ""
try:
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster, self.stdio)
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster)
except Exception as e:
self.stdio.warn("failed to get observer version:{0}".format(e))
self.stdio.verbose("get observer version: {0}".format(observer_version))
Expand Down
2 changes: 1 addition & 1 deletion handler/analyzer/analyze_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self, context, analyze_type='default'):
def get_version(self):
observer_version = ""
try:
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster, self.stdio)
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster)
except Exception as e:
self.stdio.warn("failed to get observer version:{0}".format(e))
self.stdio.verbose("get observer version: {0}".format(observer_version))
Expand Down
2 changes: 1 addition & 1 deletion handler/analyzer/analyze_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def init_option(self):
def get_version(self):
observer_version = ""
try:
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster, self.stdio)
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster)
except Exception as e:
self.stdio.warn("AnalyzeQueueHandler failed to get observer version:{0}".format(e))
self.stdio.verbose("AnalyzeQueueHandler get observer version: {0}".format(observer_version))
Expand Down
2 changes: 1 addition & 1 deletion handler/gather/gather_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def init_option(self):
def get_version(self):
observer_version = ""
try:
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster, self.stdio)
observer_version = get_observer_version_by_sql(self.context, self.ob_cluster)
except Exception as e:
self.stdio.warn("failed to get observer version:{0}".format(e))
self.stdio.verbose("get observer version: {0}".format(observer_version))
Expand Down

0 comments on commit 5887ef2

Please sign in to comment.