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

Modify the directory name for machines deployed in AWS #5635

Conversation

Enaraque
Copy link
Member

@Enaraque Enaraque commented Aug 2, 2024

Description

Previously, with the AWS instances, the name of the default directory where the key, inventory and track was saved and received was the ID of the instance created, making it difficult to identify, unlike the directory created in Vagrant, where the ID displayed the instance name.

The naming of the directory created for AWS instances has been changed to make it easier to locate. This name now follows the same standards as Vagrant: <name-random_ID>.

Tests

Here are the different instances created with different tags.

--instance_name
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action create --provider aws --size micro --composite-name linux-ubuntu-22.04-amd64  --instance-name test-dir-track --label-termination-date "1d" --label-team "devops"
[2024-08-02 12:35:32] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:35:32] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:35:33] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-08-02 12:35:34] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-08-02 12:35:34] [DEBUG] ALLOCATOR: Generating new key pair
[2024-08-02 12:35:34] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-0DEA8668-8421-4C89-93A0-5ECE9228550E
[2024-08-02 12:36:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-0DEA8668-8421-4C89-93A0-5ECE9228550E directory to /tmp/wazuh-qa/test-dir-track-350
[2024-08-02 12:36:22] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-03118534489402f61 created.
[2024-08-02 12:36:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-03118534489402f61 started.
[2024-08-02 12:36:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: The inventory file generated at /tmp/wazuh-qa/test-dir-track-350/inventory.yaml
[2024-08-02 12:36:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: The track file generated at /tmp/wazuh-qa/test-dir-track-350/track.yaml
[2024-08-02 12:36:23] [WARNING] ALLOCATOR [TEST-DIR-TRACK]: Error on attempt 1 of 30: [Errno None] Unable to connect to port 2200 on XX.XX.XX.XX
[2024-08-02 12:36:53] [INFO] ALLOCATOR [TEST-DIR-TRACK]: SSH connection successful.
[2024-08-02 12:36:53] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-03118534489402f61 created successfully.
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# ls /tmp/wazuh-qa/test-dir-track-350
inventory.yaml  test-dir-track-key-3457  track.yaml

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# ls /tmp/wazuh-qa/test-dir-track-350
inventory.yaml  test-dir-track-key-3457  track.yaml

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action delete --track-output "/tmp/wazuh-qa/test-dir-track-350/track.yaml"
[2024-08-02 12:57:25] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:57:25] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:57:26] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/test-dir-track-350/track.yaml
[2024-08-02 12:57:26] [DEBUG] ALLOCATOR: Deleting credentials: test-dir-track-key-3457
[2024-08-02 12:58:28] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-03118534489402f61 deleted.
--label-issue
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action create --provider aws --size micro --composite-name linux-ubuntu-22.04-amd64 --label-issue "https://github.com/wazuh/wazuh-qa/issues/5631" --label-termination-date "1d" --label-team "devops"
[2024-08-02 12:22:26] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:22:26] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:22:26] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-08-02 12:22:27] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-08-02 12:22:27] [DEBUG] ALLOCATOR: Generating new key pair
[2024-08-02 12:22:27] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-126E7702-5E3C-427F-BEE5-42469DE693A6
[2024-08-02 12:23:00] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-126E7702-5E3C-427F-BEE5-42469DE693A6 directory to /tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675
[2024-08-02 12:23:00] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: Instance i-0769fa8c51f230d87 created.
[2024-08-02 12:23:01] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: Instance i-0769fa8c51f230d87 started.
[2024-08-02 12:23:01] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: The inventory file generated at /tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675/inventory.yaml
[2024-08-02 12:23:01] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: The track file generated at /tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675/track.yaml
[2024-08-02 12:23:01] [WARNING] ALLOCATOR [QA-5631-UBUNTU-22.04]: Error on attempt 1 of 30: [Errno None] Unable to connect to port 2200 on XX.XX.XX.XX
[2024-08-02 12:23:31] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: SSH connection successful.
[2024-08-02 12:23:31] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: Instance i-0769fa8c51f230d87 created successfully.

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# ls /tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675/
inventory.yaml  qa-5631-ubuntu-22.04-key-1955  track.yaml

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action delete --track-output "/tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675/track.yaml"
[2024-08-02 12:26:22] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:26:22] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:26:22] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/qa-5631-ubuntu-22.04-2675/track.yaml
[2024-08-02 12:26:23] [DEBUG] ALLOCATOR: Deleting credentials: qa-5631-ubuntu-22.04-key-1955
[2024-08-02 12:27:09] [INFO] ALLOCATOR [QA-5631-UBUNTU-22.04]: Instance i-0769fa8c51f230d87 deleted.
--instance-name & --label-issue
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action create --provider aws --size micro --composite-name linux-ubuntu-22.04-amd64 --label-issue "https://github.com/wazuh/wazuh-qa/issues/5631" --instance-name test-dir-track --label-termination-date "1d" --label-team "devops"
[2024-08-02 12:15:48] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:15:48] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:15:48] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-08-02 12:15:49] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-08-02 12:15:49] [DEBUG] ALLOCATOR: Generating new key pair
[2024-08-02 12:15:49] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-088D3B99-6137-4DBF-AF01-FD5C2E2C6153
[2024-08-02 12:16:22] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-088D3B99-6137-4DBF-AF01-FD5C2E2C6153 directory to /tmp/wazuh-qa/test-dir-track-6432
[2024-08-02 12:16:22] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-00e9685996f291d08 created.
[2024-08-02 12:16:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-00e9685996f291d08 started.
[2024-08-02 12:16:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: The inventory file generated at /tmp/wazuh-qa/test-dir-track-6432/inventory.yaml
[2024-08-02 12:16:23] [INFO] ALLOCATOR [TEST-DIR-TRACK]: The track file generated at /tmp/wazuh-qa/test-dir-track-6432/track.yaml
[2024-08-02 12:16:23] [WARNING] ALLOCATOR [TEST-DIR-TRACK]: Error on attempt 1 of 30: [Errno None] Unable to connect to port 2200 on XX.XX.XX.XX
[2024-08-02 12:16:53] [INFO] ALLOCATOR [TEST-DIR-TRACK]: SSH connection successful.
[2024-08-02 12:16:53] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-00e9685996f291d08 created successfully.
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# vi modules/allocation/aws/provider.py
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action delete --track-output "/tmp/wazuh-qa/test-dir-track-6432/track.yaml"
[2024-08-02 12:19:49] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:19:49] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:19:49] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/test-dir-track-6432/track.yaml
[2024-08-02 12:19:50] [DEBUG] ALLOCATOR: Deleting credentials: test-dir-track-key-9536
[2024-08-02 12:20:36] [INFO] ALLOCATOR [TEST-DIR-TRACK]: Instance i-00e9685996f291d08 deleted.
--composite-name
root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action create --provider aws --size micro --composite-name linux-ubuntu-22.04-amd64 --label-termination-date "1d" --label-team "devops"
[2024-08-02 12:29:51] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:29:51] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:29:51] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-08-02 12:29:52] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-08-02 12:29:52] [DEBUG] ALLOCATOR: Generating new key pair
[2024-08-02 12:29:52] [DEBUG] ALLOCATOR: Creating base directory: /tmp/wazuh-qa/AWS-C6B3B2AE-6637-46A9-8CFD-C652907F70AC
[2024-08-02 12:30:41] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-C6B3B2AE-6637-46A9-8CFD-C652907F70AC directory to /tmp/wazuh-qa/ubuntu-22.04-amd64-282
[2024-08-02 12:30:41] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: Instance i-01391bcb835c20095 created.
[2024-08-02 12:30:42] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: Instance i-01391bcb835c20095 started.
[2024-08-02 12:30:42] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: The inventory file generated at /tmp/wazuh-qa/ubuntu-22.04-amd64-282/inventory.yaml
[2024-08-02 12:30:42] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: The track file generated at /tmp/wazuh-qa/ubuntu-22.04-amd64-282/track.yaml
[2024-08-02 12:30:42] [WARNING] ALLOCATOR [UBUNTU-22.04-AMD64]: Error on attempt 1 of 30: [Errno None] Unable to connect to port 2200 on XX.XX.XX.XX
[2024-08-02 12:31:12] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: SSH connection successful.
[2024-08-02 12:31:12] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: Instance i-01391bcb835c20095 created successfully.

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# ls /tmp/wazuh-qa/ubuntu-22.04-amd64-282/
inventory.yaml  track.yaml  ubuntu-22.04-amd64-key-3684

