Skip to content

Commit

Permalink
Merge pull request #1365 from liangxin1300/20240321_ssh_agent_warning…
Browse files Browse the repository at this point in the history
…_crmsh46

[crmsh-4.6] Fix: sh: Return the value of AuthorizationError.diagnose if it is not None
  • Loading branch information
liangxin1300 authored Mar 25, 2024
2 parents 053594a + ac0fb4b commit bb913ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/crmsh-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ jobs:
timeout-minutes: 40
steps:
- uses: actions/checkout@v3
- name: functional test for user access
- name: functional test for ssh agent
run: |
echo '{ "exec-opts": ["native.cgroupdriver=systemd"] }' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker.service
Expand Down
1 change: 1 addition & 0 deletions crmsh/sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def diagnose(self) -> str:
ret = super().diagnose()
if not ret:
return 'Please configure passwordless authentication with "crm cluster init ssh" and "crm cluster join ssh"'
return ret


class CommandFailure(Error):
Expand Down
6 changes: 6 additions & 0 deletions test/features/ssh_agent.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ Feature: ssh-agent support
And Run "test x3 == x$(sudo awk 'END {print NR}' ~hacluster/.ssh/authorized_keys)" OK
And Run "grep -E 'hosts = (root|alice)@hanode1' /root/.config/crm/crm.conf" OK on "hanode1,hanode2,hanode3"

# This test is not applicable for non-root user, since the root ssh key pair exists
@skip_non_root
Scenario: Verify expected error message when SSH_AUTH_SOCK is not set
When Try "crm cluster remove hanode3 -y" on "hanode1"
Then Expected "Environment variable SSH_AUTH_SOCK does not exist" in stderr

Scenario: Skip creating ssh key pairs with --use-ssh-agent and use -N
Given Run "crm cluster stop" OK on "hanode1,hanode2,hanode3"
When Run "SSH_AUTH_SOCK=/tmp/ssh-auth-sock crm cluster init --use-ssh-agent -y -N hanode2 -N hanode3" on "hanode1"
Expand Down

0 comments on commit bb913ab

Please sign in to comment.