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

Transform run directory to current working directory (globally available --cwd) #612

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

PaulFarault
Copy link
Contributor

@PaulFarault PaulFarault commented Jul 18, 2024

Which issue(s) this PR fixes

Fixes #488

The --run-directory option is only applied to the the tdp deploy command. We should extend it's usage to the whole CLI so that other features can benefit from it.

In particular, inventory parsing does not work if tdp commands are launched from another location.

Additional comments

I needed to implement singleton pattern because of ansible strange way to initialize it's config (when importing a module, creating a class, etc.).

Agreements

@PaulFarault PaulFarault self-assigned this Jul 18, 2024
@PaulFarault PaulFarault force-pushed the fix/run-directory branch 5 times, most recently from 08d3e55 to 3f64a5a Compare July 18, 2024 12:46
@PaulFarault PaulFarault marked this pull request as ready for review July 18, 2024 12:58
@PaulFarault PaulFarault changed the title Fix run directory Transform run directory to current working directory (globally available --cwd) Jul 18, 2024
@SteBaum
Copy link
Contributor

SteBaum commented Jul 19, 2024

When I try executing a deployment from another directory I have the following error:

(venv) sbaume-consultant01@M093-1309930:~/Documents/tdp/tdp-ops/tdp/tdp-lib$ tdp --env /home/sbaume-consultant01/Documents/tdp/tdp-ops/.env --cwd /home/sbaume-consultant01/Documents/tdp/tdp-ops deploy
2024-07-19 10:48:59,189 - INFO - root - Logging is configured.
[WARNING]: Could not match supplied host pattern, ignoring: kafka_broker
[WARNING]: Could not match supplied host pattern, ignoring: zk_kafka_client
[WARNING]: Could not match supplied host pattern, ignoring: zk_kafka
[WARNING]: Could not match supplied host pattern, ignoring: kafka_client
[WARNING]: Could not match supplied host pattern, ignoring: zk_kafka_edge
[WARNING]: Could not match supplied host pattern, ignoring: airflow

PLAY [jmx-exporter install] ****************************************************

TASK [Gathering Facts] *********************************************************
ok: [sbaum-master-01]
ok: [sbaum-worker-01]
ok: [sbaum-master-03]
ok: [sbaum-worker-02]
ok: [sbaum-master-02]
ok: [sbaum-edge-01]
ok: [sbaum-worker-03]

TASK [tosit.tdp.resolve] *******************************************************
ok: [sbaum-master-01]
ok: [sbaum-master-03]
ok: [sbaum-master-02]
ok: [sbaum-worker-02]
ok: [sbaum-worker-03]
ok: [sbaum-worker-01]
ok: [sbaum-edge-01]

TASK [tosit.tdp.jmx : Ensure "/opt/tdp/jmx-exporter" exists] *******************
ok: [sbaum-master-01]
ok: [sbaum-master-03]
ok: [sbaum-worker-01]
ok: [sbaum-edge-01]
ok: [sbaum-worker-02]
ok: [sbaum-master-02]
ok: [sbaum-worker-03]

TASK [tosit.tdp.jmx : Upload jmx-exporter jar] *********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-master-01]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-master-02]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-master-03]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-worker-01]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-worker-02]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-edge-01]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [sbaum-worker-03]: FAILED! => {
    "changed": false
}

MSG:

Could not find or access '/home/sbaume-consultant01/Documents/tdp/tdp-ops/tdp/tdp-lib/files/jmx_prometheus_javaagent-0.16.1.jar' on the Ansible Controller.
If you are using a module and expect the file to exist on the remote, see the remote_src option

NO MORE HOSTS LEFT *************************************************************

PLAY RECAP *********************************************************************
sbaum-edge-01              : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-master-01            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-master-02            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-master-03            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-worker-01            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-worker-02            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
sbaum-worker-03            : ok=3    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Error: Deployment failed.

Copy link
Contributor Author

@PaulFarault PaulFarault left a comment

Choose a reason for hiding this comment

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

Can you specify in which directory your tar.gz are saved?

@PACordonnier PACordonnier self-requested a review October 18, 2024 13:37
Copy link
Member

@PACordonnier PACordonnier left a comment

Choose a reason for hiding this comment

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

Please can you make the --cwd option optional, as of now it is mandatory thanks

@PaulFarault PaulFarault marked this pull request as draft October 25, 2024 09:31
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.

Optional --run-directory
3 participants