-
Notifications
You must be signed in to change notification settings - Fork 312
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
Print warning to stdout #6233
base: develop
Are you sure you want to change the base?
Print warning to stdout #6233
Conversation
This enables the use of `pcluster dcv-connect -n <cluster> | pbcopy` to copy the url directly into macOS paste buffer.
@@ -64,10 +64,11 @@ def _dcv_connect(args): | |||
|
|||
try: | |||
url = _retry(_retrieve_dcv_session_url, func_args=[cmd, args.cluster_name, head_node_ip], attempts=4) | |||
url_message = f"Please use the following one-time URL in your browser within 30 seconds:\n{url}" | |||
url_message = f"Please use the following one-time URL in your browser within 30 seconds:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a test that should be changed accordingly:
aws-parallelcluster/tests/integration-tests/tests/dcv/test_dcv.py
Lines 76 to 79 in ea57725
assert_that(result.stdout).matches( | |
r"Please use the following one-time URL in your browser within 30 seconds:\n" | |
r"https:\/\/(\b(?:\d{1,3}\.){3}\d{1,3}\b):" + str(dcv_port) + r"\?authToken=(.*)" | |
) |
@@ -64,10 +64,11 @@ def _dcv_connect(args): | |||
|
|||
try: | |||
url = _retry(_retrieve_dcv_session_url, func_args=[cmd, args.cluster_name, head_node_ip], attempts=4) | |||
url_message = f"Please use the following one-time URL in your browser within 30 seconds:\n{url}" | |||
url_message = f"Please use the following one-time URL in your browser within 30 seconds:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change we are removing an explicative message from stdout to make it easier to consume the url.
What if this command returns a JSON, such as:
{
"message": "Please use the following one-time URL in your browser within 30 seconds",
"url": "https://...."
}
This would be consistent with the other pcluster commands returning JSON and would make possible to consume the url easily with jq or, even better, with the --query option of the pcluster CLI.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. Please feel free to change it.
Description of changes
pcluster dcv-connect -n <cluster> | pbcopy
to copy the url directly into macOS paste buffer.