فهرست منبع

AMBARI-8557 - Python EXE path seems to be hardcoded in ambari-env.cmd (Eugene Chekanskiy via abaranchuk)

Artem Baranchuk 10 سال پیش
والد
کامیت
dcbc0d9567
2فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 1 3
      ambari-agent/conf/windows/ambari-env.cmd
  2. 3 0
      ambari-agent/conf/windows/service_wrapper.py

+ 1 - 3
ambari-agent/conf/windows/ambari-env.cmd

@@ -15,8 +15,6 @@ REM See the License for the specific language governing permissions and
 REM limitations under the License.
 
 set SERVICE_NAME=Ambari Agent
-REM REM set AMBARI_AGENT_CONF_DIR=C:\work\test\agent
+REM set AMBARI_AGENT_CONF_DIR=C:\work\test\agent
 REM set AMBARI_AGENT_LOG_DIR=logs
 set AGENT_SERVICE_WRAPPER=sbin\service_wrapper.py
-REM python exe that will be used for command execution(must have access to pywin32 and agent python code)
-set PYTHON_EXE=C:\Python27\python.exe

+ 3 - 0
ambari-agent/conf/windows/service_wrapper.py

@@ -28,6 +28,7 @@ from ambari_commons.ambari_service import AmbariService, ENV_PYTHON_PATH
 from ambari_commons.exceptions import *
 from ambari_commons.logging_utils import *
 from ambari_commons.os_windows import WinServiceController
+from ambari_commons.os_utils import find_in_path
 from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_agent.HeartbeatHandlers import HeartbeatStopHandlers
 
@@ -55,6 +56,8 @@ def parse_options():
     os.environ["AMBARI_AGENT_LOG_DIR"] = os.path.join("\\", "var", "log", "ambari-agent")
   if not os.path.exists(os.environ["AMBARI_AGENT_LOG_DIR"]):
     os.makedirs(os.environ["AMBARI_AGENT_LOG_DIR"])
+  if not os.environ.has_key("PYTHON_EXE"):
+    os.environ["PYTHON_EXE"] = find_in_path("python.exe")
 
 
 class AmbariAgentService(AmbariService):