blob: 180dd3f41824950618048585103d6aef2ea0f283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
@user
Feature: Functional test for user access
Need nodes: hanode1
Scenario: User in haclient group
Given Cluster service is "stopped" on "hanode1"
When Run "useradd -m -s /bin/bash -N -g 90 xin1" on "hanode1"
When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~xin1/.bashrc" on "hanode1"
When Try "su - xin1 -c 'crm cluster init -y'"
Then Except multiple lines
"""
ERROR: Please run this command starting with "sudo".
Currently, this command needs to use sudo to escalate itself as root.
Please consider to add "xin1" as sudoer. For example:
sudo bash -c 'echo "xin1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin1'
"""
When Run "echo "xin1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin1" on "hanode1"
When Try "su - xin1 -c 'crm cluster init -y'"
Then Except multiple lines
"""
ERROR: Please run this command starting with "sudo"
"""
When Run "su - xin1 -c 'sudo crm cluster init -y'" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Run "su - xin1 -c 'crm node standby hanode1'" on "hanode1"
Then Node "hanode1" is standby
@clean
Scenario: User in sudoer
Given Cluster service is "stopped" on "hanode1"
When Run "useradd -m -s /bin/bash xin3" on "hanode1"
When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~xin3/.bashrc" on "hanode1"
And Run "echo "xin3 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/xin3" on "hanode1"
When Try "su - xin3 -c 'crm cluster init -y'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: Please run this command starting with "sudo"
"""
When Run "su - xin3 -c 'sudo crm cluster init -y'" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Try "su - xin3 -c 'crm node standby hanode1'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: Please run this command starting with "sudo"
"""
When Run "su - xin3 -c 'sudo crm node standby hanode1'" on "hanode1"
Then Node "hanode1" is standby
@clean
Scenario: Normal user access
Given Cluster service is "stopped" on "hanode1"
When Run "useradd -m -s /bin/bash user1" on "hanode1"
When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user1/.bashrc" on "hanode1"
When Try "su - user1 -c 'crm cluster init -y'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: Please run this command starting with "sudo".
Currently, this command needs to use sudo to escalate itself as root.
Please consider to add "user1" as sudoer. For example:
sudo bash -c 'echo "user1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user1'
"""
When Run "echo "user1 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user1" on "hanode1"
When Try "su - user1 -c 'crm cluster init -y'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: Please run this command starting with "sudo"
"""
When Run "su - user1 -c 'sudo crm cluster init -y'" on "hanode1"
Then Cluster service is "started" on "hanode1"
When Run "useradd -m -s /bin/bash user2" on "hanode1"
When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user2/.bashrc" on "hanode1"
When Try "su - user2 -c 'crm node standby hanode1'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: This command needs higher privilege.
Option 1) Please consider to add "user2" as sudoer. For example:
sudo bash -c 'echo "user2 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user2'
Option 2) Add "user2" to the haclient group. For example:
sudo usermod -g haclient user2
"""
When Run "usermod -g haclient user2" on "hanode1"
When Run "su - user2 -c 'crm node standby hanode1'" on "hanode1"
Then Node "hanode1" is standby
When Run "useradd -m -s /bin/bash user3" on "hanode1"
When Run "echo 'export PATH=$PATH:/usr/sbin/' >> ~user3/.bashrc" on "hanode1"
When Try "su - user3 -c 'crm node online hanode1'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: This command needs higher privilege.
Option 1) Please consider to add "user3" as sudoer. For example:
sudo bash -c 'echo "user3 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user3'
Option 2) Add "user3" to the haclient group. For example:
sudo usermod -g haclient user3
"""
When Run "echo "user3 ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user3" on "hanode1"
When Try "su - user3 -c 'crm node online hanode1'"
Then Except multiple lines
"""
WARNING: Failed to open log file: [Errno 13] Permission denied: '/var/log/crmsh/crmsh.log'
ERROR: Please run this command starting with "sudo"
"""
When Run "su - user3 -c 'sudo crm node online hanode1'" on "hanode1"
Then Node "hanode1" is online
|