Skip to content

Conversation

@vthiebaut10
Copy link
Contributor

Add a new parameter --rdp/--winrdp that uses port forwarding to allow users to create RDP connections over the SSH connection created by the extension.
This is useful for costumers who want to connect to their Azure Arc Servers via RDP using the Arc Connectivity Platform.


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
The precondition is to put your code inside this repository and upgrade the version in the pull request but do not modify src/index.json.

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 15, 2022

SSH

@yonzhan yonzhan requested review from jiasli and zhoxing-ms June 15, 2022 23:43
@yonzhan yonzhan added this to the Jun 2022 (2022-07-05) milestone Jun 15, 2022
if not os.path.isfile(rdp_path):
raise azclierror.BadRequestError("Could not find " + rdp_command + ".exe. Is the rdp client installed?")
else:
raise azclierror.BadRequestError("Platform is not supported for this command. Supported platforms: Windows")
Copy link
Member

@mgreenegit mgreenegit Jun 28, 2022

Choose a reason for hiding this comment

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

Could we potentially make this cross-platform by calling the address using the rdp:// protocol handler instead of calling the .exe directly?

Copy link
Member

@mgreenegit mgreenegit Jun 29, 2022

Choose a reason for hiding this comment

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

@zhoxing-ms if we cannot make this cross-platform, is there some way to only show the parameter on Windows machines and not on Mac/Linux?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jiasli Do you have any suggestions on this question?


op_call = ssh_utils.start_ssh_connection
if winrdp:
if platform.system() != 'Windows':
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to confirm with you that the judgment here does not need to ignore the case of platform.system()?

Comment on lines 160 to 174
def print_error_messages_from_log(log_list, print_ssh_logs, ssh_process, terminated):
# Read the remaining log messages since the connection was established.
next_line = ssh_process.stderr.readline()
while next_line:
if print_ssh_logs:
print(next_line, end='')
else:
log_list.append(next_line)
next_line = ssh_process.stderr.readline()

# If ssh process was not forced to terminate, print potential error messages.
if ssh_process.returncode != 0 and not print_ssh_logs and not terminated:
for line in log_list:
if "debug1:" not in line and line != '':
print(str(line))
Copy link
Contributor

Choose a reason for hiding this comment

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

print_error_messages_from_log

If you are printing the error messages, why not use the log.error?

@jiasli jiasli merged commit 2b49de0 into Azure:main Jun 30, 2022
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.

5 participants