[OpenNESS-dev] How to run a shell script from the edgenode code

Ashish Saxena Ashish.Saxena at hsc.com
Thu Apr 16 04:03:47 UTC 2020

Hi Openness Team,

I have deployed  Openness version 20.03 controller and node on my setup.
I am deploying one application on the edgenode , and want to give DISPLAY as environment variable to the application.
For this , I have modified the code of eva_deploy.go file as follows:

func (s *DeploySrv) syncDeployContainer(ctx context.Context,
        dapp *metadata.DeployedApp) {
@@ -674,9 +687,41 @@ func (s *DeploySrv) syncDeployContainer(ctx context.Context,
                Memory:   int64(dapp.App.Memory) * 1024 * 1024,
                NanoCPUs: nanoCPUs,
+          cmd := exec.Command("/opt/edgenode/echo_display.sh")
+               out, err := cmd.CombinedOutput()
+               if err != nil {
+                log.Errf("cmd.Run() failed with %s\n", err)
+               }
+               //fmt.Printf("combined out:\n%s\n", string(out))
+            display := string(out)
+            final_display2 := "DISPLAY="+display
+            final_display := strings.TrimSuffix(final_display2,"\n")
+            log.Infof("final display variable= %v\n", final_display)
        if s.cfg.UseCNI {
                infraCtrID, cniErr := cni.CreateInfrastructureContainer(ctx, dapp)
@@ -690,6 +735,7 @@ func (s *DeploySrv) syncDeployContainer(ctx context.Context,

        containerCfg := container.Config{
                Image: dapp.App.Id,
+               Env:   []string{final_display},

        // Update hostCfg and containCfg based on EAC configuration

And the script  /opt/edgenode/echo_display.sh is as follows:

The code is compiling fine and edgenode has been deployed successfully, but while deploying the application , I am not getting the DISPLAY string and edgenode logs for the same is :
mec-app-edgednssvr  | <134>Apr 16 10:31:27 edgednssvr[1]: [main] Heartbeat
appliance_1         | <131>Apr 16 09:57:01 appliance[81734]: [eva] cmd.Run() failed with fork/exec /opt/edgenode/echo_display.sh: no such file or directory
nts                 | NES: [INFO] done
eaa_1               | <134>Apr 16 10:23:27 eaa[6]: [eaa] Heartbeat
mec-app-edgednssvr  | <134>Apr 16 10:32:27 edgednssvr[1]: [main] Heartbeat
nts                 | NES: [INFO] DPDK port: 1 PCI address: 0000:60:00.1 MAC address: ac:1f:6b:6b:49:85
appliance_1         | <134>Apr 16 09:57:01 appliance[81734]: [eva] display variable=

It looks like the script is not visible while deploying the application , which is actually present at the path , and I have make sure that the script exists at that path.

How can I  run that shell script from the code to meet our objective?

Thanks and Regards,

DISCLAIMER: This electronic message and all of its contents, contains information which is privileged, confidential or otherwise protected from disclosure. The information contained in this electronic mail transmission is intended for use only by the individual or entity to which it is addressed. If you are not the intended recipient or may have received this electronic mail transmission in error, please notify the sender immediately and delete / destroy all copies of this electronic mail transmission without disclosing, copying, distributing, forwarding, printing or retaining any part of it. Hughes Systique accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openness.org/pipermail/developer/attachments/20200416/bd9ab49e/attachment-0001.html>

More information about the Developer mailing list