This is an automated email from the ASF dual-hosted git repository.
jialiang 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 db515684b5 AMBARI-26232 There will be failure when executing shell.py
and wrong order of imports for WidgetResourceProvider.java (#3872)
db515684b5 is described below
commit db515684b56c7914d4631c5c7058b68b124f14f1
Author: Peng Lu <[email protected]>
AuthorDate: Fri Nov 8 18:31:28 2024 +0800
AMBARI-26232 There will be failure when executing shell.py and wrong order
of imports for WidgetResourceProvider.java (#3872)
* There will be failure when executing shell.py
* Wrong order of imports for WidgetResourceProvider.java
* Fix issue of test failure
---
ambari-common/src/main/python/resource_management/core/shell.py | 5 +----
.../ambari/server/controller/internal/WidgetResourceProvider.java | 4 ++--
.../src/main/resources/custom_actions/scripts/check_host.py | 5 ++++-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/ambari-common/src/main/python/resource_management/core/shell.py
b/ambari-common/src/main/python/resource_management/core/shell.py
index 045ce383cc..e24df14e83 100644
--- a/ambari-common/src/main/python/resource_management/core/shell.py
+++ b/ambari-common/src/main/python/resource_management/core/shell.py
@@ -105,7 +105,7 @@ def checked_call(command, quiet=False, logoutput=None,
stdout=subprocess.PIPE,st
@log_function_call
def call(command, quiet=False, logoutput=None,
stdout=subprocess.PIPE,stderr=subprocess.STDOUT,
cwd=None, env=None, preexec_fn=preexec_fn, user=None,
wait_for_finish=True, timeout=None, on_timeout=None,
- path=None, sudo=False, on_new_line=None, tries=1, try_sleep=0,
timeout_kill_strategy=TerminateStrategy.TERMINATE_PARENT, returns=[0]):
+ path=None, sudo=False, on_new_line=None, tries=1, try_sleep=0,
timeout_kill_strategy=TerminateStrategy.TERMINATE_PARENT, shell=True,
returns=[0]):
"""
Execute the shell command despite failures.
@return: return_code, output
@@ -213,11 +213,8 @@ def _call(command, logoutput=None, throw_on_failure=True,
stdout=subprocess.PIPE
# replace placeholder from as_sudo / as_user if present
env_str = _get_environment_str(env)
for placeholder, replacement in PLACEHOLDERS_TO_STR.items():
- command = command.replace(placeholder, replacement.format(env_str=env_str))
subprocess_command = [cmd.replace(placeholder,
replacement.format(env_str=env_str)) for cmd in subprocess_command]
- # --noprofile is used to preserve PATH set for ambari-agent
- subprocess_command = ["/bin/bash","--login","--noprofile","-c", command]
if shell:
# --noprofile is used to preserve PATH set for ambari-agent
subprocess_command = ["/bin/bash","--login","--noprofile","-c"] +
subprocess_command
diff --git
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
index 3b4b5c9069..f29b2c0c5c 100644
---
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
+++
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/WidgetResourceProvider.java
@@ -56,10 +56,10 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import com.google.gson.JsonSerializer;
import com.google.gson.JsonElement;
-import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonPrimitive;
+import com.google.gson.JsonSerializationContext;
+import com.google.gson.JsonSerializer;
import com.google.inject.Inject;
/**
diff --git
a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
index 3e0871727c..1f5eac7acf 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py
@@ -454,7 +454,10 @@ class CheckHost(Script):
db_connection_check_command = "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:{0}{1}
{2}".format(agent_cache_dir,
LIBS_PATH_IN_ARCHIVE_SQLA, db_connection_check_command)
- code, out = shell.call(split(db_connection_check_command, comments=True),
shell=False)
+ if isinstance(db_connection_check_command, str):
+ code, out = shell.call(split(db_connection_check_command,
comments=True), shell=False)
+ else:
+ code, out = shell.call(db_connection_check_command, shell=False)
if code == 0:
db_connection_check_structured_output = {"exit_code" : 0, "message": "DB
connection check completed successfully!" }
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]