X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FTrafficScriptExecutor.py;h=0a45a0b22fc9164277dfe08054ea2c14053e8b77;hb=d07f6cae7f18c1513650d4cb690115d60201e704;hp=a9a733bbdfdc9e2340e8196c42cad80d9620d3a2;hpb=d68951ac245150eeefa6e0f4156e4c1b5c9e9325;p=csit.git diff --git a/resources/libraries/python/TrafficScriptExecutor.py b/resources/libraries/python/TrafficScriptExecutor.py index a9a733bbdf..0a45a0b22f 100644 --- a/resources/libraries/python/TrafficScriptExecutor.py +++ b/resources/libraries/python/TrafficScriptExecutor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -55,11 +55,11 @@ class TrafficScriptExecutor: """ ssh = SSH() ssh.connect(node) + module_name = script_file_name[:-3].replace('/', '.') cmd = f"cd {Constants.REMOTE_FW_DIR}; virtualenv -p $(which python3) " \ f"--system-site-packages --never-download env && " \ f"export PYTHONPATH=${{PWD}}; . ${{PWD}}/env/bin/activate; " \ - f"resources/traffic_scripts/{script_file_name} {script_args}" - + f"cd GPL; python -m traffic_scripts.{module_name} {script_args}" ret_code, stdout, stderr = ssh.exec_command_sudo( f'sh -c "{TrafficScriptExecutor._escape(cmd)}"', timeout=timeout )