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(
2222 ctx context.Context ,
2323 nodeDefinition containerlab.NodeDefinition ,
2424 containerDetails containerlab.ContainerDetails ,
25- _isAdmin bool ,
25+ isAdmin bool ,
2626) error {
2727 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 {
2931 execCommand = v
3032 }
3133
Original file line number Diff line number Diff line change @@ -12,6 +12,10 @@ const (
1212 // ref: https://uokada.hatenablog.jp/entry/2015/05/20/001208
1313 defaultSSHPassword string = "clab@123"
1414
15+ defaultSSHPort uint16 = 22
16+
17+ defaultExecCommand = "sh"
18+
1519 // AccessMethodKey is the label key to specify the access method.
1620 // The possible values are either "ssh" or "exec".
1721 // With "ssh", access-helper will try to connect to the Node via SSH.
@@ -40,11 +44,10 @@ const (
4044
4145 // sshPortKey is the label key to specify port number for SSH access.
4246 // The default value is defaultPort.
43- sshPortKey = "netcon.janog.gr.jp/sshPort"
44- defaultSSHPort uint16 = 22
47+ sshPortKey = "netcon.janog.gr.jp/sshPort"
4548
4649 // execCommandKey is the label key to specify command for exec access.
4750 // 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 "
5053)
You can’t perform that action at this time.
0 commit comments