Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow edgeview VNC access even the app does not get an IP #3882

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions pkg/edgeview/src/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,20 +492,28 @@ func getAllAppIPs() []appIPvnc {
status := strings.TrimSuffix(string(retbytes1), "\n")
appIPs, appUUID := getAppIPs(status)
var oneAppIPs []appIPvnc
if len(appIPs) > 0 {
retbytes1, err := os.ReadFile("/run/zedagent/AppInstanceConfig/" + appUUID.String() + ".json")
if err != nil {
log.Errorf("getAllAppIPs: run appinstcfg %v", err)
continue
}
var appInstCfg types.AppInstanceConfig
err = json.Unmarshal(retbytes1, &appInstCfg)
if err != nil {
log.Errorf("getAllAppIPs: unmarshal %v", err)
continue
}
retbytes1, err = os.ReadFile("/run/zedagent/AppInstanceConfig/" + appUUID.String() + ".json")
if err != nil {
log.Errorf("getAllAppIPs: run appinstcfg %v", err)
continue
}
var appInstCfg types.AppInstanceConfig
err = json.Unmarshal(retbytes1, &appInstCfg)
if err != nil {
log.Errorf("getAllAppIPs: unmarshal %v", err)
continue
}

enableVNC := appInstCfg.FixedResources.EnableVnc
enableVNC := appInstCfg.FixedResources.EnableVnc
// Even if the app has no IP address, we still want to allow VNC if it is enabled
if len(appIPs) == 0 {
ipVNC := appIPvnc{
vncEnable: enableVNC,
appName: appInstCfg.DisplayName,
vncPort: int(appInstCfg.FixedResources.VncDisplay),
}
oneAppIPs = append(oneAppIPs, ipVNC)
} else {
for _, ipaddr := range appIPs {
ipVNC := appIPvnc{
ipAddr: ipaddr,
Expand Down
Loading