wazuh / qa-system-framework

GNU General Public License v2.0
1 stars 3 forks source link

HostManager: Include method to run a python script on a host #51

Closed BelenValdivia closed 9 months ago

BelenValdivia commented 1 year ago

Description

The HostManager class enables the execution of low-level tasks on remote hosts. It leverages the test-infra framework for performing these tasks remotely. It would be beneficial to introduce a new method that runs a Python script on a host.

BelenValdivia commented 1 year ago

07/06/2023

BelenValdivia commented 1 year ago

08/06/2023

 - name: run Python script
  hosts: windows1
  tasks:
    - name: run python_script.py script
      ansible.builtin.script:
        executable: python
        cmd: /home/belen/python_script.py
Rebits commented 1 year ago

09/06/2023

Meeting with @BelenValdivia about issues encountered with the testinfra syntaxis while using the Ansible task script. Currently, it appears that using windows.ansible('script', 'script_python_testing.py executable=python', check=False) solves the problem to some extent. However, we still need to conduct further research to ensure a comprehensive solution is in place.

BelenValdivia commented 1 year ago

12/06/2023 Created PR https://github.com/wazuh/qa-system-framework/pull/53

BelenValdivia commented 1 year ago

04/07/2023

pro-akim commented 1 year ago

11/07/23 Update

In communication with Belen, it was explained that it is required to add #!/usr/bin/env python3 or #!/usr/bin/env python to the script in order to make it work. It will be retested.

pro-akim commented 1 year ago

11/07/2023 Update

Adding #!/usr/bin/env python3 or #!/usr/bin/env python did not affect the result of the test.

BelenValdivia commented 1 year ago
pro-akim commented 1 year ago

Update

Tested in a different virtual environment and it worked. 2/3 reviews were passed. Approval from the last reviewer is pending.

BelenValdivia commented 1 year ago
BelenValdivia commented 1 year ago
BelenValdivia commented 1 year ago
BelenValdivia commented 1 year ago