def install(self, unique_id, configs=None):
<EOL>if configs is None:<EOL><INDENT>configs = {}<EOL><DEDENT>tmp = self.default_configs.copy()<EOL>tmp.update(configs)<EOL>configs = tmp<EOL>hostname = None<EOL>is_tarfile = False<EOL>is_zipfile = False<EOL>if unique_id in self.processes and  '<STR_LIT>' in configs:<EOL><INDENT>self.uninstall(unique_id, configs)<EOL>hostname = configs['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in configs:<EOL><INDENT>hostname = configs['<STR_LIT>']<EOL><DEDENT>elif unique_id not in self.processes:<EOL><INDENT>raise DeploymentError("<STR_LIT>" + unique_id)<EOL><DEDENT>env = configs.get("<STR_LIT>", {})<EOL>install_path = configs.get('<STR_LIT>') or self.default_configs.get('<STR_LIT>')<EOL>pid_file = configs.get('<STR_LIT>') or self.default_configs.get('<STR_LIT>')<EOL>if install_path is None:<EOL><INDENT>logger.error("<STR_LIT>" + unique_id)<EOL>raise DeploymentError("<STR_LIT>" + unique_id)<EOL><DEDENT>if not configs.get('<STR_LIT>', False):<EOL><INDENT>with get_ssh_client(hostname, username=runtime.get_username(), password=runtime.get_password()) as ssh:<EOL><INDENT>log_output(better_exec_command(ssh, "<STR_LIT>".format(install_path),<EOL>"<STR_LIT>".format(install_path)))<EOL>log_output(better_exec_command(ssh, "<STR_LIT>".format(install_path),<EOL>"<STR_LIT>".format(install_path)))<EOL>executable = configs.get('<STR_LIT>') or self.default_configs.get('<STR_LIT>')<EOL>if executable is None:<EOL><INDENT>logger.error("<STR_LIT>" + unique_id)<EOL>raise DeploymentError("<STR_LIT>" + unique_id)<EOL><DEDENT>copy_from_remote_location = False;<EOL>if ("<STR_LIT::>" in executable):<EOL><INDENT>copy_from_remote_location = True<EOL>if ("<STR_LIT:http>" not in executable):<EOL><INDENT>remote_location_server = executable.split("<STR_LIT::>")[<NUM_LIT:0>]<EOL>remote_file_path = executable.split("<STR_LIT::>")[<NUM_LIT:1>] <EOL>remote_file_name = os.path.basename(remote_file_path)<EOL>local_temp_file_name = os.path.join(configs.get("<STR_LIT>","<STR_LIT>"),remote_file_name)<EOL>if not os.path.exists(local_temp_file_name):<EOL><INDENT>with get_sftp_client(remote_location_server,username=runtime.get_username(), password=runtime.get_password()) as ftp:<EOL><INDENT>try:<EOL><INDENT>ftp.get(remote_file_path, local_temp_file_name)<EOL>executable = local_temp_file_name<EOL><DEDENT>except:<EOL><INDENT>raise DeploymentError("<STR_LIT>" + executable)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>else:    <EOL><INDENT>remote_file_name = executable.split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>local_temp_file_name = os.path.join(configs.get("<STR_LIT>","<STR_LIT>"),remote_file_name)<EOL>if not os.path.exists(local_temp_file_name):<EOL><INDENT>try:<EOL><INDENT>urllib.urlretrieve (executable, local_temp_file_name)<EOL><DEDENT>except:<EOL><INDENT>raise DeploymentError("<STR_LIT>" + executable)<EOL><DEDENT><DEDENT>executable = local_temp_file_name    <EOL><DEDENT><DEDENT>try:                     <EOL><INDENT>exec_name = os.path.basename(executable)<EOL>install_location = os.path.join(install_path, exec_name)<EOL>with get_sftp_client(hostname, username=runtime.get_username(), password=runtime.get_password()) as ftp:<EOL><INDENT>ftp.put(executable, install_location)<EOL><DEDENT><DEDENT>except:<EOL><INDENT>raise DeploymentError("<STR_LIT>" + install_location)<EOL><DEDENT>finally:<EOL><INDENT>is_tarfile = tarfile.is_tarfile(executable)<EOL>is_zipfile = zipfile.is_zipfile(executable)<EOL>if (copy_from_remote_location and not configs.get('<STR_LIT>',False)):<EOL><INDENT>os.remove(executable)       <EOL><DEDENT><DEDENT>if configs.get('<STR_LIT>', False) or self.default_configs.get('<STR_LIT>', False):<EOL><INDENT>if is_tarfile:<EOL><INDENT>log_output(better_exec_command(ssh, "<STR_LIT>".format(install_location, install_path),<EOL>"<STR_LIT>".format(exec_name)))<EOL><DEDENT>elif is_zipfile:<EOL><INDENT>log_output(better_exec_command(ssh, "<STR_LIT>".format(install_location, install_path),<EOL>"<STR_LIT>".format(exec_name)))<EOL><DEDENT>else:<EOL><INDENT>logger.error(executable + "<STR_LIT>")<EOL>raise DeploymentError(executable + "<STR_LIT>")<EOL><DEDENT><DEDENT>post_install_cmds = configs.get('<STR_LIT>', False) or self.default_configs.get('<STR_LIT>', [])<EOL>for cmd in post_install_cmds:<EOL><INDENT>relative_cmd = "<STR_LIT>".format(install_path, cmd)<EOL>log_output(exec_with_env(ssh, relative_cmd,<EOL>msg="<STR_LIT>".format(relative_cmd), env=env))<EOL><DEDENT><DEDENT><DEDENT>self.processes[unique_id] = Process(unique_id, self.service_name, hostname, install_path)<EOL>self.processes[unique_id].pid_file = pid_file<EOL>
Copies the executable to the remote machine under install path. Inspects the configs for the possible keys
'hostname': the host to install on
'install_path': the location on the remote host
'executable': the executable to copy
'no_copy': if this config is passed in and true then this method will not copy the executable assuming that it is
already installed
'post_install_cmds': an optional list of commands that should be executed on the remote machine after the
 executable has been installed. If no_copy is set to true, then the post install commands will not be run.

If the unique_id is already installed on a different host, this will perform the cleanup action first.
If either 'install_path' or 'executable' are provided the new value will become the default.

:param unique_id:
:param configs:
:return: