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
2 changes: 1 addition & 1 deletion ambari-agent/src/main/python/ambari_agent/HostCleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 2 additions & 2 deletions ambari-server/src/main/python/ambari-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,20 +239,20 @@ def _read_password_from_properties(properties, options):
@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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _is_jdbc_driver_installed(self, properties):

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
Expand Down Expand Up @@ -324,7 +324,7 @@ def __init__(self, options, properties, storage_type):

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
Expand Down
20 changes: 10 additions & 10 deletions ambari-server/src/main/python/ambari_server/serverConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand All @@ -1392,7 +1392,7 @@ def from_properties(cls, properties, section_name):

@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"]
Expand Down
2 changes: 1 addition & 1 deletion ambari-server/src/main/python/ambari_server/userInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: ")
Expand Down