Skip to content

Conversation

@pavan-gokarla
Copy link

@pavan-gokarla pavan-gokarla commented Oct 18, 2025

…th "ssh-"

Assertions added for context-name to start with "ssh-"

Tested (run the relevant ones):

  • Code formatting: install pre-commit (auto-check on commit) or bash format.sh
  • Any manual or new tests for this PR (please specify below)
  • All smoke tests: /smoke-test (CI) or pytest tests/test_smoke.py (local)
  • Relevant individual tests: /smoke-test -k test_name (CI) or pytest tests/test_smoke.py::test_name (local)
  • Backward compatibility: /quicktest-core (CI) or pytest tests/smoke_tests/test_backward_compat.py (local)

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

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

Thanks @pavan-gokarla for the contribution! Left some comments

elif to_provision.region is not None and to_provision.cloud is not None:
# For public clouds, provision.region is always set.
if clouds.SSH().is_same_cloud(to_provision.cloud):
assert to_provision.region.startswith("ssh-"), "SSH context must start with 'ssh-'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm, i thought a user does not need to specify ssh-. Is it true that the region has to be start with ssh-?

Copy link
Author

Choose a reason for hiding this comment

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

Can you clarify these things, does region need to start with ssh, if yes do we need to strip away the ssh, if it does not start with ssh- we are not required to check right?

def expand_infras(cls) -> List[str]:
return [
f'{cls.canonical_name()}/{c.lstrip("ssh-")}'
f'{cls.canonical_name()}/{c.lstrip("ssh-")}' if c.startswith("ssh-") else "."
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just not use lstrip? also, why are we using . when it is not starting with ssh-?

msg = f'Task{task_name} requires '
if region not in existing_contexts:
if is_ssh:
assert region.startswith("ssh-"), "SSH context must start with 'ssh-'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's get rid of using lstrip. Otherwise, ssh-ssabc will become abc

Copy link
Author

Choose a reason for hiding this comment

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

instead of lstrip will it be ok if i use string slicing?

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.

2 participants