diff --git a/winagent/installer.py b/winagent/installer.py index 93aa41b..51d65bf 100644 --- a/winagent/installer.py +++ b/winagent/installer.py @@ -31,6 +31,7 @@ def __init__( local_salt, local_mesh, cert, + cmd_timeout, log_level, log_to="stdout", ): @@ -49,6 +50,7 @@ def __init__( self.local_salt = local_salt self.local_mesh = local_mesh self.cert = cert + self.cmd_timeout = cmd_timeout if cmd_timeout else 900 def install(self): # check for existing installation and exit if found @@ -214,7 +216,9 @@ def install(self): meshAgent.remove_mesh(exe=mesh) # install mesh - self.mesh_node_id = meshAgent.install_mesh(exe=mesh) + self.mesh_node_id = meshAgent.install_mesh( + exe=mesh, cmd_timeout=self.cmd_timeout + ) self.logger.debug(f"{self.mesh_node_id=}") sys.stdout.flush() @@ -296,7 +300,7 @@ def install(self): try: install_salt = subprocess.run( - salt_cmd, cwd=self.programdir, shell=True, timeout=300 + salt_cmd, cwd=self.programdir, shell=True, timeout=self.cmd_timeout ) except Exception as e: self.logger.error(e) diff --git a/winagent/mesh.py b/winagent/mesh.py index 5055964..ada799d 100644 --- a/winagent/mesh.py +++ b/winagent/mesh.py @@ -58,13 +58,15 @@ def remove_mesh(self, exe): if self.mesh_dir: remove_dir(self.mesh_dir) - def install_mesh(self, exe): + def install_mesh(self, exe, cmd_timeout): attempts = 0 retries = 5 print("Installing mesh agent", flush=True) try: - ret = subprocess.run([exe, "-fullinstall"], capture_output=True, timeout=60) + ret = subprocess.run( + [exe, "-fullinstall"], capture_output=True, timeout=cmd_timeout + ) except Exception as e: self.logger.error(e) sys.stdout.flush() diff --git a/winagent/tacticalrmm.py b/winagent/tacticalrmm.py index 07e7c30..b04b337 100644 --- a/winagent/tacticalrmm.py +++ b/winagent/tacticalrmm.py @@ -12,6 +12,7 @@ def main(): parser.add_argument("--api", action="store", dest="api_url", type=str) parser.add_argument("--client-id", action="store", dest="client_id", type=int) parser.add_argument("--site-id", action="store", dest="site_id", type=int) + parser.add_argument("--timeout", action="store", dest="cmd_timeout", type=int) parser.add_argument( "--desc", action="store", @@ -164,6 +165,7 @@ def main(): local_salt=args.local_salt, local_mesh=args.local_mesh, cert=args.cert, + cmd_timeout=args.cmd_timeout, ) installer.install()