File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,12 @@ func (h *ExecAccessHelper) access(
22
22
ctx context.Context ,
23
23
nodeDefinition containerlab.NodeDefinition ,
24
24
containerDetails containerlab.ContainerDetails ,
25
- _isAdmin bool ,
25
+ isAdmin bool ,
26
26
) error {
27
27
execCommand := defaultExecCommand
28
- if v , ok := nodeDefinition .Labels [execCommandKey ]; ok {
28
+ if v , ok := nodeDefinition .Labels [execCommandForAdminKey ]; ok && isAdmin {
29
+ execCommand = v
30
+ } else if v , ok := nodeDefinition .Labels [execCommandKey ]; ok {
29
31
execCommand = v
30
32
}
31
33
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ const (
12
12
// ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208
13
13
defaultSSHPassword string = "clab@123"
14
14
15
+ defaultSSHPort uint16 = 22
16
+
17
+ defaultExecCommand = "sh"
18
+
15
19
// AccessMethodKey is the label key to specify the access method.
16
20
// The possible values are either "ssh" or "exec".
17
21
// With "ssh", access-helper will try to connect to the Node via SSH.
@@ -40,11 +44,10 @@ const (
40
44
41
45
// sshPortKey is the label key to specify port number for SSH access.
42
46
// The default value is defaultPort.
43
- sshPortKey = "netcon.janog.gr.jp/sshPort"
44
- defaultSSHPort uint16 = 22
47
+ sshPortKey = "netcon.janog.gr.jp/sshPort"
45
48
46
49
// execCommandKey is the label key to specify command for exec access.
47
50
// The default value is defaultExecCommand.
48
- execCommandKey = "netcon.janog.gr.jp/execCommand"
49
- defaultExecCommand = "sh "
51
+ execCommandKey = "netcon.janog.gr.jp/execCommand"
52
+ execCommandForAdminKey = "netcon.janog.gr.jp/execCommandForAdmin "
50
53
)
You can’t perform that action at this time.
0 commit comments