Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playbook clean.yaml failed #5641

Closed
fcaffieri opened this issue Aug 7, 2024 · 7 comments · Fixed by #5672
Closed

Playbook clean.yaml failed #5641

fcaffieri opened this issue Aug 7, 2024 · 7 comments · Fixed by #5672
Assignees
Labels

Comments

@fcaffieri
Copy link
Member

fcaffieri commented Aug 7, 2024

Description

Almost all DTT tests show the following error when executing the clean.yaml playbook:

[37m[2024-08-06 19:52:54] [DEBUG] TESTER: Running playbook: /home/fcaffieri/repos/wazuh-qa/deployability/modules/testing/playbooks/cleanup.yml [0m
[0;34mUsing /etc/ansible/ansible.cfg as config file [0m

PLAY [all] ********************************************** ***********************

TASK [Gathering Facts] ********************************************* ************
[0;31mfatal: [ec2-54-80-254-201.compute-1.amazonaws.com]: FAILED! => changed=false [0m
[0;31m ansible_facts: {} [0m
[0;31m failed_modules: [0m
[0;31m ansible.legacy.setup: [0m
[0;31m ansible_facts: [0m
[0;31m discovered_interpreter_python: /usr/bin/python3 [0m
[0;31m failed: true [0m
[0;31m module_stderr: |- [0m
[0;31m OpenSSH_8.2p1 Ubuntu-4ubuntu0.11, OpenSSL 1.1.1f Mar 31, 2020 [0m
[0;31m debug1: Reading configuration data /etc/ssh/ssh_config [0m
[0;31m debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files [0m
[0;31m debug1: /etc/ssh/ssh_config line 21: Applying options for * [0m
[0;31m debug1: auto-mux: Trying existing master [0m
[0;31m Shared connection to ec2-54-80-254-201.compute-1.amazonaws.com closed [0m.
[0;31m module_stdout: |- [0m
[0;31m /bin/sh: /usr/bin/python3: No such file or directory [0m
[0;31m msg: |- [0m
[0;31m MODULE FAILURE [0m
[0;31m See stdout/stderr for the exact error [0m
[0;31m rc: 127 [0m
[0;31m warnings: [0m
[0;31m - No python interpreters found for host ec2-54-80-254-201.compute-1.amazonaws.com (tried ['python3.12', 'python3.11', 'python3.10', 'python3.9', 'python3.8', 'python3.7', '/usr/bin/python3', 'python3']) [0m
[0;31m msg: |- [0m
[0;31m The following modules failed to execute: ansible.legacy.setup [0m

PLAY RECAP ************************************************ *********************
[0;31mec2-54-80-254-201.compute-1.amazonaws.com [0m : ok=0 changed=0 unreachable=0 [0;31mfailed=1 [0m skipped=0 rescued=0 ignored=0

This playbook does not affect the tests, it is only used to clean the VM after finishing the test.
It is necessary to analyze whether it is necessary to continue using said playbook, since after the JobFlow ends the VM is deleted.
If necessary, this error must be fixed.


Another bug needs to be fixed:

Error:

�[31m[2024-08-12 17:24:29] [ERROR] [343073] [ThreadPoolExecutor-1_4] [jobflow]: [allocate-central_components-linux-redhat-8-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:29] [ERROR] [343073] [ThreadPoolExecutor-1_1] [jobflow]: [allocate-central_components-linux-ubuntu-22.04-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_6] [jobflow]: [allocate-central_components-linux-centos-7-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_8] [jobflow]: [allocate-central_components-linux-debian-10-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_10] [jobflow]: [allocate-central_components-linux-debian-12-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_5] [jobflow]: [allocate-central_components-linux-redhat-9-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_3] [jobflow]: [allocate-central_components-linux-redhat-7-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_2] [jobflow]: [allocate-central_components-linux-amazon-2-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_9] [jobflow]: [allocate-central_components-linux-debian-11-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_0] [jobflow]: [allocate-central_components-linux-ubuntu-20.04-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"
�[0m
�[31m[2024-08-12 17:24:30] [ERROR] [343073] [ThreadPoolExecutor-1_7] [jobflow]: [allocate-central_components-linux-centos-8-amd64] Task failed with error: Error executing process task Traceback (most recent call last):
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 39, in <module>
    main()
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/main.py", line 35, in main
    Allocator.run(InputPayload(**vars(parse_arguments())))
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 43, in run
    return cls.__delete(payload)
  File "/home/fcaffieri/repos/wazuh-qa/deployability/modules/allocation/allocation.py", line 96, in __delete
    with open(payload.track_output, 'r') as f:
OSError: [Errno 36] File name too long: "/tmp/dtt1-poc/central_components-['linux-ubuntu-20.04-amd64', 'linux-ubuntu-22.04-amd64', 'linux-amazon-2-amd64', 'linux-redhat-7-amd64', 'linux-redhat-8-amd64', 'linux-redhat-9-amd64', 'linux-centos-7-amd64', 'linux-centos-8-amd64', 'linux-debian-10-amd64', 'linux-debian-11-amd64', 'linux-debian-12-amd64']/track.yaml"

Fix the Centra Coponents clean up task

@wazuhci wazuhci moved this to Backlog in Release 4.9.0 Aug 7, 2024
@wazuhci wazuhci moved this from Backlog to Triage in Release 4.9.0 Aug 7, 2024
@wazuhci wazuhci moved this from Triage to Backlog in Release 4.9.0 Aug 8, 2024
@fcaffieri fcaffieri self-assigned this Aug 9, 2024
@fcaffieri
Copy link
Member Author

Update status

Analyzing the playbook that fails, executing some tests, and capturing logs.

@wazuhci wazuhci moved this from Backlog to In progress in Release 4.9.0 Aug 9, 2024
@fcaffieri
Copy link
Member Author

fcaffieri commented Aug 14, 2024

Update report

Work continued on this issue in parallel with the v4.9.0-beta2 release, taking advantage of the release tests, to test the modifications on the clean.yaml playbook error

Test full agents with playbooks modifications 🟢

@fcaffieri
Copy link
Member Author

Working on the new bug added to the issue about Central Componentes clean up error

@fcaffieri
Copy link
Member Author

fcaffieri commented Aug 15, 2024

Update report

The error with the cleanup of the VMs of the central components tests is due to a bad configuration in the input yaml set.

For example, in the yaml used in the Deployability test, in the issue

The variable that contains all the definitions of all the VMS is used.

image

The correct thing to do is to use the variable defined as tag as.

Execution with the correction to the input yaml:

@fcaffieri fcaffieri linked a pull request Aug 15, 2024 that will close this issue
@wazuhci wazuhci moved this from In progress to Pending review in Release 4.9.0 Aug 15, 2024
@wazuhci wazuhci moved this from Pending review to In review in Release 4.9.0 Aug 16, 2024
@wazuhci wazuhci moved this from In review to Pending final review in Release 4.9.0 Aug 16, 2024
@wazuhci wazuhci moved this from Pending final review to In final review in Release 4.9.0 Aug 16, 2024
@juliamagan
Copy link
Member

Central components examples fixed in #5615

@wazuhci wazuhci moved this from In final review to Done in Release 4.9.0 Aug 16, 2024
@fcaffieri
Copy link
Member Author

fcaffieri commented Sep 3, 2024

The issue is reopened as the error appears again in the following issue: wazuh/wazuh#25497
It seems to be an issue with the local environment where the test runs, as I performed the following tests and it worked correctly on my local:
Test:

YAML
version: 0.1
description: This workflow is used to test agents deployment for DDT1 PoC
variables:
  macos-agent-os:
    - macos-ventura-13-amd64

  manager-os: linux-ubuntu-22.04-amd64
  infra-provider: aws
  macos-infra-provider: vagrant
  working-dir: /tmp/dtt1-poc

tasks:
  # Unique manager allocate task
  - task: "allocate-manager-{manager-os}"
    description: "Allocate resources for the manager."
    do:
      this: process
      with:
        path: python3
        args:
          - modules/allocation/main.py
          - action: create
          - provider: "{infra-provider}"
          - size: large
          - composite-name: "{manager-os}"
          - inventory-output: "{working-dir}/manager-{manager-os}/inventory.yaml"
          - track-output: "{working-dir}/manager-{manager-os}/track.yaml"
          - label-termination-date: "1d"
          - label-team: "qa"
          - label-issue: "https://github.com/wazuh/wazuh/issues/25497"
    cleanup:
      this: process
      with:
        path: python3
        args:
          - modules/allocation/main.py
          - action: delete
          - track-output: "{working-dir}/manager-{manager-os}/track.yaml"

  # Unique manager provision task
  - task: "provision-manager-{manager-os}"
    description: "Provision the manager."
    do:
      this: process
      with:
        path: python3
        args:
          - modules/provision/main.py
          - inventory: "{working-dir}/manager-{manager-os}/inventory.yaml"
          - install:
            - component: wazuh-manager
              type: assistant
              version: 4.9.0
              live: False
    depends-on:
      - "allocate-manager-{manager-os}"
    on-error: "abort-all"

  # Unique agent allocate task
  - task: "allocate-macos-agent-{agent}"
    description: "Allocate resources for the agent."
    do:
      this: process
      with:
        path: python3
        args:
          - modules/allocation/main.py
          - action: create
          - provider: "{macos-infra-provider}"
          - size: small
          - composite-name: "{agent}"
          - inventory-output: "{working-dir}/agent-{agent}/inventory.yaml"
          - track-output: "{working-dir}/agent-{agent}/track.yaml"
          - label-termination-date: "1d"
          - label-team: "qa"
          - label-issue: "https://github.com/wazuh/wazuh/issues/25497"
    foreach:
      - variable: macos-agent-os
        as: agent
    depends-on:
      - "provision-manager-{manager-os}"
    cleanup:
      this: process
      with:
        path: python3
        args:
          - modules/allocation/main.py
          - action: delete
          - track-output: "{working-dir}/agent-{agent}/track.yaml"

  # Generic agent test task
  - task: "run-macos-agent-{agent}-tests"
    description: "Run tests install for the agent {agent}."
    do:
      this: process
      with:
        path: python3
        args:
          - modules/testing/main.py
          - targets:
            - wazuh-1: "{working-dir}/manager-{manager-os}/inventory.yaml"
            - agent: "{working-dir}/agent-{agent}/inventory.yaml"
          - tests: "install,registration,connection,basic_info,restart,stop,uninstall"
          - component: "agent"
          - wazuh-version: "4.9.0"
          - wazuh-revision: "40907"
          - live: False
    foreach:
      - variable: macos-agent-os
        as: agent
    depends-on:
      - "allocate-macos-agent-{agent}"

Logs:
Test-agents-cleanup.log

@fcaffieri fcaffieri reopened this Sep 3, 2024
@wazuhci wazuhci moved this from Done to Triage in Release 4.9.0 Sep 3, 2024
@rauldpm
Copy link
Member

rauldpm commented Sep 4, 2024

Closed again, we will open a new issue instead of reopening a closed issue with a PR already merged

@rauldpm rauldpm closed this as completed Sep 4, 2024
@wazuhci wazuhci moved this from Triage to Done in Release 4.9.0 Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants