This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push:
new ed9a149fb7 fix: resolve python3 compiler warnings (#2) (#3781)
ed9a149fb7 is described below
commit ed9a149fb7e07ab032778410a5c7d3b558e1ee20
Author: William Horn <[email protected]>
AuthorDate: Thu Apr 18 13:14:05 2024 -0400
fix: resolve python3 compiler warnings (#2) (#3781)
---
.../src/main/python/ambari_agent/HostCleanup.py | 2 +-
.../libraries/functions/component_version.py | 2 +-
ambari-server/src/main/python/ambari-server.py | 4 ++--
.../src/main/python/ambari_server/dbConfiguration.py | 6 +++---
.../python/ambari_server/dbConfiguration_windows.py | 4 ++--
.../main/python/ambari_server/serverConfiguration.py | 20 ++++++++++----------
.../src/main/python/ambari_server/userInput.py | 2 +-
.../resources/scripts/check_ambari_permissions.py | 2 +-
8 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
index 1103fcc7ce..11f94c04bd 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostCleanup.py
@@ -617,7 +617,7 @@ def get_choice_string_input(prompt, default, firstChoice,
secondChoice):
return True
elif choice in secondChoice:
return False
- elif choice is "": # Just enter pressed
+ elif choice == "": # Just enter pressed
return default
else:
print("input not recognized, please try again: ")
diff --git
a/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py
b/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py
index 42d159f39c..b01b906eee 100644
---
a/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py
+++
b/ambari-common/src/main/python/resource_management/libraries/functions/component_version.py
@@ -64,7 +64,7 @@ def _get_component_repositories(config):
:config: the configuration dictionary
:return:
"""
- if "componentVersionMap" not in config or config["componentVersionMap"] is
"":
+ if "componentVersionMap" not in config or config["componentVersionMap"] ==
"":
return None
return config["componentVersionMap"]
diff --git a/ambari-server/src/main/python/ambari-server.py
b/ambari-server/src/main/python/ambari-server.py
index 87b12204a6..320c788ec7 100755
--- a/ambari-server/src/main/python/ambari-server.py
+++ b/ambari-server/src/main/python/ambari-server.py
@@ -731,13 +731,13 @@ def are_db_auth_options_ok(db_windows_auth, db_username,
db_password):
if db_windows_auth is True:
return True
else:
- if db_username is not None and db_username is not "" and db_password is
not None and db_password is not "":
+ if db_username is not None and db_username != "" and db_password is not
None and db_password != "":
return True
return False
@OsFamilyFuncImpl(OSConst.WINSRV_FAMILY)
def are_cmd_line_db_args_valid(options):
- if (options.database_host is not None and options.database_host is not "" \
+ if (options.database_host is not None and options.database_host != "" \
#and options.database_name is not None \ # ambari by default is
ok
and are_db_auth_options_ok(options.database_windows_auth,
options.database_username,
diff --git a/ambari-server/src/main/python/ambari_server/dbConfiguration.py
b/ambari-server/src/main/python/ambari_server/dbConfiguration.py
index 9e8c1ffdea..0f0a272a45 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration.py
@@ -239,20 +239,20 @@ class DBMSConfig(object):
@staticmethod
def _init_member_with_default(options, attr_name, default_val):
options_val = getattr(options, attr_name, None)
- val = options_val if options_val is not None and options_val is not ""
else default_val
+ val = options_val if options_val is not None and options_val != "" else
default_val
return val
@staticmethod
def _init_member_with_properties(options, attr_name, properties,
property_key):
options_val = getattr(options, attr_name, None)
- if options_val is None or options_val is "":
+ if options_val is None or options_val == "":
options_val = get_value_from_properties(properties, property_key, None)
return options_val
@staticmethod
def _init_member_with_prop_default(options, attr_name, properties,
property_key, default_val):
val = DBMSConfig._init_member_with_properties(options, attr_name,
properties, property_key)
- if val is None or val is "":
+ if val is None or val == "":
val = default_val
return val
diff --git
a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py
b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py
index d40548bdf1..e57f2f8a8b 100644
--- a/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py
+++ b/ambari-server/src/main/python/ambari_server/dbConfiguration_windows.py
@@ -198,7 +198,7 @@ class MSSQLConfig(DBMSConfig):
try:
driver_path = properties[JDBC_DRIVER_PATH_PROPERTY]
- if driver_path is None or driver_path is "":
+ if driver_path is None or driver_path == "":
return 0
except Exception:
# No such attribute set
@@ -324,7 +324,7 @@ class MSSQLAmbariDBConfig(MSSQLConfig):
super(MSSQLAmbariDBConfig, self).__init__(options, properties,
storage_type)
- if self.database_name is None or self.database_name is "":
+ if self.database_name is None or self.database_name == "":
self.database_name = AMBARI_DATABASE_NAME
self.persistence_property = PERSISTENCE_TYPE_PROPERTY
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index 2d962d9707..cec3fd7100 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -1041,7 +1041,7 @@ def get_original_master_key(properties, options = None):
# Decrypt alias with master to validate it, if no master return
password = None
- if alias and env_master_key and env_master_key is not "" and
env_master_key != "None":
+ if alias and env_master_key and env_master_key != "" and env_master_key !=
"None":
password = read_passwd_for_alias(alias, env_master_key, options)
if not password:
try:
@@ -1356,31 +1356,31 @@ class JDKRelease:
inst_dir = ""
def __init__(self, i_name, i_desc, i_url, i_dest_file, i_jcpol_url,
i_dest_jcpol_file, i_inst_dir, i_reg_exp):
- if i_name is None or i_name is "":
+ if i_name is None or i_name == "":
raise FatalException(-1, "Invalid JDK name: " + (i_desc or ""))
self.name = i_name
- if i_desc is None or i_desc is "":
+ if i_desc is None or i_desc == "":
self.desc = self.name
else:
self.desc = i_desc
- if i_url is None or i_url is "":
+ if i_url is None or i_url == "":
raise FatalException(-1, "Invalid URL for JDK " + i_name)
self.url = i_url
- if i_dest_file is None or i_dest_file is "":
+ if i_dest_file is None or i_dest_file == "":
self.dest_file = i_name + ".exe"
else:
self.dest_file = i_dest_file
- if not (i_jcpol_url is None or i_jcpol_url is ""):
+ if not (i_jcpol_url is None or i_jcpol_url == ""):
self.jcpol_url = i_jcpol_url
- if i_dest_jcpol_file is None or i_dest_jcpol_file is "":
+ if i_dest_jcpol_file is None or i_dest_jcpol_file == "":
self.dest_jcpol_file = "jcpol-" + i_name + ".zip"
else:
self.dest_jcpol_file = i_dest_jcpol_file
- if i_inst_dir is None or i_inst_dir is "":
+ if i_inst_dir is None or i_inst_dir == "":
self.inst_dir = os.path.join(configDefaults.JDK_INSTALL_DIR, i_desc)
else:
self.inst_dir = i_inst_dir
- if i_reg_exp is None or i_reg_exp is "":
+ if i_reg_exp is None or i_reg_exp == "":
raise FatalException(-1, "Invalid output parsing regular expression for
JDK " + i_name)
self.reg_exp = i_reg_exp
@@ -1392,7 +1392,7 @@ class JDKRelease:
@staticmethod
def __load_properties(properties, section_name):
- if section_name is None or section_name is "":
+ if section_name is None or section_name == "":
raise FatalException(-1, "Invalid properties section: " + ("(empty)" if
section_name is None else ""))
if(properties.__contains__(section_name + ".desc")): #Not critical
desc = properties[section_name + ".desc"]
diff --git a/ambari-server/src/main/python/ambari_server/userInput.py
b/ambari-server/src/main/python/ambari_server/userInput.py
index 69182bf962..0076c0b24f 100644
--- a/ambari-server/src/main/python/ambari_server/userInput.py
+++ b/ambari-server/src/main/python/ambari_server/userInput.py
@@ -58,7 +58,7 @@ def get_choice_string_input(prompt, default, firstChoice,
secondChoice, answer =
elif choice in secondChoice:
result = False
inputBool = False
- elif choice is "": # Just enter pressed
+ elif choice == "": # Just enter pressed
result = default
inputBool = False
else:
diff --git
a/ambari-server/src/main/resources/scripts/check_ambari_permissions.py
b/ambari-server/src/main/resources/scripts/check_ambari_permissions.py
index d456c1d3b9..ce94881e68 100644
--- a/ambari-server/src/main/resources/scripts/check_ambari_permissions.py
+++ b/ambari-server/src/main/resources/scripts/check_ambari_permissions.py
@@ -79,7 +79,7 @@ def get_choice_string_input(prompt, default, firstChoice,
secondChoice):
return True
elif choice in secondChoice:
return False
- elif choice is "": # Just enter pressed
+ elif choice == "": # Just enter pressed
return default
else:
print("input not recognized, please try again: ")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]