root@ip-172-31-47-84:/home/ubuntu/wazuh-qa/deployability# python3 modules/allocation/main.py --action delete --track-output "/tmp/wazuh-qa/ubuntu-22.04-amd64-282/track.yaml"
[2024-08-02 12:33:09] [DEBUG] SPNEGO._GSS: Python gssapi not available, cannot use any GSSAPIProxy protocols: No module named 'gssapi'
[2024-08-02 12:33:09] [DEBUG] SPNEGO._GSS: Python gssapi IOV extension not available: No module named 'gssapi'
[2024-08-02 12:33:09] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/ubuntu-22.04-amd64-282/track.yaml
[2024-08-02 12:33:09] [DEBUG] ALLOCATOR: Deleting credentials: ubuntu-22.04-amd64-key-3684
[2024-08-02 12:33:56] [INFO] ALLOCATOR [UBUNTU-22.04-AMD64]: Instance i-01391bcb835c20095 deleted.

Related

@Enaraque Enaraque requested a review from a team August 2, 2024 13:07
@Enaraque Enaraque self-assigned this Aug 2, 2024
c-bordon
c-bordon previously approved these changes Aug 2, 2024
rauldpm
rauldpm previously requested changes Aug 2, 2024
Copy link
Member

@rauldpm rauldpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing changelog

@c-bordon
Copy link
Member

c-bordon commented Aug 2, 2024

Missing changelog

Done: 0d5d2b7

teddytpc1
teddytpc1 previously approved these changes Aug 2, 2024
CHANGELOG.md Outdated Show resolved Hide resolved
@rauldpm rauldpm dismissed their stale review August 7, 2024 13:32

Already reviewed by staff

@rauldpm rauldpm merged commit a1c0133 into 4.9.0 Aug 7, 2024
@rauldpm rauldpm deleted the change/5631-modify-the-directory-name-for-machines-deployed-in-aws branch August 7, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allocator module - Modify the directory name for machines deployed in AWS
5 participants