def _get_remote_script_line(self, scriptFile): # Detect the existing sqlplus flavor try: find_in_path("sqlplus64") tool = "sqlplus64" except: tool = "sqlplus" ORACLE_EXEC_ARGS = "{0} -S -L '{1}/{2}@(description=(address=(protocol=TCP)(host={3})(port={4}))(connect_data=({7}={5})))' @{6} {1}" return ORACLE_EXEC_ARGS.format(tool, self.database_username, self.database_password, self.database_host, self.database_port, self.database_name, scriptFile, self.sid_or_sname)
def _get_remote_script_line(self, scriptFile): # Detect the existing sqlplus flavor try: find_in_path("sqlplus64") tool = "sqlplus64" except: tool = "sqlplus" ORACLE_EXEC_ARGS = "{0} -S -L '{1}/{2}@(description=(address=(protocol=TCP)(host={3})(port={4}))(connect_data=({7}={5})))' @{6} {1}" return ORACLE_EXEC_ARGS.format( tool, self.database_username, self.database_password, self.database_host, self.database_port, self.database_name, scriptFile, self.sid_or_sname )
def parse_options(): # parse env cmd with open(os.path.join(os.getcwd(), "ambari-env.cmd"), "r") as env_cmd: content = env_cmd.readlines() for line in content: if line.startswith("set"): name, value = line[4:].split("=") os.environ[name] = value.rstrip() # checking env variables, and fallback to working dir if no env var was founded if not os.environ.has_key("AMBARI_AGENT_CONF_DIR"): os.environ["AMBARI_AGENT_CONF_DIR"] = os.getcwd() if not os.environ.has_key("AMBARI_AGENT_LOG_DIR"): 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")